0
|
1 ;;; autoload.el --- maintain autoloads in loaddefs.el.
|
|
2 ;;; Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
|
3 ;;; Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
|
|
4 ;;; Copyright (C) 1996 Ben Wing.
|
|
5
|
|
6 ;; Author: Roland McGrath <roland@gnu.ai.mit.edu>
|
|
7 ;; Keywords: maint
|
|
8
|
12
|
9 ;; This file is part of XEmacs.
|
|
10
|
|
11 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
12 ;; under the terms of the GNU General Public License as published by
|
|
13 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
14 ;; any later version.
|
0
|
15
|
12
|
16 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
19 ;; General Public License for more details.
|
|
20
|
|
21 ;; You should have received a copy of the GNU General Public License
|
|
22 ;; along with XEmacs; see the file COPYING. If not, write to the Free
|
|
23 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
24 ;; 02111-1307, USA.
|
|
25
|
|
26 ;;; Synched up with: Not synched with FSF.
|
0
|
27
|
|
28 ;;; Commentary:
|
|
29
|
|
30 ;; This code helps GNU Emacs maintainers keep the loaddefs.el file up to
|
|
31 ;; date. It interprets magic cookies of the form ";;;###autoload" in
|
|
32 ;; lisp source files in various useful ways. To learn more, read the
|
|
33 ;; source; if you're going to use this, you'd better be able to.
|
|
34
|
|
35 ;;; Code:
|
|
36
|
|
37 (defun make-autoload (form file)
|
|
38 "Turn FORM, a defun or defmacro, into an autoload for source file FILE.
|
|
39 Returns nil if FORM is not a defun, define-skeleton or defmacro."
|
|
40 (let ((car (car-safe form)))
|
|
41 (if (memq car '(defun define-skeleton defmacro))
|
|
42 (let ((macrop (eq car 'defmacro))
|
|
43 name doc)
|
|
44 (setq form (cdr form)
|
|
45 name (car form)
|
|
46 ;; Ignore the arguments.
|
|
47 form (cdr (if (eq car 'define-skeleton)
|
|
48 form
|
|
49 (cdr form)))
|
|
50 doc (car form))
|
|
51 (if (stringp doc)
|
|
52 (setq form (cdr form))
|
|
53 (setq doc nil))
|
|
54 (list 'autoload (list 'quote name) file doc
|
|
55 (or (eq car 'define-skeleton)
|
|
56 (eq (car-safe (car form)) 'interactive))
|
|
57 (if macrop (list 'quote 'macro) nil)))
|
|
58 nil)))
|
|
59
|
|
60 (put 'define-skeleton 'doc-string-elt 3)
|
|
61
|
12
|
62 (defvar generate-autoload-cookie ";;;###autoload"
|
0
|
63 "Magic comment indicating the following form should be autoloaded.
|
12
|
64 Used by `update-file-autoloads'. This string should be
|
0
|
65 meaningless to Lisp (e.g., a comment).
|
|
66
|
|
67 This string is used:
|
|
68
|
|
69 ;;;###autoload
|
|
70 \(defun function-to-be-autoloaded () ...)
|
|
71
|
12
|
72 If this string appears alone on a line, the following form will be
|
|
73 read and an autoload made for it. If it is followed by the string
|
|
74 \"immediate\", then the form on the following line will be copied
|
|
75 verbatim. If there is further text on the line, that text will be
|
|
76 copied verbatim to `generated-autoload-file'.")
|
0
|
77
|
12
|
78 (defvar generate-autoload-section-header "\f\n;;;### "
|
0
|
79 "String inserted before the form identifying
|
|
80 the section of autoloads for a file.")
|
|
81
|
12
|
82 (defvar generate-autoload-section-trailer "\n;;;***\n"
|
0
|
83 "String which indicates the end of the section of autoloads for a file.")
|
|
84
|
|
85 ;;; Forms which have doc-strings which should be printed specially.
|
|
86 ;;; A doc-string-elt property of ELT says that (nth ELT FORM) is
|
|
87 ;;; the doc-string in FORM.
|
|
88 ;;;
|
|
89 ;;; There used to be the following note here:
|
|
90 ;;; ;;; Note: defconst and defvar should NOT be marked in this way.
|
|
91 ;;; ;;; We don't want to produce defconsts and defvars that
|
|
92 ;;; ;;; make-docfile can grok, because then it would grok them twice,
|
|
93 ;;; ;;; once in foo.el (where they are given with ;;;###autoload) and
|
|
94 ;;; ;;; once in loaddefs.el.
|
|
95 ;;;
|
|
96 ;;; Counter-note: Yes, they should be marked in this way.
|
|
97 ;;; make-docfile only processes those files that are loaded into the
|
|
98 ;;; dumped Emacs, and those files should never have anything
|
|
99 ;;; autoloaded here. The above-feared problem only occurs with files
|
|
100 ;;; which have autoloaded entries *and* are processed by make-docfile;
|
|
101 ;;; there should be no such files.
|
|
102
|
|
103 (put 'autoload 'doc-string-elt 3)
|
|
104 (put 'defun 'doc-string-elt 3)
|
|
105 (put 'defvar 'doc-string-elt 3)
|
|
106 (put 'defconst 'doc-string-elt 3)
|
|
107 (put 'defmacro 'doc-string-elt 3)
|
|
108
|
|
109 (defun autoload-trim-file-name (file)
|
12
|
110 "Returns a relative pathname of FILE including the last directory."
|
0
|
111 (setq file (expand-file-name file))
|
12
|
112 (file-relative-name file (file-name-directory
|
|
113 (directory-file-name
|
|
114 (file-name-directory file)))))
|
0
|
115
|
|
116 ;;;###autoload
|
|
117 (defun generate-file-autoloads (file &optional funlist)
|
|
118 "Insert at point a loaddefs autoload section for FILE.
|
|
119 autoloads are generated for defuns and defmacros in FILE
|
|
120 marked by `generate-autoload-cookie' (which see).
|
|
121 If FILE is being visited in a buffer, the contents of the buffer
|
|
122 are used."
|
|
123 (interactive "fGenerate autoloads for file: ")
|
12
|
124 (generate-file-autoloads-1 file funlist))
|
|
125
|
|
126 (defun* generate-file-autoloads-1 (file funlist)
|
|
127 "Insert at point a loaddefs autoload section for FILE.
|
|
128 autoloads are generated for defuns and defmacros in FILE
|
|
129 marked by `generate-autoload-cookie' (which see).
|
|
130 If FILE is being visited in a buffer, the contents of the buffer
|
|
131 are used."
|
0
|
132 (let ((outbuf (current-buffer))
|
|
133 (autoloads-done '())
|
12
|
134 (load-name (replace-in-string (file-name-nondirectory file)
|
|
135 "\\.elc?$"
|
|
136 ""))
|
|
137 (trim-name (autoload-trim-file-name file))
|
0
|
138 (dofiles (not (null funlist)))
|
|
139 (print-length nil)
|
|
140 (print-readably t) ; XEmacs
|
|
141 (float-output-format nil)
|
12
|
142 ;; (done-any nil)
|
0
|
143 (visited (get-file-buffer file))
|
|
144 output-end)
|
|
145
|
|
146 ;; If the autoload section we create here uses an absolute
|
|
147 ;; pathname for FILE in its header, and then Emacs is installed
|
|
148 ;; under a different path on another system,
|
|
149 ;; `update-autoloads-here' won't be able to find the files to be
|
|
150 ;; autoloaded. So, if FILE is in the same directory or a
|
|
151 ;; subdirectory of the current buffer's directory, we'll make it
|
|
152 ;; relative to the current buffer's directory.
|
|
153 (setq file (expand-file-name file))
|
|
154
|
|
155 (save-excursion
|
|
156 (unwind-protect
|
|
157 (progn
|
24
|
158 (let ((find-file-hooks nil))
|
|
159 (set-buffer (or visited (find-file-noselect file))))
|
0
|
160 (save-excursion
|
|
161 (save-restriction
|
|
162 (widen)
|
|
163 (goto-char (point-min))
|
12
|
164 (unless (search-forward generate-autoload-cookie nil t)
|
|
165 (message "No autoloads found in %s" trim-name)
|
|
166 (return-from generate-file-autoloads-1))
|
|
167
|
|
168 (message "Generating autoloads for %s..." trim-name)
|
|
169 (goto-char (point-min))
|
0
|
170 (while (if dofiles funlist (not (eobp)))
|
|
171 (if (not dofiles)
|
|
172 (skip-chars-forward " \t\n\f")
|
|
173 (goto-char (point-min))
|
|
174 (re-search-forward
|
|
175 (concat "(def\\(un\\|var\\|const\\|macro\\) "
|
|
176 (regexp-quote (symbol-name (car funlist)))
|
|
177 "\\s "))
|
|
178 (goto-char (match-beginning 0)))
|
|
179 (cond
|
|
180 ((or dofiles
|
|
181 (looking-at (regexp-quote generate-autoload-cookie)))
|
|
182 (if dofiles
|
|
183 nil
|
|
184 (search-forward generate-autoload-cookie)
|
|
185 (skip-chars-forward " \t"))
|
12
|
186 ;; (setq done-any t)
|
0
|
187 (if (or dofiles (eolp))
|
|
188 ;; Read the next form and make an autoload.
|
|
189 (let* ((form (prog1 (read (current-buffer))
|
|
190 (or (bolp) (forward-line 1))))
|
|
191 (autoload (make-autoload form load-name))
|
|
192 (doc-string-elt (get (car-safe form)
|
|
193 'doc-string-elt)))
|
|
194 (if autoload
|
|
195 (setq autoloads-done (cons (nth 1 form)
|
|
196 autoloads-done))
|
|
197 (setq autoload form))
|
|
198 (if (and doc-string-elt
|
|
199 (stringp (nth doc-string-elt autoload)))
|
|
200 ;; We need to hack the printing because the
|
|
201 ;; doc-string must be printed specially for
|
|
202 ;; make-docfile (sigh).
|
|
203 (let* ((p (nthcdr (1- doc-string-elt)
|
|
204 autoload))
|
|
205 (elt (cdr p)))
|
|
206 (setcdr p nil)
|
|
207 (princ "\n(" outbuf)
|
|
208 ;; XEmacs change: don't let ^^L's get into
|
|
209 ;; the file or sorting is hard.
|
|
210 (let ((print-escape-newlines t)
|
|
211 (p (save-excursion
|
|
212 (set-buffer outbuf)
|
|
213 (point)))
|
|
214 p2)
|
|
215 (mapcar (function (lambda (elt)
|
|
216 (prin1 elt outbuf)
|
|
217 (princ " " outbuf)))
|
|
218 autoload)
|
|
219 (save-excursion
|
|
220 (set-buffer outbuf)
|
|
221 (setq p2 (point-marker))
|
|
222 (goto-char p)
|
|
223 (save-match-data
|
|
224 (while (search-forward "\^L" p2 t)
|
|
225 (delete-char -1)
|
|
226 (insert "\\^L")))
|
|
227 (goto-char p2)
|
|
228 ))
|
|
229 (princ "\"\\\n" outbuf)
|
|
230 (let ((begin (save-excursion
|
|
231 (set-buffer outbuf)
|
|
232 (point))))
|
|
233 (princ (substring
|
|
234 (prin1-to-string (car elt)) 1)
|
|
235 outbuf)
|
|
236 ;; Insert a backslash before each ( that
|
|
237 ;; appears at the beginning of a line in
|
|
238 ;; the doc string.
|
|
239 (save-excursion
|
|
240 (set-buffer outbuf)
|
|
241 (save-excursion
|
|
242 (while (search-backward "\n(" begin t)
|
|
243 (forward-char 1)
|
|
244 (insert "\\"))))
|
|
245 (if (null (cdr elt))
|
|
246 (princ ")" outbuf)
|
|
247 (princ " " outbuf)
|
|
248 (princ (substring
|
|
249 (prin1-to-string (cdr elt))
|
|
250 1)
|
|
251 outbuf))
|
|
252 (terpri outbuf)))
|
|
253 ;; XEmacs change: another fucking ^L hack
|
|
254 (let ((p (save-excursion
|
|
255 (set-buffer outbuf)
|
|
256 (point)))
|
|
257 (print-escape-newlines t)
|
|
258 p2)
|
|
259 (print autoload outbuf)
|
|
260 (save-excursion
|
|
261 (set-buffer outbuf)
|
|
262 (setq p2 (point-marker))
|
|
263 (goto-char p)
|
|
264 (save-match-data
|
|
265 (while (search-forward "\^L" p2 t)
|
|
266 (delete-char -1)
|
|
267 (insert "\\^L")))
|
|
268 (goto-char p2)
|
|
269 ))
|
|
270 ))
|
|
271 ;; Copy the rest of the line to the output.
|
|
272 (let ((begin (point)))
|
|
273 (terpri outbuf)
|
|
274 (cond ((looking-at "immediate\\s *$") ; XEmacs
|
|
275 ;; This is here so that you can automatically
|
|
276 ;; have small hook functions copied to
|
|
277 ;; loaddefs.el so that it's not necessary to
|
|
278 ;; load a whole file just to get a two-line
|
|
279 ;; do-nothing find-file-hook... --Stig
|
|
280 (forward-line 1)
|
|
281 (setq begin (point))
|
|
282 (forward-sexp)
|
|
283 (forward-line 1))
|
|
284 (t
|
|
285 (forward-line 1)))
|
|
286 (princ (buffer-substring begin (point)) outbuf))))
|
|
287 ((looking-at ";")
|
|
288 ;; Don't read the comment.
|
|
289 (forward-line 1))
|
|
290 (t
|
|
291 (forward-sexp 1)
|
|
292 (forward-line 1)))
|
|
293 (if dofiles
|
|
294 (setq funlist (cdr funlist)))))))
|
32
|
295 ;;(unless visited
|
0
|
296 ;; We created this buffer, so we should kill it.
|
32
|
297 ;; Customize needs it later, we don't want to read the file
|
|
298 ;; in twice.
|
|
299 ;;(kill-buffer (current-buffer)))
|
0
|
300 (set-buffer outbuf)
|
|
301 (setq output-end (point-marker))))
|
|
302 (if t ;; done-any
|
|
303 ;; XEmacs -- always do this so that we cache the information
|
|
304 ;; that we've processed the file already.
|
|
305 (progn
|
|
306 (insert generate-autoload-section-header)
|
12
|
307 (prin1 (list 'autoloads autoloads-done load-name trim-name)
|
0
|
308 outbuf)
|
|
309 (terpri outbuf)
|
12
|
310 ;;;; (insert ";;; Generated autoloads from "
|
|
311 ;;;; (autoload-trim-file-name file) "\n")
|
0
|
312 ;; Warn if we put a line in loaddefs.el
|
|
313 ;; that is long enough to cause trouble.
|
12
|
314 (when (< output-end (point))
|
|
315 (setq output-end (point-marker)))
|
0
|
316 (while (< (point) output-end)
|
|
317 (let ((beg (point)))
|
|
318 (end-of-line)
|
|
319 (if (> (- (point) beg) 900)
|
|
320 (progn
|
|
321 (message "A line is too long--over 900 characters")
|
|
322 (sleep-for 2)
|
|
323 (goto-char output-end))))
|
|
324 (forward-line 1))
|
|
325 (goto-char output-end)
|
|
326 (insert generate-autoload-section-trailer)))
|
|
327 (or noninteractive ; XEmacs: only need one line in -batch mode.
|
|
328 (message "Generating autoloads for %s...done" file))))
|
12
|
329
|
0
|
330
|
12
|
331 (defvar generated-autoload-file
|
|
332 (expand-file-name "../lisp/prim/auto-autoloads.el" data-directory)
|
|
333 "*File `update-file-autoloads' puts autoloads into.
|
0
|
334 A .el file can set this in its local variables section to make its
|
|
335 autoloads go somewhere else.")
|
|
336
|
32
|
337 (defvar generated-custom-file
|
|
338 (expand-file-name "../lisp/prim/custom-load.el" data-directory)
|
|
339 "*File `update-file-autoloads' puts customization into.")
|
|
340
|
|
341 ;; Written by Per Abrahamsen
|
|
342 (defun autoload-snarf-defcustom (file)
|
|
343 "Snarf all customizations in the current buffer."
|
|
344 (let ((visited (get-file-buffer file)))
|
|
345 (save-excursion
|
|
346 (set-buffer (or visited (find-file-noselect file)))
|
|
347 (when (and file (string-match "\\`\\(.*\\)\\.el\\'" file))
|
|
348 (goto-char (point-min))
|
|
349 (condition-case nil
|
|
350 (let ((name (file-name-nondirectory (match-string 1 file))))
|
|
351 (while t
|
|
352 (let ((expr (read (current-buffer))))
|
|
353 (when (and (listp expr)
|
|
354 (memq (car expr) '(defcustom defface defgroup)))
|
|
355 (eval expr)
|
|
356 (put (nth 1 expr) 'custom-where name)))))
|
|
357 (error nil)))
|
|
358 (unless (buffer-modified-p)
|
|
359 (kill-buffer (current-buffer))))))
|
|
360
|
0
|
361 ;;;###autoload
|
|
362 (defun update-file-autoloads (file)
|
|
363 "Update the autoloads for FILE in `generated-autoload-file'
|
|
364 \(which FILE might bind in its local variables)."
|
|
365 (interactive "fUpdate autoloads for file: ")
|
12
|
366 (setq file (expand-file-name file))
|
|
367 (let ((load-name (replace-in-string (file-name-nondirectory file)
|
|
368 "\\.elc?$"
|
|
369 ""))
|
0
|
370 (trim-name (autoload-trim-file-name file))
|
12
|
371 section-begin form)
|
0
|
372 (save-excursion
|
24
|
373 (let ((find-file-hooks nil))
|
|
374 (set-buffer (or (get-file-buffer generated-autoload-file)
|
|
375 (find-file-noselect generated-autoload-file))))
|
12
|
376 ;; First delete all sections for this file.
|
|
377 (goto-char (point-min))
|
|
378 (while (search-forward generate-autoload-section-header nil t)
|
|
379 (setq section-begin (match-beginning 0))
|
|
380 (setq form (read (current-buffer)))
|
|
381 (when (string= (nth 2 form) load-name)
|
|
382 (search-forward generate-autoload-section-trailer)
|
|
383 (delete-region section-begin (point))))
|
|
384
|
|
385 ;; Now find insertion point for new section
|
|
386 (block find-insertion-point
|
|
387 (goto-char (point-min))
|
|
388 (while (search-forward generate-autoload-section-header nil t)
|
|
389 (setq form (read (current-buffer)))
|
|
390 (when (string< trim-name (nth 3 form))
|
|
391 ;; Found alphabetically correct insertion point
|
|
392 (goto-char (match-beginning 0))
|
|
393 (return-from find-insertion-point))
|
|
394 (search-forward generate-autoload-section-trailer))
|
|
395 (when (eq (point) (point-min)) ; No existing entries?
|
|
396 (goto-char (point-max)))) ; Append.
|
|
397
|
|
398 ;; Add in new sections for file
|
32
|
399 (generate-file-autoloads file)
|
|
400 (autoload-snarf-defcustom file))
|
12
|
401
|
32
|
402 (when (interactive-p) (save-buffer))))
|
0
|
403
|
|
404 ;;;###autoload
|
|
405 (defun update-autoloads-here ()
|
12
|
406 "Update sections of the current buffer generated by `update-file-autoloads'."
|
0
|
407 (interactive)
|
|
408 (let ((generated-autoload-file (buffer-file-name)))
|
|
409 (save-excursion
|
|
410 (goto-char (point-min))
|
|
411 (while (search-forward generate-autoload-section-header nil t)
|
|
412 (let* ((form (condition-case ()
|
|
413 (read (current-buffer))
|
|
414 (end-of-file nil)))
|
|
415 (file (nth 3 form)))
|
|
416 ;; XEmacs change: if we can't find the file as specified, look
|
|
417 ;; around a bit more.
|
|
418 (cond ((and (stringp file)
|
|
419 (or (get-file-buffer file)
|
|
420 (file-exists-p file))))
|
|
421 ((and (stringp file)
|
|
422 (save-match-data
|
|
423 (let ((loc (locate-file (file-name-nondirectory file)
|
|
424 load-path)))
|
|
425 (if (null loc)
|
|
426 nil
|
|
427 (setq loc (expand-file-name
|
|
428 (autoload-trim-file-name loc)
|
|
429 ".."))
|
|
430 (if (or (get-file-buffer loc)
|
|
431 (file-exists-p loc))
|
|
432 (setq file loc)
|
|
433 nil))))))
|
|
434 (t
|
12
|
435 (setq file
|
|
436 (if (y-or-n-p
|
|
437 (format
|
|
438 "Can't find library `%s'; remove its autoloads? "
|
|
439 (nth 2 form) file))
|
|
440 t
|
|
441 (condition-case ()
|
|
442 (read-file-name
|
|
443 (format "Find `%s' load file: "
|
|
444 (nth 2 form))
|
|
445 nil nil t)
|
|
446 (quit nil))))))
|
0
|
447 (if file
|
|
448 (let ((begin (match-beginning 0)))
|
|
449 (search-forward generate-autoload-section-trailer)
|
|
450 (delete-region begin (point))))
|
|
451 (if (stringp file)
|
|
452 (generate-file-autoloads file)))))))
|
|
453
|
|
454 ;;;###autoload
|
12
|
455 (defun update-autoloads-from-directory (dir)
|
|
456 "Update `generated-autoload-file' with all the current autoloads from DIR.
|
|
457 This runs `update-file-autoloads' on each .el file in DIR.
|
|
458 Obsolete autoload entries for files that no longer exist are deleted."
|
0
|
459 (interactive "DUpdate autoloads for directory: ")
|
12
|
460 (setq dir (expand-file-name dir))
|
|
461 (let ((simple-dir (file-name-as-directory
|
|
462 (file-name-nondirectory
|
|
463 (directory-file-name dir))))
|
|
464 (enable-local-eval nil))
|
|
465 (save-excursion
|
24
|
466 (let ((find-file-hooks nil))
|
|
467 (set-buffer (find-file-noselect generated-autoload-file)))
|
12
|
468 (goto-char (point-min))
|
|
469 (while (search-forward generate-autoload-section-header nil t)
|
|
470 (let* ((begin (match-beginning 0))
|
|
471 (form (condition-case ()
|
|
472 (read (current-buffer))
|
|
473 (end-of-file nil)))
|
|
474 (file (nth 3 form)))
|
|
475 (when (and (stringp file)
|
|
476 (string= (file-name-directory file) simple-dir)
|
|
477 (not (file-exists-p
|
|
478 (expand-file-name
|
|
479 (file-name-nondirectory file) dir))))
|
|
480 ;; Remove the obsolete section.
|
|
481 (search-forward generate-autoload-section-trailer)
|
|
482 (delete-region begin (point)))))
|
|
483 ;; Update or create autoload sections for existing files.
|
|
484 (mapcar 'update-file-autoloads (directory-files dir t "^[^=].*\\.el$"))
|
|
485 (unless noninteractive
|
|
486 (save-buffer)))))
|
0
|
487
|
32
|
488 ;; Based on code from Per Abrahamsen
|
|
489 (defun autoload-save-customization ()
|
|
490 (save-excursion
|
|
491 (set-buffer (find-file-noselect generated-custom-file))
|
|
492 (erase-buffer)
|
|
493 (insert
|
|
494 (with-output-to-string
|
|
495 (mapatoms (lambda (symbol)
|
|
496 (let ((members (get symbol 'custom-group))
|
|
497 item where found)
|
|
498 (when members
|
|
499 (princ "(put '")
|
|
500 (princ symbol)
|
|
501 (princ " 'custom-loads '(")
|
|
502 (while members
|
|
503 (setq item (car (car members))
|
|
504 members (cdr members)
|
|
505 where (get item 'custom-where))
|
|
506 (unless (or (null where)
|
|
507 (member where found))
|
|
508 (when found
|
|
509 (princ " "))
|
|
510 (prin1 where)
|
|
511 (push where found)))
|
|
512 (princ "))\n")))))))))
|
|
513
|
0
|
514 ;;;###autoload
|
|
515 (defun batch-update-autoloads ()
|
|
516 "Update the autoloads for the files or directories on the command line.
|
12
|
517 Runs `update-file-autoloads' on files and `update-directory-autoloads'
|
0
|
518 on directories. Must be used only with -batch, and kills Emacs on completion.
|
|
519 Each file will be processed even if an error occurred previously.
|
12
|
520 For example, invoke `xemacs -batch -f batch-update-autoloads *.el'."
|
|
521 (unless noninteractive
|
|
522 (error "batch-update-autoloads is to be used only with -batch"))
|
|
523 (let ((defdir default-directory)
|
|
524 (enable-local-eval nil)) ; Don't query in batch mode.
|
0
|
525 (message "Updating autoloads in %s..." generated-autoload-file)
|
12
|
526 (dolist (arg command-line-args-left)
|
|
527 (setq arg (expand-file-name arg defdir))
|
|
528 (cond
|
|
529 ((file-directory-p arg)
|
|
530 (message "Updating autoloads for directory %s..." arg)
|
|
531 (update-autoloads-from-directory arg))
|
|
532 ((file-exists-p arg)
|
|
533 (update-file-autoloads arg))
|
|
534 (t (error "No such file or directory: %s" arg))))
|
32
|
535 (autoload-save-customization)
|
0
|
536 (save-some-buffers t)
|
|
537 (message "Done")
|
12
|
538 (kill-emacs 0)))
|
0
|
539
|
|
540 (provide 'autoload)
|
|
541
|
|
542 ;;; autoload.el ends here
|