annotate lisp/emacs-lisp/autoload.el @ 18476:b1a322f1666d

(facemenu-add-new-face): Fix comma in backquote.
author Richard M. Stallman <rms@gnu.org>
date Fri, 27 Jun 1997 22:31:00 +0000
parents 6e7bb77cd7e1
children 65f371a2cf00
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
16995
22c9b578e220 (update-autoloads-from-directory): Get absolute file names from
Roland McGrath <roland@gnu.org>
parents: 16158
diff changeset
3 ;; Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
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
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
8 ;; This file is part of GNU Emacs.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
9
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
13 ;; any later version.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
14
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
18 ;; GNU General Public License for more details.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
19
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
20 ;; You should have received a copy of the GNU General Public License
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
23 ;; Boston, MA 02111-1307, USA.
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24
7942
bc5dccc5375f Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 7477
diff changeset
25 ;;; Commentary:
2307
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2247
diff changeset
26
7437
d9b4098cebb7 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 7354
diff changeset
27 ;; 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
28 ;; 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
29 ;; 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
30 ;; 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
31
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 732
diff changeset
32 ;;; Code:
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 732
diff changeset
33
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 (defun make-autoload (form file)
17750
f11a3a49088c (defcustom): Add doc-string-elt property.
Richard M. Stallman <rms@gnu.org>
parents: 17591
diff changeset
35 "Turn FORM into an autoload or defvar for source file FILE.
f11a3a49088c (defcustom): Add doc-string-elt property.
Richard M. Stallman <rms@gnu.org>
parents: 17591
diff changeset
36 Returns nil if FORM is not a defun, define-skeleton, defmacro or defcustom."
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37 (let ((car (car-safe form)))
12500
6aba36eda051 (make-autoload): Generate `(autoload ...)' form for
Karl Heuer <kwzh@gnu.org>
parents: 8864
diff changeset
38 (if (memq car '(defun define-skeleton defmacro))
3777
d6f56b9586f7 (make-autoload): Use memq once instead eq twice.
Roland McGrath <roland@gnu.org>
parents: 3774
diff changeset
39 (let ((macrop (eq car 'defmacro))
d6f56b9586f7 (make-autoload): Use memq once instead eq twice.
Roland McGrath <roland@gnu.org>
parents: 3774
diff changeset
40 name doc)
12500
6aba36eda051 (make-autoload): Generate `(autoload ...)' form for
Karl Heuer <kwzh@gnu.org>
parents: 8864
diff changeset
41 (setq form (cdr form)
6aba36eda051 (make-autoload): Generate `(autoload ...)' form for
Karl Heuer <kwzh@gnu.org>
parents: 8864
diff changeset
42 name (car form)
6aba36eda051 (make-autoload): Generate `(autoload ...)' form for
Karl Heuer <kwzh@gnu.org>
parents: 8864
diff changeset
43 ;; Ignore the arguments.
6aba36eda051 (make-autoload): Generate `(autoload ...)' form for
Karl Heuer <kwzh@gnu.org>
parents: 8864
diff changeset
44 form (cdr (if (eq car 'define-skeleton)
6aba36eda051 (make-autoload): Generate `(autoload ...)' form for
Karl Heuer <kwzh@gnu.org>
parents: 8864
diff changeset
45 form
6aba36eda051 (make-autoload): Generate `(autoload ...)' form for
Karl Heuer <kwzh@gnu.org>
parents: 8864
diff changeset
46 (cdr form)))
6aba36eda051 (make-autoload): Generate `(autoload ...)' form for
Karl Heuer <kwzh@gnu.org>
parents: 8864
diff changeset
47 doc (car form))
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
48 (if (stringp doc)
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49 (setq form (cdr form))
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50 (setq doc nil))
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51 (list 'autoload (list 'quote name) file doc
12500
6aba36eda051 (make-autoload): Generate `(autoload ...)' form for
Karl Heuer <kwzh@gnu.org>
parents: 8864
diff changeset
52 (or (eq car 'define-skeleton)
6aba36eda051 (make-autoload): Generate `(autoload ...)' form for
Karl Heuer <kwzh@gnu.org>
parents: 8864
diff changeset
53 (eq (car-safe (car form)) 'interactive))
1552
f2901040a07b * autoload.el (make-autoload): When creating an autoload
Jim Blandy <jimb@redhat.com>
parents: 1108
diff changeset
54 (if macrop (list 'quote 'macro) nil)))
17750
f11a3a49088c (defcustom): Add doc-string-elt property.
Richard M. Stallman <rms@gnu.org>
parents: 17591
diff changeset
55 (if (eq car 'defcustom)
f11a3a49088c (defcustom): Add doc-string-elt property.
Richard M. Stallman <rms@gnu.org>
parents: 17591
diff changeset
56 (let ((varname (car-safe (cdr-safe form)))
f11a3a49088c (defcustom): Add doc-string-elt property.
Richard M. Stallman <rms@gnu.org>
parents: 17591
diff changeset
57 (init (car-safe (cdr-safe (cdr-safe form))))
f11a3a49088c (defcustom): Add doc-string-elt property.
Richard M. Stallman <rms@gnu.org>
parents: 17591
diff changeset
58 (doc (car-safe (cdr-safe (cdr-safe (cdr-safe form))))))
f11a3a49088c (defcustom): Add doc-string-elt property.
Richard M. Stallman <rms@gnu.org>
parents: 17591
diff changeset
59 (list 'defvar varname init doc))
f11a3a49088c (defcustom): Add doc-string-elt property.
Richard M. Stallman <rms@gnu.org>
parents: 17591
diff changeset
60 nil))))
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61
12500
6aba36eda051 (make-autoload): Generate `(autoload ...)' form for
Karl Heuer <kwzh@gnu.org>
parents: 8864
diff changeset
62 (put 'define-skeleton 'doc-string-elt 3)
6aba36eda051 (make-autoload): Generate `(autoload ...)' form for
Karl Heuer <kwzh@gnu.org>
parents: 8864
diff changeset
63
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64 (defconst generate-autoload-cookie ";;;###autoload"
3774
3b0cb275ca29 (generate-autoload-cookie, update-autoloads-here): Doc fixes.
Roland McGrath <roland@gnu.org>
parents: 2535
diff changeset
65 "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
66 Used by \\[update-file-autoloads]. This string should be
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67 meaningless to Lisp (e.g., a comment).
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69 This string is used:
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 ;;;###autoload
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 \(defun function-to-be-autoloaded () ...)
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74 If this string appears alone on a line, the following form will be
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 read and an autoload made for it. If there is further text on the line,
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76 that text will be copied verbatim to `generated-autoload-file'.")
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78 (defconst generate-autoload-section-header "\f\n;;;### "
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79 "String inserted before the form identifying
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80 the section of autoloads for a file.")
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82 (defconst generate-autoload-section-trailer "\n;;;***\n"
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83 "String which indicates the end of the section of autoloads for a file.")
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84
727
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
85 ;;; Forms which have doc-strings which should be printed specially.
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
86 ;;; A doc-string-elt property of ELT says that (nth ELT FORM) is
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
87 ;;; the doc-string in FORM.
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
88 ;;;
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
89 ;;; There used to be the following note here:
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
90 ;;; ;;; Note: defconst and defvar should NOT be marked in this way.
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
91 ;;; ;;; We don't want to produce defconsts and defvars that
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
92 ;;; ;;; make-docfile can grok, because then it would grok them twice,
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
93 ;;; ;;; once in foo.el (where they are given with ;;;###autoload) and
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
94 ;;; ;;; once in loaddefs.el.
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
95 ;;;
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
96 ;;; Counter-note: Yes, they should be marked in this way.
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
97 ;;; make-docfile only processes those files that are loaded into the
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
98 ;;; dumped Emacs, and those files should never have anything
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
99 ;;; autoloaded here. The above-feared problem only occurs with files
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
100 ;;; which have autoloaded entries *and* are processed by make-docfile;
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
101 ;;; there should be no such files.
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
102
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
103 (put 'autoload 'doc-string-elt 3)
727
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
104 (put 'defun 'doc-string-elt 3)
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
105 (put 'defvar 'doc-string-elt 3)
17750
f11a3a49088c (defcustom): Add doc-string-elt property.
Richard M. Stallman <rms@gnu.org>
parents: 17591
diff changeset
106 (put 'defcustom 'doc-string-elt 3)
727
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
107 (put 'defconst 'doc-string-elt 3)
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
108 (put 'defmacro 'doc-string-elt 3)
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
109
5837
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
110 (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
111 ;; Returns a relative pathname of FILE
a01cc9d6398d (autoload-trim-file-name): Make it relative
Richard M. Stallman <rms@gnu.org>
parents: 7472
diff changeset
112 ;; 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
113 ;; 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
114 ;; 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
115 ;; 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
116 (setq file (expand-file-name file))
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
117 (file-relative-name file
7477
a01cc9d6398d (autoload-trim-file-name): Make it relative
Richard M. Stallman <rms@gnu.org>
parents: 7472
diff changeset
118 (file-name-directory generated-autoload-file)))
5837
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
119
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
120 (defun generate-file-autoloads (file)
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121 "Insert at point a loaddefs autoload section for FILE.
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
122 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
123 marked by `generate-autoload-cookie' (which see).
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
124 If FILE is being visited in a buffer, the contents of the buffer
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
125 are used."
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126 (interactive "fGenerate autoloads for file: ")
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127 (let ((outbuf (current-buffer))
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128 (autoloads-done '())
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129 (load-name (let ((name (file-name-nondirectory file)))
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
130 (if (string-match "\\.elc?$" name)
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
131 (substring name 0 (match-beginning 0))
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
132 name)))
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
133 (print-length nil)
5837
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
134 (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
135 (float-output-format nil)
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
136 (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
137 (visited (get-file-buffer file))
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
138 output-end)
727
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
139
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
140 ;; If the autoload section we create here uses an absolute
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
141 ;; pathname for FILE in its header, and then Emacs is installed
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
142 ;; under a different path on another system,
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
143 ;; `update-autoloads-here' won't be able to find the files to be
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
144 ;; autoloaded. So, if FILE is in the same directory or a
732
a8d94735277e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 727
diff changeset
145 ;; subdirectory of the current buffer's directory, we'll make it
727
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
146 ;; relative to the current buffer's directory.
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
147 (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
148 (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
149 (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
150 (file-truename default-directory)))
410395998370 (generate-file-autoloads): Fix FILE truename hacking to substring
Roland McGrath <roland@gnu.org>
parents: 4068
diff changeset
151 (len (length dir-truename)))
410395998370 (generate-file-autoloads): Fix FILE truename hacking to substring
Roland McGrath <roland@gnu.org>
parents: 4068
diff changeset
152 (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
153 (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
154 (setq file (substring source-truename len))))
727
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
155
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
156 (message "Generating autoloads for %s..." file)
1975
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
157 (save-excursion
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
158 (unwind-protect
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
159 (progn
13730
87eb8f956a00 (generate-file-autoloads): If no buffer visiting FILE exists, read it into
Roland McGrath <roland@gnu.org>
parents: 12500
diff changeset
160 (if visited
87eb8f956a00 (generate-file-autoloads): If no buffer visiting FILE exists, read it into
Roland McGrath <roland@gnu.org>
parents: 12500
diff changeset
161 (set-buffer visited)
87eb8f956a00 (generate-file-autoloads): If no buffer visiting FILE exists, read it into
Roland McGrath <roland@gnu.org>
parents: 12500
diff changeset
162 ;; It is faster to avoid visiting the file.
87eb8f956a00 (generate-file-autoloads): If no buffer visiting FILE exists, read it into
Roland McGrath <roland@gnu.org>
parents: 12500
diff changeset
163 (set-buffer (get-buffer-create " *generate-autoload-file*"))
87eb8f956a00 (generate-file-autoloads): If no buffer visiting FILE exists, read it into
Roland McGrath <roland@gnu.org>
parents: 12500
diff changeset
164 (kill-all-local-variables)
87eb8f956a00 (generate-file-autoloads): If no buffer visiting FILE exists, read it into
Roland McGrath <roland@gnu.org>
parents: 12500
diff changeset
165 (erase-buffer)
14043
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
166 (setq buffer-undo-list t
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
167 buffer-read-only nil)
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
168 (emacs-lisp-mode)
13730
87eb8f956a00 (generate-file-autoloads): If no buffer visiting FILE exists, read it into
Roland McGrath <roland@gnu.org>
parents: 12500
diff changeset
169 (insert-file-contents file nil))
1975
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
170 (save-excursion
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
171 (save-restriction
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
172 (widen)
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
173 (goto-char (point-min))
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
174 (while (not (eobp))
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
175 (skip-chars-forward " \t\n\f")
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
176 (cond
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
177 ((looking-at (regexp-quote generate-autoload-cookie))
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
178 (search-forward generate-autoload-cookie)
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
179 (skip-chars-forward " \t")
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
180 (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
181 (if (eolp)
9d1ae808403b (generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents: 5843
diff changeset
182 ;; 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
183 (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
184 (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
185 (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
186 (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
187 '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
188 (if autoload
9d1ae808403b (generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents: 5843
diff changeset
189 (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
190 autoloads-done))
9d1ae808403b (generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents: 5843
diff changeset
191 (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
192 (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
193 (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
194 ;; 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
195 ;; 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
196 ;; 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
197 (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
198 autoload))
9d1ae808403b (generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents: 5843
diff changeset
199 (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
200 (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
201 (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
202 (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
203 (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
204 (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
205 (princ " " outbuf)))
9d1ae808403b (generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents: 5843
diff changeset
206 autoload))
9d1ae808403b (generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents: 5843
diff changeset
207 (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
208 (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
209 (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
210 (point))))
1975
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
211 (princ (substring
5837
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
212 (prin1-to-string (car elt)) 1)
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
213 outbuf)
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
214 ;; Insert a backslash before each ( that
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
215 ;; appears at the beginning of a line in
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
216 ;; the doc string.
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
217 (save-excursion
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
218 (set-buffer outbuf)
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
219 (save-excursion
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
220 (while (search-backward "\n(" begin t)
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
221 (forward-char 1)
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
222 (insert "\\"))))
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
223 (if (null (cdr elt))
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
224 (princ ")" outbuf)
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
225 (princ " " outbuf)
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
226 (princ (substring
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
227 (prin1-to-string (cdr elt))
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
228 1)
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
229 outbuf))
5854
9d1ae808403b (generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents: 5843
diff changeset
230 (terpri outbuf)))
9d1ae808403b (generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents: 5843
diff changeset
231 (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
232 (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
233 ;; Copy the rest of the line to the output.
13937
35c457f8bedf (generate-file-autoloads): Preserve whitespace after cookie in literal text
Roland McGrath <roland@gnu.org>
parents: 13730
diff changeset
234 (princ (buffer-substring
35c457f8bedf (generate-file-autoloads): Preserve whitespace after cookie in literal text
Roland McGrath <roland@gnu.org>
parents: 13730
diff changeset
235 (progn
35c457f8bedf (generate-file-autoloads): Preserve whitespace after cookie in literal text
Roland McGrath <roland@gnu.org>
parents: 13730
diff changeset
236 ;; Back up over whitespace, to preserve it.
35c457f8bedf (generate-file-autoloads): Preserve whitespace after cookie in literal text
Roland McGrath <roland@gnu.org>
parents: 13730
diff changeset
237 (skip-chars-backward " \f\t")
35c457f8bedf (generate-file-autoloads): Preserve whitespace after cookie in literal text
Roland McGrath <roland@gnu.org>
parents: 13730
diff changeset
238 (if (= (char-after (1+ (point))) ? )
35c457f8bedf (generate-file-autoloads): Preserve whitespace after cookie in literal text
Roland McGrath <roland@gnu.org>
parents: 13730
diff changeset
239 ;; Eat one space.
35c457f8bedf (generate-file-autoloads): Preserve whitespace after cookie in literal text
Roland McGrath <roland@gnu.org>
parents: 13730
diff changeset
240 (forward-char 1))
35c457f8bedf (generate-file-autoloads): Preserve whitespace after cookie in literal text
Roland McGrath <roland@gnu.org>
parents: 13730
diff changeset
241 (point))
35c457f8bedf (generate-file-autoloads): Preserve whitespace after cookie in literal text
Roland McGrath <roland@gnu.org>
parents: 13730
diff changeset
242 (progn (forward-line 1) (point)))
35c457f8bedf (generate-file-autoloads): Preserve whitespace after cookie in literal text
Roland McGrath <roland@gnu.org>
parents: 13730
diff changeset
243 outbuf)))
5837
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
244 ((looking-at ";")
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
245 ;; Don't read the comment.
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
246 (forward-line 1))
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
247 (t
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
248 (forward-sexp 1)
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
249 (forward-line 1)))))))
1975
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
250 (or visited
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
251 ;; 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
252 (kill-buffer (current-buffer)))
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
253 (set-buffer outbuf)
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
254 (setq output-end (point-marker))))
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
255 (if done-any
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
256 (progn
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
257 (insert generate-autoload-section-header)
5837
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
258 (prin1 (list 'autoloads autoloads-done load-name
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
259 (autoload-trim-file-name file)
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
260 (nth 5 (file-attributes file)))
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
261 outbuf)
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
262 (terpri outbuf)
5837
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
263 (insert ";;; Generated autoloads from "
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
264 (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
265 ;; 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
266 ;; 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
267 (while (< (point) output-end)
65731429a2c1 (generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents: 7942
diff changeset
268 (let ((beg (point)))
65731429a2c1 (generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents: 7942
diff changeset
269 (end-of-line)
65731429a2c1 (generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents: 7942
diff changeset
270 (if (> (- (point) beg) 900)
65731429a2c1 (generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents: 7942
diff changeset
271 (progn
65731429a2c1 (generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents: 7942
diff changeset
272 (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
273 (sleep-for 2)
65731429a2c1 (generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents: 7942
diff changeset
274 (goto-char output-end))))
65731429a2c1 (generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents: 7942
diff changeset
275 (forward-line 1))
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
276 (goto-char output-end)
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
277 (insert generate-autoload-section-trailer)))
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
278 (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
279
17591
b2c8fb8139c8 (generated-autoload-file): Change defconst to defvar.
Richard M. Stallman <rms@gnu.org>
parents: 17001
diff changeset
280 (defvar generated-autoload-file "loaddefs.el"
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
281 "*File \\[update-file-autoloads] puts autoloads into.
17591
b2c8fb8139c8 (generated-autoload-file): Change defconst to defvar.
Richard M. Stallman <rms@gnu.org>
parents: 17001
diff changeset
282 A `.el' file can set this in its local variables section to make its
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
283 autoloads go somewhere else.")
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
284
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
285 ;;;###autoload
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
286 (defun update-file-autoloads (file)
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
287 "Update the autoloads for FILE in `generated-autoload-file'
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
288 \(which FILE might bind in its local variables)."
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
289 (interactive "fUpdate autoloads for file: ")
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
290 (let ((load-name (let ((name (file-name-nondirectory file)))
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
291 (if (string-match "\\.elc?$" name)
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
292 (substring name 0 (match-beginning 0))
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
293 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
294 (found nil)
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
295 (existing-buffer (get-file-buffer file)))
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
296 (save-excursion
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
297 ;; We want to get a value for generated-autoload-file from
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
298 ;; the local variables section if it's there.
14043
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
299 (if existing-buffer
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
300 (set-buffer existing-buffer))
17001
ce8565274e49 (update-file-autoloads): Read loaddefs.el without
Karl Heuer <kwzh@gnu.org>
parents: 16995
diff changeset
301 ;; We must read/write the file without any code conversion.
ce8565274e49 (update-file-autoloads): Read loaddefs.el without
Karl Heuer <kwzh@gnu.org>
parents: 16995
diff changeset
302 (let ((coding-system-for-read 'no-conversion))
ce8565274e49 (update-file-autoloads): Read loaddefs.el without
Karl Heuer <kwzh@gnu.org>
parents: 16995
diff changeset
303 (set-buffer (find-file-noselect generated-autoload-file)))
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
304 (save-excursion
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
305 (save-restriction
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
306 (widen)
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
307 (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
308 ;; 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
309 (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
310 (search-forward generate-autoload-section-header nil t))
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
311 (let ((form (condition-case ()
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
312 (read (current-buffer))
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
313 (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
314 (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
315 ;; 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
316 ;; 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
317 (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
318 (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
319 (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
320 (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
321 (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
322 (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
323 (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
324 (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
325 (>= (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
326 (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
327 (progn
14252
7ef2eabb1a9c (update-file-autoloads): Only give "up to date" msg if (interactive-p).
Roland McGrath <roland@gnu.org>
parents: 14192
diff changeset
328 (if (interactive-p)
7ef2eabb1a9c (update-file-autoloads): Only give "up to date" msg if (interactive-p).
Roland McGrath <roland@gnu.org>
parents: 14192
diff changeset
329 (message "\
7ef2eabb1a9c (update-file-autoloads): Only give "up to date" msg if (interactive-p).
Roland McGrath <roland@gnu.org>
parents: 14192
diff changeset
330 Autoload section for %s is up to date."
7ef2eabb1a9c (update-file-autoloads): Only give "up to date" msg if (interactive-p).
Roland McGrath <roland@gnu.org>
parents: 14192
diff changeset
331 file))
5815
b1e5e6efed1d (update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents: 4555
diff changeset
332 (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
333 (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
334 (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
335 (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
336 ((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
337 ;; 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
338 ;; 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
339 ;; 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
340 ;; 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
341 (goto-char (match-beginning 0))
5837
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
342 (setq found 'new)))))
14044
1c331f9332ae (update-file-autoloads): Fix placement of new sections.
Roland McGrath <roland@gnu.org>
parents: 14043
diff changeset
343 (or found
1c331f9332ae (update-file-autoloads): Fix placement of new sections.
Roland McGrath <roland@gnu.org>
parents: 14043
diff changeset
344 (progn
1c331f9332ae (update-file-autoloads): Fix placement of new sections.
Roland McGrath <roland@gnu.org>
parents: 14043
diff changeset
345 (setq found 'new)
1c331f9332ae (update-file-autoloads): Fix placement of new sections.
Roland McGrath <roland@gnu.org>
parents: 14043
diff changeset
346 ;; No later sections in the file. Put before the last page.
1c331f9332ae (update-file-autoloads): Fix placement of new sections.
Roland McGrath <roland@gnu.org>
parents: 14043
diff changeset
347 (goto-char (point-max))
16158
af6ef293cb42 (update-file-autoloads): Don't barf if autoloads file
Richard M. Stallman <rms@gnu.org>
parents: 14252
diff changeset
348 (search-backward "\f" nil t)))
5837
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
349 (or (eq found 'up-to-date)
14044
1c331f9332ae (update-file-autoloads): Fix placement of new sections.
Roland McGrath <roland@gnu.org>
parents: 14043
diff changeset
350 (and (eq found 'new)
5837
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
351 ;; 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
352 ;; new section for it.
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
353 (save-excursion
14043
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
354 (if existing-buffer
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
355 (set-buffer existing-buffer)
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
356 ;; It is faster to avoid visiting the file.
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
357 (set-buffer (get-buffer-create " *autoload-file*"))
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
358 (kill-all-local-variables)
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
359 (erase-buffer)
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
360 (setq buffer-undo-list t
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
361 buffer-read-only nil)
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
362 (emacs-lisp-mode)
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
363 (insert-file-contents file nil))
5837
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
364 (save-excursion
14043
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
365 (save-restriction
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
366 (widen)
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
367 (goto-char (point-min))
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
368 (prog1
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
369 (if (search-forward
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
370 (concat "\n" generate-autoload-cookie)
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
371 nil t)
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
372 nil
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
373 (if (interactive-p)
14192
b1bc0f5d8cf3 (update-file-autoloads): Fix message.
Erik Naggum <erik@naggum.no>
parents: 14169
diff changeset
374 (message "%s has no autoloads" file))
14043
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
375 t)
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
376 (or existing-buffer
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
377 (kill-buffer (current-buffer))))))))
7456
493a32789e7d (update-file-autoloads): Delete leftover variable.
Karl Heuer <kwzh@gnu.org>
parents: 7437
diff changeset
378 (generate-file-autoloads file))))
14043
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
379 (if (interactive-p) (save-buffer)))))
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
380
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
381 ;;;###autoload
17851
6e7bb77cd7e1 (update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 17750
diff changeset
382 (defun update-autoloads-from-directories (&rest dirs)
3774
3b0cb275ca29 (generate-autoload-cookie, update-autoloads-here): Doc fixes.
Roland McGrath <roland@gnu.org>
parents: 2535
diff changeset
383 "\
17851
6e7bb77cd7e1 (update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 17750
diff changeset
384 Update loaddefs.el with all the current autoloads from DIRS, and no old ones.
14043
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
385 This uses `update-file-autoloads' (which see) do its work."
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
386 (interactive "DUpdate autoloads from directory: ")
17851
6e7bb77cd7e1 (update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 17750
diff changeset
387 (let ((files (apply 'nconc
6e7bb77cd7e1 (update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 17750
diff changeset
388 (mapcar (function (lambda (dir)
6e7bb77cd7e1 (update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 17750
diff changeset
389 (directory-files (expand-file-name dir)
6e7bb77cd7e1 (update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 17750
diff changeset
390 t
6e7bb77cd7e1 (update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 17750
diff changeset
391 "^[^=].*\\.el$")))
6e7bb77cd7e1 (update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 17750
diff changeset
392 dirs)))
6e7bb77cd7e1 (update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 17750
diff changeset
393 autoloads-file
6e7bb77cd7e1 (update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 17750
diff changeset
394 top-dir)
6e7bb77cd7e1 (update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 17750
diff changeset
395 (setq autoloads-file (locate-library generated-autoload-file))
6e7bb77cd7e1 (update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 17750
diff changeset
396 (setq top-dir (file-name-directory autoloads-file))
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
397 (save-excursion
17851
6e7bb77cd7e1 (update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 17750
diff changeset
398 (set-buffer (find-file-noselect autoloads-file))
2535
86d5500624d5 (update-file-autoloads, update-directory-autoloads): If called
Roland McGrath <roland@gnu.org>
parents: 2494
diff changeset
399 (save-excursion
14043
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
400 (goto-char (point-min))
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
401 (while (search-forward generate-autoload-section-header nil t)
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
402 (let* ((form (condition-case ()
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
403 (read (current-buffer))
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
404 (end-of-file nil)))
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
405 (file (nth 3 form)))
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
406 (cond ((not (stringp file)))
17851
6e7bb77cd7e1 (update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 17750
diff changeset
407 ((not (file-exists-p (expand-file-name file top-dir)))
14043
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
408 ;; Remove the obsolete section.
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
409 (let ((begin (match-beginning 0)))
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
410 (search-forward generate-autoload-section-trailer)
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
411 (delete-region begin (point))))
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
412 (t
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
413 (update-file-autoloads file)))
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
414 (setq files (delete file files)))))
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
415 ;; Elements remaining in FILES have no existing autoload sections.
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
416 (mapcar 'update-file-autoloads files)
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
417 (save-buffer))))
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
418
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
419 ;;;###autoload
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
420 (defun batch-update-autoloads ()
14043
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
421 "Update loaddefs.el autoloads in batch mode.
17851
6e7bb77cd7e1 (update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 17750
diff changeset
422 Calls `update-autoloads-from-directories' on the command line arguments."
6e7bb77cd7e1 (update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 17750
diff changeset
423 (apply 'update-autoloads-from-directories command-line-args-left)
14043
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
424 (setq command-line-args-left nil))
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
425
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
426 (provide 'autoload)
648
70b112526394 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 473
diff changeset
427
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 648
diff changeset
428 ;;; autoload.el ends here