Mercurial > emacs
annotate lisp/emacs-lisp/autoload.el @ 12243:ef2749cf206f
(list-buffers-noselect): Don't let space after buf name
inherit the text props from it.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 15 Jun 1995 20:07:56 +0000 |
parents | 65731429a2c1 |
children | 6aba36eda051 |
rev | line source |
---|---|
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
648
diff
changeset
|
1 ;;; autoload.el --- maintain autoloads in loaddefs.el. |
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
648
diff
changeset
|
2 |
5815
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
3 ;;; Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc. |
473 | 4 ;;; |
846
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
811
diff
changeset
|
5 ;; Author: Roland McGrath <roland@gnu.ai.mit.edu> |
2247
2c7997f249eb
Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1975
diff
changeset
|
6 ;; Keywords: maint |
846
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
811
diff
changeset
|
7 |
473 | 8 ;;; This program is free software; you can redistribute it and/or modify |
9 ;;; it under the terms of the GNU General Public License as published by | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
732
diff
changeset
|
10 ;;; the Free Software Foundation; either version 2, or (at your option) |
473 | 11 ;;; any later version. |
12 ;;; | |
13 ;;; This program is distributed in the hope that it will be useful, | |
14 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 ;;; GNU General Public License for more details. | |
17 ;;; | |
18 ;;; A copy of the GNU General Public License can be obtained from this | |
19 ;;; program's author (send electronic mail to roland@ai.mit.edu) or from | |
20 ;;; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA | |
21 ;;; 02139, USA. | |
22 ;;; | |
23 | |
7942 | 24 ;;; Commentary: |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
25 |
7437 | 26 ;; This code helps GNU Emacs maintainers keep the loaddefs.el file up to |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
27 ;; date. It interprets magic cookies of the form ";;;###autoload" in |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
28 ;; lisp source files in various useful ways. To learn more, read the |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
29 ;; source; if you're going to use this, you'd better be able to. |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
30 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
732
diff
changeset
|
31 ;;; Code: |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
732
diff
changeset
|
32 |
473 | 33 (defun make-autoload (form file) |
34 "Turn FORM, a defun or defmacro, into an autoload for source file FILE. | |
35 Returns nil if FORM is not a defun or defmacro." | |
36 (let ((car (car-safe form))) | |
3777
d6f56b9586f7
(make-autoload): Use memq once instead eq twice.
Roland McGrath <roland@gnu.org>
parents:
3774
diff
changeset
|
37 (if (memq car '(defun defmacro)) |
d6f56b9586f7
(make-autoload): Use memq once instead eq twice.
Roland McGrath <roland@gnu.org>
parents:
3774
diff
changeset
|
38 (let ((macrop (eq car 'defmacro)) |
d6f56b9586f7
(make-autoload): Use memq once instead eq twice.
Roland McGrath <roland@gnu.org>
parents:
3774
diff
changeset
|
39 name doc) |
473 | 40 (setq form (cdr form)) |
41 (setq name (car form)) | |
42 ;; Ignore the arguments. | |
43 (setq form (cdr (cdr form))) | |
44 (setq doc (car form)) | |
45 (if (stringp doc) | |
46 (setq form (cdr form)) | |
47 (setq doc nil)) | |
48 (list 'autoload (list 'quote name) file doc | |
1552
f2901040a07b
* autoload.el (make-autoload): When creating an autoload
Jim Blandy <jimb@redhat.com>
parents:
1108
diff
changeset
|
49 (eq (car-safe (car form)) 'interactive) |
f2901040a07b
* autoload.el (make-autoload): When creating an autoload
Jim Blandy <jimb@redhat.com>
parents:
1108
diff
changeset
|
50 (if macrop (list 'quote 'macro) nil))) |
473 | 51 nil))) |
52 | |
53 (defconst generate-autoload-cookie ";;;###autoload" | |
3774
3b0cb275ca29
(generate-autoload-cookie, update-autoloads-here): Doc fixes.
Roland McGrath <roland@gnu.org>
parents:
2535
diff
changeset
|
54 "Magic comment indicating the following form should be autoloaded. |
3b0cb275ca29
(generate-autoload-cookie, update-autoloads-here): Doc fixes.
Roland McGrath <roland@gnu.org>
parents:
2535
diff
changeset
|
55 Used by \\[update-file-autoloads]. This string should be |
473 | 56 meaningless to Lisp (e.g., a comment). |
57 | |
58 This string is used: | |
59 | |
60 ;;;###autoload | |
61 \(defun function-to-be-autoloaded () ...) | |
62 | |
63 If this string appears alone on a line, the following form will be | |
64 read and an autoload made for it. If there is further text on the line, | |
65 that text will be copied verbatim to `generated-autoload-file'.") | |
66 | |
67 (defconst generate-autoload-section-header "\f\n;;;### " | |
68 "String inserted before the form identifying | |
69 the section of autoloads for a file.") | |
70 | |
71 (defconst generate-autoload-section-trailer "\n;;;***\n" | |
72 "String which indicates the end of the section of autoloads for a file.") | |
73 | |
727 | 74 ;;; Forms which have doc-strings which should be printed specially. |
75 ;;; A doc-string-elt property of ELT says that (nth ELT FORM) is | |
76 ;;; the doc-string in FORM. | |
77 ;;; | |
78 ;;; There used to be the following note here: | |
79 ;;; ;;; Note: defconst and defvar should NOT be marked in this way. | |
80 ;;; ;;; We don't want to produce defconsts and defvars that | |
81 ;;; ;;; make-docfile can grok, because then it would grok them twice, | |
82 ;;; ;;; once in foo.el (where they are given with ;;;###autoload) and | |
83 ;;; ;;; once in loaddefs.el. | |
84 ;;; | |
85 ;;; Counter-note: Yes, they should be marked in this way. | |
86 ;;; make-docfile only processes those files that are loaded into the | |
87 ;;; dumped Emacs, and those files should never have anything | |
88 ;;; autoloaded here. The above-feared problem only occurs with files | |
89 ;;; which have autoloaded entries *and* are processed by make-docfile; | |
90 ;;; there should be no such files. | |
91 | |
473 | 92 (put 'autoload 'doc-string-elt 3) |
727 | 93 (put 'defun 'doc-string-elt 3) |
94 (put 'defvar 'doc-string-elt 3) | |
95 (put 'defconst 'doc-string-elt 3) | |
96 (put 'defmacro 'doc-string-elt 3) | |
473 | 97 |
5837
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
98 (defun autoload-trim-file-name (file) |
7477
a01cc9d6398d
(autoload-trim-file-name): Make it relative
Richard M. Stallman <rms@gnu.org>
parents:
7472
diff
changeset
|
99 ;; Returns a relative pathname of FILE |
a01cc9d6398d
(autoload-trim-file-name): Make it relative
Richard M. Stallman <rms@gnu.org>
parents:
7472
diff
changeset
|
100 ;; starting from the directory that loaddefs.el is in. |
a01cc9d6398d
(autoload-trim-file-name): Make it relative
Richard M. Stallman <rms@gnu.org>
parents:
7472
diff
changeset
|
101 ;; That is normally a directory in load-path, |
a01cc9d6398d
(autoload-trim-file-name): Make it relative
Richard M. Stallman <rms@gnu.org>
parents:
7472
diff
changeset
|
102 ;; which means Emacs will be able to find FILE when it looks. |
a01cc9d6398d
(autoload-trim-file-name): Make it relative
Richard M. Stallman <rms@gnu.org>
parents:
7472
diff
changeset
|
103 ;; Any extra directory names here would prevent finding the file. |
5837
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
104 (setq file (expand-file-name file)) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
105 (file-relative-name file |
7477
a01cc9d6398d
(autoload-trim-file-name): Make it relative
Richard M. Stallman <rms@gnu.org>
parents:
7472
diff
changeset
|
106 (file-name-directory generated-autoload-file))) |
5837
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
107 |
473 | 108 (defun generate-file-autoloads (file) |
109 "Insert at point a loaddefs autoload section for FILE. | |
110 autoloads are generated for defuns and defmacros in FILE | |
2494
c0fbbfadcb04
(generate-file-autoloads): Doc fix.
Roland McGrath <roland@gnu.org>
parents:
2307
diff
changeset
|
111 marked by `generate-autoload-cookie' (which see). |
473 | 112 If FILE is being visited in a buffer, the contents of the buffer |
113 are used." | |
114 (interactive "fGenerate autoloads for file: ") | |
115 (let ((outbuf (current-buffer)) | |
116 (autoloads-done '()) | |
117 (load-name (let ((name (file-name-nondirectory file))) | |
118 (if (string-match "\\.elc?$" name) | |
119 (substring name 0 (match-beginning 0)) | |
120 name))) | |
121 (print-length nil) | |
5837
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
122 (print-readably t) ; This does something in Lucid Emacs. |
4555
434ef4c2fda7
(generate-file-autoloads): Set float-output-format to
Richard M. Stallman <rms@gnu.org>
parents:
4215
diff
changeset
|
123 (float-output-format nil) |
473 | 124 (done-any nil) |
1884
4a8bc12e7017
(generate-file-autoloads): If no buffer was visiting FILE when we started,
Roland McGrath <roland@gnu.org>
parents:
1552
diff
changeset
|
125 (visited (get-file-buffer file)) |
473 | 126 output-end) |
727 | 127 |
128 ;; If the autoload section we create here uses an absolute | |
129 ;; pathname for FILE in its header, and then Emacs is installed | |
130 ;; under a different path on another system, | |
131 ;; `update-autoloads-here' won't be able to find the files to be | |
132 ;; autoloaded. So, if FILE is in the same directory or a | |
732 | 133 ;; subdirectory of the current buffer's directory, we'll make it |
727 | 134 ;; relative to the current buffer's directory. |
135 (setq file (expand-file-name file)) | |
4089
410395998370
(generate-file-autoloads): Fix FILE truename hacking to substring
Roland McGrath <roland@gnu.org>
parents:
4068
diff
changeset
|
136 (let* ((source-truename (file-truename file)) |
410395998370
(generate-file-autoloads): Fix FILE truename hacking to substring
Roland McGrath <roland@gnu.org>
parents:
4068
diff
changeset
|
137 (dir-truename (file-name-as-directory |
410395998370
(generate-file-autoloads): Fix FILE truename hacking to substring
Roland McGrath <roland@gnu.org>
parents:
4068
diff
changeset
|
138 (file-truename default-directory))) |
410395998370
(generate-file-autoloads): Fix FILE truename hacking to substring
Roland McGrath <roland@gnu.org>
parents:
4068
diff
changeset
|
139 (len (length dir-truename))) |
410395998370
(generate-file-autoloads): Fix FILE truename hacking to substring
Roland McGrath <roland@gnu.org>
parents:
4068
diff
changeset
|
140 (if (and (< len (length source-truename)) |
410395998370
(generate-file-autoloads): Fix FILE truename hacking to substring
Roland McGrath <roland@gnu.org>
parents:
4068
diff
changeset
|
141 (string= dir-truename (substring source-truename 0 len))) |
410395998370
(generate-file-autoloads): Fix FILE truename hacking to substring
Roland McGrath <roland@gnu.org>
parents:
4068
diff
changeset
|
142 (setq file (substring source-truename len)))) |
727 | 143 |
473 | 144 (message "Generating autoloads for %s..." file) |
1975
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
145 (save-excursion |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
146 (unwind-protect |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
147 (progn |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
148 (set-buffer (find-file-noselect file)) |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
149 (save-excursion |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
150 (save-restriction |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
151 (widen) |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
152 (goto-char (point-min)) |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
153 (while (not (eobp)) |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
154 (skip-chars-forward " \t\n\f") |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
155 (cond |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
156 ((looking-at (regexp-quote generate-autoload-cookie)) |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
157 (search-forward generate-autoload-cookie) |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
158 (skip-chars-forward " \t") |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
159 (setq done-any t) |
5854
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
160 (if (eolp) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
161 ;; Read the next form and make an autoload. |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
162 (let* ((form (prog1 (read (current-buffer)) |
6280
54968237a1ac
(generate-file-autoloads): Don't ignore the line
Richard M. Stallman <rms@gnu.org>
parents:
6184
diff
changeset
|
163 (or (bolp) (forward-line 1)))) |
5854
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
164 (autoload (make-autoload form load-name)) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
165 (doc-string-elt (get (car-safe form) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
166 'doc-string-elt))) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
167 (if autoload |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
168 (setq autoloads-done (cons (nth 1 form) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
169 autoloads-done)) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
170 (setq autoload form)) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
171 (if (and doc-string-elt |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
172 (stringp (nth doc-string-elt autoload))) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
173 ;; We need to hack the printing because the |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
174 ;; doc-string must be printed specially for |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
175 ;; make-docfile (sigh). |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
176 (let* ((p (nthcdr (1- doc-string-elt) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
177 autoload)) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
178 (elt (cdr p))) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
179 (setcdr p nil) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
180 (princ "\n(" outbuf) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
181 (let ((print-escape-newlines t)) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
182 (mapcar (function (lambda (elt) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
183 (prin1 elt outbuf) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
184 (princ " " outbuf))) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
185 autoload)) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
186 (princ "\"\\\n" outbuf) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
187 (let ((begin (save-excursion |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
188 (set-buffer outbuf) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
189 (point)))) |
1975
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
190 (princ (substring |
5837
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
191 (prin1-to-string (car elt)) 1) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
192 outbuf) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
193 ;; Insert a backslash before each ( that |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
194 ;; appears at the beginning of a line in |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
195 ;; the doc string. |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
196 (save-excursion |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
197 (set-buffer outbuf) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
198 (save-excursion |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
199 (while (search-backward "\n(" begin t) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
200 (forward-char 1) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
201 (insert "\\")))) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
202 (if (null (cdr elt)) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
203 (princ ")" outbuf) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
204 (princ " " outbuf) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
205 (princ (substring |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
206 (prin1-to-string (cdr elt)) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
207 1) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
208 outbuf)) |
5854
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
209 (terpri outbuf))) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
210 (let ((print-escape-newlines t)) |
6184
f18b10850c00
(generate-file-autoloads): Move misplaced paren in match clause of cond
Roland McGrath <roland@gnu.org>
parents:
5854
diff
changeset
|
211 (print autoload outbuf)))) |
5854
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
212 ;; Copy the rest of the line to the output. |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
213 (let ((begin (point))) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
214 (forward-line 1) |
6184
f18b10850c00
(generate-file-autoloads): Move misplaced paren in match clause of cond
Roland McGrath <roland@gnu.org>
parents:
5854
diff
changeset
|
215 (princ (buffer-substring begin (point)) outbuf)))) |
5837
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
216 ((looking-at ";") |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
217 ;; Don't read the comment. |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
218 (forward-line 1)) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
219 (t |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
220 (forward-sexp 1) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
221 (forward-line 1))))))) |
1975
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
222 (or visited |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
223 ;; We created this buffer, so we should kill it. |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
224 (kill-buffer (current-buffer))) |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
225 (set-buffer outbuf) |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
226 (setq output-end (point-marker)))) |
473 | 227 (if done-any |
228 (progn | |
229 (insert generate-autoload-section-header) | |
5837
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
230 (prin1 (list 'autoloads autoloads-done load-name |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
231 (autoload-trim-file-name file) |
473 | 232 (nth 5 (file-attributes file))) |
233 outbuf) | |
234 (terpri outbuf) | |
5837
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
235 (insert ";;; Generated autoloads from " |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
236 (autoload-trim-file-name file) "\n") |
8864
65731429a2c1
(generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents:
7942
diff
changeset
|
237 ;; Warn if we put a line in loaddefs.el |
65731429a2c1
(generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents:
7942
diff
changeset
|
238 ;; that is long enough to cause trouble. |
65731429a2c1
(generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents:
7942
diff
changeset
|
239 (while (< (point) output-end) |
65731429a2c1
(generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents:
7942
diff
changeset
|
240 (let ((beg (point))) |
65731429a2c1
(generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents:
7942
diff
changeset
|
241 (end-of-line) |
65731429a2c1
(generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents:
7942
diff
changeset
|
242 (if (> (- (point) beg) 900) |
65731429a2c1
(generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents:
7942
diff
changeset
|
243 (progn |
65731429a2c1
(generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents:
7942
diff
changeset
|
244 (message "A line is too long--over 900 characters") |
65731429a2c1
(generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents:
7942
diff
changeset
|
245 (sleep-for 2) |
65731429a2c1
(generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents:
7942
diff
changeset
|
246 (goto-char output-end)))) |
65731429a2c1
(generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents:
7942
diff
changeset
|
247 (forward-line 1)) |
473 | 248 (goto-char output-end) |
249 (insert generate-autoload-section-trailer))) | |
250 (message "Generating autoloads for %s...done" file))) | |
2535
86d5500624d5
(update-file-autoloads, update-directory-autoloads): If called
Roland McGrath <roland@gnu.org>
parents:
2494
diff
changeset
|
251 |
473 | 252 (defconst generated-autoload-file "loaddefs.el" |
253 "*File \\[update-file-autoloads] puts autoloads into. | |
254 A .el file can set this in its local variables section to make its | |
255 autoloads go somewhere else.") | |
256 | |
257 ;;;###autoload | |
258 (defun update-file-autoloads (file) | |
259 "Update the autoloads for FILE in `generated-autoload-file' | |
260 \(which FILE might bind in its local variables)." | |
261 (interactive "fUpdate autoloads for file: ") | |
262 (let ((load-name (let ((name (file-name-nondirectory file))) | |
263 (if (string-match "\\.elc?$" name) | |
264 (substring name 0 (match-beginning 0)) | |
265 name))) | |
5815
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
266 (found nil) |
473 | 267 (existing-buffer (get-file-buffer file))) |
268 (save-excursion | |
269 ;; We want to get a value for generated-autoload-file from | |
270 ;; the local variables section if it's there. | |
271 (set-buffer (find-file-noselect file)) | |
272 (set-buffer (find-file-noselect generated-autoload-file)) | |
273 (save-excursion | |
274 (save-restriction | |
275 (widen) | |
276 (goto-char (point-min)) | |
5815
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
277 ;; Look for the section for LOAD-NAME. |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
278 (while (and (not found) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
279 (search-forward generate-autoload-section-header nil t)) |
473 | 280 (let ((form (condition-case () |
281 (read (current-buffer)) | |
282 (end-of-file nil)))) | |
5815
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
283 (cond ((string= (nth 2 form) load-name) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
284 ;; We found the section for this file. |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
285 ;; Check if it is up to date. |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
286 (let ((begin (match-beginning 0)) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
287 (last-time (nth 4 form)) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
288 (file-time (nth 5 (file-attributes file)))) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
289 (if (and (or (null existing-buffer) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
290 (not (buffer-modified-p existing-buffer))) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
291 (listp last-time) (= (length last-time) 2) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
292 (or (> (car last-time) (car file-time)) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
293 (and (= (car last-time) (car file-time)) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
294 (>= (nth 1 last-time) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
295 (nth 1 file-time))))) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
296 (progn |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
297 (message "Autoload section for %s is up to date." |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
298 file) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
299 (setq found 'up-to-date)) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
300 (search-forward generate-autoload-section-trailer) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
301 (delete-region begin (point)) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
302 (setq found t)))) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
303 ((string< load-name (nth 2 form)) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
304 ;; We've come to a section alphabetically later than |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
305 ;; LOAD-NAME. We assume the file is in order and so |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
306 ;; there must be no section for LOAD-NAME. We will |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
307 ;; insert one before the section here. |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
308 (goto-char (match-beginning 0)) |
5837
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
309 (setq found 'new))))) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
310 (or (eq found 'up-to-date) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
311 (and (eq found 'new) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
312 ;; Check that FILE has any cookies before generating a |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
313 ;; new section for it. |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
314 (save-excursion |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
315 (set-buffer (find-file-noselect file)) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
316 (save-excursion |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
317 (widen) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
318 (goto-char (point-min)) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
319 (if (search-forward (concat "\n" |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
320 generate-autoload-cookie) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
321 nil t) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
322 nil |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
323 (if (interactive-p) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
324 (message file " has no autoloads")) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
325 t)))) |
7456
493a32789e7d
(update-file-autoloads): Delete leftover variable.
Karl Heuer <kwzh@gnu.org>
parents:
7437
diff
changeset
|
326 (generate-file-autoloads file)))) |
2535
86d5500624d5
(update-file-autoloads, update-directory-autoloads): If called
Roland McGrath <roland@gnu.org>
parents:
2494
diff
changeset
|
327 (if (interactive-p) (save-buffer)) |
473 | 328 (if (and (null existing-buffer) |
329 (setq existing-buffer (get-file-buffer file))) | |
330 (kill-buffer existing-buffer))))) | |
331 | |
332 ;;;###autoload | |
333 (defun update-autoloads-here () | |
3774
3b0cb275ca29
(generate-autoload-cookie, update-autoloads-here): Doc fixes.
Roland McGrath <roland@gnu.org>
parents:
2535
diff
changeset
|
334 "\ |
3b0cb275ca29
(generate-autoload-cookie, update-autoloads-here): Doc fixes.
Roland McGrath <roland@gnu.org>
parents:
2535
diff
changeset
|
335 Update sections of the current buffer generated by \\[update-file-autoloads]." |
473 | 336 (interactive) |
337 (let ((generated-autoload-file (buffer-file-name))) | |
338 (save-excursion | |
339 (goto-char (point-min)) | |
340 (while (search-forward generate-autoload-section-header nil t) | |
341 (let* ((form (condition-case () | |
342 (read (current-buffer)) | |
343 (end-of-file nil))) | |
344 (file (nth 3 form))) | |
345 (if (and (stringp file) | |
346 (or (get-file-buffer file) | |
347 (file-exists-p file))) | |
348 () | |
7477
a01cc9d6398d
(autoload-trim-file-name): Make it relative
Richard M. Stallman <rms@gnu.org>
parents:
7472
diff
changeset
|
349 (setq file (if (y-or-n-p (format "Can't find library `%s'; remove its autoloads? " |
a01cc9d6398d
(autoload-trim-file-name): Make it relative
Richard M. Stallman <rms@gnu.org>
parents:
7472
diff
changeset
|
350 (nth 2 form) file)) |
473 | 351 t |
352 (condition-case () | |
7477
a01cc9d6398d
(autoload-trim-file-name): Make it relative
Richard M. Stallman <rms@gnu.org>
parents:
7472
diff
changeset
|
353 (read-file-name (format "Find `%s' load file: " |
473 | 354 (nth 2 form)) |
355 nil nil t) | |
356 (quit nil))))) | |
357 (if file | |
358 (let ((begin (match-beginning 0))) | |
359 (search-forward generate-autoload-section-trailer) | |
360 (delete-region begin (point)))) | |
361 (if (stringp file) | |
362 (generate-file-autoloads file))))))) | |
363 | |
364 ;;;###autoload | |
365 (defun update-directory-autoloads (dir) | |
366 "Run \\[update-file-autoloads] on each .el file in DIR." | |
367 (interactive "DUpdate autoloads for directory: ") | |
7354
0611d70ad480
(update-directory-autoloads): Ignore files
Richard M. Stallman <rms@gnu.org>
parents:
6280
diff
changeset
|
368 (let ((enable-local-eval nil)) |
0611d70ad480
(update-directory-autoloads): Ignore files
Richard M. Stallman <rms@gnu.org>
parents:
6280
diff
changeset
|
369 (mapcar 'update-file-autoloads |
0611d70ad480
(update-directory-autoloads): Ignore files
Richard M. Stallman <rms@gnu.org>
parents:
6280
diff
changeset
|
370 (directory-files dir t "^[^=].*\\.el$"))) |
2535
86d5500624d5
(update-file-autoloads, update-directory-autoloads): If called
Roland McGrath <roland@gnu.org>
parents:
2494
diff
changeset
|
371 (if (interactive-p) |
86d5500624d5
(update-file-autoloads, update-directory-autoloads): If called
Roland McGrath <roland@gnu.org>
parents:
2494
diff
changeset
|
372 (save-excursion |
86d5500624d5
(update-file-autoloads, update-directory-autoloads): If called
Roland McGrath <roland@gnu.org>
parents:
2494
diff
changeset
|
373 (set-buffer (find-file-noselect generated-autoload-file)) |
86d5500624d5
(update-file-autoloads, update-directory-autoloads): If called
Roland McGrath <roland@gnu.org>
parents:
2494
diff
changeset
|
374 (save-buffer)))) |
473 | 375 |
376 ;;;###autoload | |
377 (defun batch-update-autoloads () | |
378 "Update the autoloads for the files or directories on the command line. | |
379 Runs \\[update-file-autoloads] on files and \\[update-directory-autoloads] | |
380 on directories. Must be used only with -batch, and kills Emacs on completion. | |
381 Each file will be processed even if an error occurred previously. | |
7477
a01cc9d6398d
(autoload-trim-file-name): Make it relative
Richard M. Stallman <rms@gnu.org>
parents:
7472
diff
changeset
|
382 For example, invoke `emacs -batch -f batch-update-autoloads *.el'." |
473 | 383 (if (not noninteractive) |
4012 | 384 (error "batch-update-autoloads is to be used only with -batch")) |
473 | 385 (let ((lost nil) |
5837
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
386 (args command-line-args-left) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
387 (enable-local-eval nil)) ;Don't query in batch mode. |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
388 (message "Updating autoloads in %s..." generated-autoload-file) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
389 (let ((frob (function |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
390 (lambda (file) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
391 (condition-case lossage |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
392 (update-file-autoloads file) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
393 (error |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
394 (princ ">>Error processing ") |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
395 (princ file) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
396 (princ ": ") |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
397 (if (fboundp 'display-error) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
398 (display-error lossage nil) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
399 (prin1 lossage)) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
400 (princ "\n") |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
401 (setq lost t))))))) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
402 (while args |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
403 (if (file-directory-p (expand-file-name (car args))) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
404 (let ((rest (directory-files (car args) t "\\.el$"))) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
405 (while rest |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
406 (funcall frob (car rest)) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
407 (setq rest (cdr rest)))) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
408 (funcall frob (car args))) |
5843
d01185037467
(batch-update-autoloads): Add missing close paren.
Karl Heuer <kwzh@gnu.org>
parents:
5837
diff
changeset
|
409 (setq args (cdr args)))) |
473 | 410 (save-some-buffers t) |
411 (message "Done") | |
412 (kill-emacs (if lost 1 0)))) | |
413 | |
414 (provide 'autoload) | |
648 | 415 |
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
648
diff
changeset
|
416 ;;; autoload.el ends here |