annotate lisp/emacs-lisp/autoload.el @ 89015:024c92b51ee7

*** empty log message ***
author Kenichi Handa <handa@m17n.org>
date Mon, 19 Aug 2002 12:14:25 +0000
parents 7da18198e410
children a0d27828cf39
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38436
b174db545cfd Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 36743
diff changeset
1 ;;; autoload.el --- maintain autoloads in loaddefs.el
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 648
diff changeset
2
36743
783da1783d8b (generate-file-autoloads): Remove
Gerd Moellmann <gerd@gnu.org>
parents: 34267
diff changeset
3 ;; Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2001
783da1783d8b (generate-file-autoloads): Remove
Gerd Moellmann <gerd@gnu.org>
parents: 34267
diff changeset
4 ;; Free Software Foundation, Inc.
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
5
25278
cbe304a26771 Fix maintainer address.
Karl Heuer <kwzh@gnu.org>
parents: 24896
diff changeset
6 ;; Author: Roland McGrath <roland@gnu.org>
2247
2c7997f249eb Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1975
diff changeset
7 ;; Keywords: maint
846
20674ae6bf52 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 811
diff changeset
8
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
9 ;; This file is part of GNU Emacs.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
10
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
11 ;; 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
12 ;; 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
13 ;; 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
14 ;; any later version.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
15
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
16 ;; 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
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
19 ;; GNU General Public License for more details.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
20
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
21 ;; 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
22 ;; 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
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14044
diff changeset
24 ;; Boston, MA 02111-1307, USA.
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25
7942
bc5dccc5375f Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 7477
diff changeset
26 ;;; Commentary:
2307
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2247
diff changeset
27
7437
d9b4098cebb7 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 7354
diff changeset
28 ;; 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
29 ;; 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
30 ;; 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
31 ;; 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
32
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 732
diff changeset
33 ;;; Code:
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 732
diff changeset
34
39763
c8f0d7b4bb40 (doc-string-elt): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39560
diff changeset
35 (require 'lisp-mode) ;for `doc-string-elt' properties.
c8f0d7b4bb40 (doc-string-elt): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39560
diff changeset
36
c8f0d7b4bb40 (doc-string-elt): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39560
diff changeset
37
19170
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
38 (defvar generated-autoload-file "loaddefs.el"
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
39 "*File \\[update-file-autoloads] puts autoloads into.
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
40 A `.el' file can set this in its local variables section to make its
24896
701d2b4c7484 (generated-autoload-file): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 23092
diff changeset
41 autoloads go somewhere else. The autoload file is assumed to contain a
701d2b4c7484 (generated-autoload-file): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 23092
diff changeset
42 trailer starting with a FormFeed character.")
19170
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
43
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
44 (defconst generate-autoload-cookie ";;;###autoload"
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
45 "Magic comment indicating the following form should be autoloaded.
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
46 Used by \\[update-file-autoloads]. This string should be
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
47 meaningless to Lisp (e.g., a comment).
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
48
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
49 This string is used:
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
50
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
51 ;;;###autoload
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
52 \(defun function-to-be-autoloaded () ...)
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
53
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
54 If this string appears alone on a line, the following form will be
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
55 read and an autoload made for it. If there is further text on the line,
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
56 that text will be copied verbatim to `generated-autoload-file'.")
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
57
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
58 (defconst generate-autoload-section-header "\f\n;;;### "
21479
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
59 "String that marks the form at the start of a new file's autoload section.")
19170
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
60
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
61 (defconst generate-autoload-section-trailer "\n;;;***\n"
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
62 "String which indicates the end of the section of autoloads for a file.")
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
63
21479
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
64 (defconst generate-autoload-section-continuation ";;;;;; "
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
65 "String to add on each continuation of the section header form.")
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
66
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67 (defun make-autoload (form file)
17750
f11a3a49088c (defcustom): Add doc-string-elt property.
Richard M. Stallman <rms@gnu.org>
parents: 17591
diff changeset
68 "Turn FORM into an autoload or defvar for source file FILE.
29549
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
69 Returns nil if FORM is not a special autoload form (i.e. a function definition
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
70 or macro definition or a defcustom)."
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
71 (let ((car (car-safe form)) expand)
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
72 (cond
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
73 ;; For complex cases, try again on the macro-expansion.
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
74 ((and (memq car '(easy-mmode-define-global-mode
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
75 easy-mmode-define-minor-mode define-minor-mode))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
76 (setq expand (let ((load-file-name file)) (macroexpand form)))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
77 (eq (car expand) 'progn)
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
78 (memq :autoload-end expand))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
79 (let ((end (memq :autoload-end expand)))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
80 ;; Cut-off anything after the :autoload-end marker.
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
81 (setcdr end nil)
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
82 (cons 'progn
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
83 (mapcar (lambda (form) (make-autoload form file))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
84 (cdr expand)))))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
85
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
86 ;; For special function-like operators, use the `autoload' function.
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
87 ((memq car '(defun define-skeleton defmacro define-derived-mode
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
88 define-generic-mode easy-mmode-define-minor-mode
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
89 easy-mmode-define-global-mode
41811
0343ccd72be1 (make-autoload): Also generate autoloads for `defmacro*' forms.
Colin Walters <walters@gnu.org>
parents: 39763
diff changeset
90 define-minor-mode defun* defmacro*))
0343ccd72be1 (make-autoload): Also generate autoloads for `defmacro*' forms.
Colin Walters <walters@gnu.org>
parents: 39763
diff changeset
91 (let* ((macrop (memq car '(defmacro defmacro*)))
29549
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
92 (name (nth 1 form))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
93 (body (nthcdr (get car 'doc-string-elt) form))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
94 (doc (if (stringp (car body)) (pop body))))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
95 ;; `define-generic-mode' quotes the name, so take care of that
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
96 (list 'autoload (if (listp name) name (list 'quote name)) file doc
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
97 (or (and (memq car '(define-skeleton define-derived-mode
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
98 define-generic-mode
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
99 easy-mmode-define-global-mode
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
100 easy-mmode-define-minor-mode
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
101 define-minor-mode)) t)
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
102 (eq (car-safe (car body)) 'interactive))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
103 (if macrop (list 'quote 'macro) nil))))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
104
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
105 ;; Convert defcustom to a simpler (and less space-consuming) defvar,
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
106 ;; but add some extra stuff if it uses :require.
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
107 ((eq car 'defcustom)
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
108 (let ((varname (car-safe (cdr-safe form)))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
109 (init (car-safe (cdr-safe (cdr-safe form))))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
110 (doc (car-safe (cdr-safe (cdr-safe (cdr-safe form)))))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
111 (rest (cdr-safe (cdr-safe (cdr-safe (cdr-safe form))))))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
112 (if (not (plist-get rest :require))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
113 `(defvar ,varname ,init ,doc)
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
114 `(progn
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
115 (defvar ,varname ,init ,doc)
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
116 (custom-add-to-group ,(plist-get rest :group)
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
117 ',varname 'custom-variable)
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
118 (custom-add-load ',varname
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
119 ,(plist-get rest :require))))))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
120
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
121 ;; nil here indicates that this is not a special autoload form.
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
122 (t nil))))
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
123
727
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
124 ;;; Forms which have doc-strings which should be printed specially.
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
125 ;;; 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
126 ;;; the doc-string in FORM.
39763
c8f0d7b4bb40 (doc-string-elt): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39560
diff changeset
127 ;;; Those properties are now set in lisp-mode.el.
22247
7db7ffb27feb (make-autoload): Add support for define-derived-mode. Update the
Richard M. Stallman <rms@gnu.org>
parents: 22242
diff changeset
128
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129
5837
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
130 (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
131 ;; Returns a relative pathname of FILE
a01cc9d6398d (autoload-trim-file-name): Make it relative
Richard M. Stallman <rms@gnu.org>
parents: 7472
diff changeset
132 ;; 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
133 ;; 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
134 ;; 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
135 ;; 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
136 (setq file (expand-file-name file))
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
137 (file-relative-name file
7477
a01cc9d6398d (autoload-trim-file-name): Make it relative
Richard M. Stallman <rms@gnu.org>
parents: 7472
diff changeset
138 (file-name-directory generated-autoload-file)))
5837
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
139
21479
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
140 (defun autoload-read-section-header ()
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
141 "Read a section header form.
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
142 Since continuation lines have been marked as comments,
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
143 we must copy the text of the form and remove those comment
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
144 markers before we call `read'."
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
145 (save-match-data
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
146 (let ((beginning (point))
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
147 string)
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
148 (forward-line 1)
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
149 (while (looking-at generate-autoload-section-continuation)
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
150 (forward-line 1))
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
151 (setq string (buffer-substring beginning (point)))
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
152 (with-current-buffer (get-buffer-create " *autoload*")
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
153 (erase-buffer)
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
154 (insert string)
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
155 (goto-char (point-min))
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
156 (while (search-forward generate-autoload-section-continuation nil t)
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
157 (replace-match " "))
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
158 (goto-char (point-min))
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
159 (read (current-buffer))))))
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
160
29416
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
161 ;; !! Requires OUTBUF to be bound !!
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
162 (defun autoload-print-form (form)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
163 "Print FORM such that make-docfile will find the docstrings."
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
164 (cond
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
165 ;; If the form is a sequence, recurse.
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
166 ((eq (car form) 'progn) (mapcar 'autoload-print-form (cdr form)))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
167 ;; Symbols at the toplevel are meaningless.
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
168 ((symbolp form) nil)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
169 (t
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
170 (let ((doc-string-elt (get (car-safe form) 'doc-string-elt)))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
171 (if (and doc-string-elt (stringp (nth doc-string-elt form)))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
172 ;; We need to hack the printing because the
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
173 ;; doc-string must be printed specially for
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
174 ;; make-docfile (sigh).
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
175 (let* ((p (nthcdr (1- doc-string-elt) form))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
176 (elt (cdr p)))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
177 (setcdr p nil)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
178 (princ "\n(" outbuf)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
179 (let ((print-escape-newlines t)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
180 (print-escape-nonascii t))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
181 (mapcar (lambda (elt)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
182 (prin1 elt outbuf)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
183 (princ " " outbuf))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
184 form))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
185 (princ "\"\\\n" outbuf)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
186 (let ((begin (with-current-buffer outbuf (point))))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
187 (princ (substring (prin1-to-string (car elt)) 1)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
188 outbuf)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
189 ;; Insert a backslash before each ( that
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
190 ;; appears at the beginning of a line in
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
191 ;; the doc string.
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
192 (with-current-buffer outbuf
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
193 (save-excursion
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
194 (while (search-backward "\n(" begin t)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
195 (forward-char 1)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
196 (insert "\\"))))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
197 (if (null (cdr elt))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
198 (princ ")" outbuf)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
199 (princ " " outbuf)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
200 (princ (substring (prin1-to-string (cdr elt)) 1)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
201 outbuf))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
202 (terpri outbuf)))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
203 (let ((print-escape-newlines t)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
204 (print-escape-nonascii t))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
205 (print form outbuf)))))))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
206
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
207 (defun autoload-ensure-default-file (file)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
208 "Make sure that the autoload file FILE exists and if not create it."
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
209 (unless (file-exists-p file)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
210 (write-region
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
211 (concat ";;; " (file-name-nondirectory file)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
212 " --- automatically extracted autoloads\n"
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
213 ";;\n"
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
214 ";;; Code:\n\n"
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
215 " \n;; Local Variables:\n"
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
216 ";; version-control: never\n"
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
217 ";; no-byte-compile: t\n"
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
218 ";; no-update-autoloads: t\n"
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
219 ";; End:\n"
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
220 ";;; " (file-name-nondirectory file)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
221 "ends here\n")
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
222 nil file))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
223 file)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
224
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
225 (defun autoload-insert-section-header (outbuf autoloads load-name file time)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
226 "Insert the section-header line,
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
227 which lists the file name and which functions are in it, etc."
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
228 (insert generate-autoload-section-header)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
229 (prin1 (list 'autoloads autoloads load-name
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
230 (if (stringp file) (autoload-trim-file-name file) file)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
231 time)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
232 outbuf)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
233 (terpri outbuf)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
234 ;; Break that line at spaces, to avoid very long lines.
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
235 ;; Make each sub-line into a comment.
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
236 (with-current-buffer outbuf
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
237 (save-excursion
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
238 (forward-line -1)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
239 (while (not (eolp))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
240 (move-to-column 64)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
241 (skip-chars-forward "^ \n")
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
242 (or (eolp)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
243 (insert "\n" generate-autoload-section-continuation))))))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
244
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
245 (defun generate-file-autoloads (file)
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
246 "Insert at point a loaddefs autoload section for FILE.
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
247 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
248 marked by `generate-autoload-cookie' (which see).
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
249 If FILE is being visited in a buffer, the contents of the buffer
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
250 are used."
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
251 (interactive "fGenerate autoloads for file: ")
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
252 (let ((outbuf (current-buffer))
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
253 (autoloads-done '())
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
254 (load-name (let ((name (file-name-nondirectory file)))
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
255 (if (string-match "\\.elc?$" name)
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
256 (substring name 0 (match-beginning 0))
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
257 name)))
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
258 (print-length nil)
5837
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
259 (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
260 (float-output-format nil)
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
261 (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
262 (visited (get-file-buffer file))
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
263 output-end)
727
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
264
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
265 ;; If the autoload section we create here uses an absolute
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
266 ;; pathname for FILE in its header, and then Emacs is installed
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
267 ;; under a different path on another system,
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
268 ;; `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
269 ;; 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
270 ;; 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
271 ;; relative to the current buffer's directory.
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
272 (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
273 (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
274 (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
275 (file-truename default-directory)))
410395998370 (generate-file-autoloads): Fix FILE truename hacking to substring
Roland McGrath <roland@gnu.org>
parents: 4068
diff changeset
276 (len (length dir-truename)))
410395998370 (generate-file-autoloads): Fix FILE truename hacking to substring
Roland McGrath <roland@gnu.org>
parents: 4068
diff changeset
277 (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
278 (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
279 (setq file (substring source-truename len))))
727
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
280
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
281 (message "Generating autoloads for %s..." file)
1975
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
282 (save-excursion
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
283 (unwind-protect
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
284 (progn
13730
87eb8f956a00 (generate-file-autoloads): If no buffer visiting FILE exists, read it into
Roland McGrath <roland@gnu.org>
parents: 12500
diff changeset
285 (if visited
87eb8f956a00 (generate-file-autoloads): If no buffer visiting FILE exists, read it into
Roland McGrath <roland@gnu.org>
parents: 12500
diff changeset
286 (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
287 ;; 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
288 (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
289 (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
290 (erase-buffer)
14043
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
291 (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
292 buffer-read-only nil)
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
293 (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
294 (insert-file-contents file nil))
1975
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
295 (save-excursion
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
296 (save-restriction
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
297 (widen)
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
298 (goto-char (point-min))
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
299 (while (not (eobp))
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
300 (skip-chars-forward " \t\n\f")
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
301 (cond
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
302 ((looking-at (regexp-quote generate-autoload-cookie))
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
303 (search-forward generate-autoload-cookie)
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
304 (skip-chars-forward " \t")
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
305 (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
306 (if (eolp)
9d1ae808403b (generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents: 5843
diff changeset
307 ;; 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
308 (let* ((form (prog1 (read (current-buffer))
29416
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
309 (or (bolp) (forward-line 1))))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
310 (autoload (make-autoload form load-name)))
5854
9d1ae808403b (generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents: 5843
diff changeset
311 (if autoload
9d1ae808403b (generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents: 5843
diff changeset
312 (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
313 autoloads-done))
9d1ae808403b (generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents: 5843
diff changeset
314 (setq autoload form))
29416
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
315 (autoload-print-form autoload))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
316
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
317 ;; 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
318 (princ (buffer-substring
35c457f8bedf (generate-file-autoloads): Preserve whitespace after cookie in literal text
Roland McGrath <roland@gnu.org>
parents: 13730
diff changeset
319 (progn
35c457f8bedf (generate-file-autoloads): Preserve whitespace after cookie in literal text
Roland McGrath <roland@gnu.org>
parents: 13730
diff changeset
320 ;; 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
321 (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
322 (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
323 ;; Eat one space.
35c457f8bedf (generate-file-autoloads): Preserve whitespace after cookie in literal text
Roland McGrath <roland@gnu.org>
parents: 13730
diff changeset
324 (forward-char 1))
35c457f8bedf (generate-file-autoloads): Preserve whitespace after cookie in literal text
Roland McGrath <roland@gnu.org>
parents: 13730
diff changeset
325 (point))
35c457f8bedf (generate-file-autoloads): Preserve whitespace after cookie in literal text
Roland McGrath <roland@gnu.org>
parents: 13730
diff changeset
326 (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
327 outbuf)))
5837
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
328 ((looking-at ";")
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
329 ;; Don't read the comment.
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
330 (forward-line 1))
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
331 (t
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
332 (forward-sexp 1)
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
333 (forward-line 1)))))))
1975
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
334 (or visited
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
335 ;; 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
336 (kill-buffer (current-buffer)))
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
337 (set-buffer outbuf)
3334e2489824 * autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents: 1884
diff changeset
338 (setq output-end (point-marker))))
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
339 (if done-any
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
340 (progn
21479
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
341 ;; Insert the section-header line
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
342 ;; which lists the file name and which functions are in it, etc.
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
343 (autoload-insert-section-header outbuf autoloads-done load-name file
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
344 (nth 5 (file-attributes file)))
5837
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
345 (insert ";;; Generated autoloads from "
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
346 (autoload-trim-file-name file) "\n")
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
347 (goto-char output-end)
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
348 (insert generate-autoload-section-trailer)))
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
349 (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
350
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
351 ;;;###autoload
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
352 (defun update-file-autoloads (file)
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
353 "Update the autoloads for FILE in `generated-autoload-file'
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
354 \(which FILE might bind in its local variables).
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
355 Return FILE if there was no autoload cookie in it."
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
356 (interactive "fUpdate autoloads for file: ")
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
357 (let ((load-name (let ((name (file-name-nondirectory file)))
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
358 (if (string-match "\\.elc?$" name)
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
359 (substring name 0 (match-beginning 0))
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
360 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
361 (found nil)
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
362 (existing-buffer (get-file-buffer file))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
363 (no-autoloads nil))
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
364 (save-excursion
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
365 ;; We want to get a value for generated-autoload-file from
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
366 ;; 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
367 (if existing-buffer
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
368 (set-buffer existing-buffer))
34267
6144bd28b9b5 (update-file-autoloads): Use raw-text to
Eli Zaretskii <eliz@gnu.org>
parents: 29549
diff changeset
369 ;; We must read/write the file without any code conversion,
6144bd28b9b5 (update-file-autoloads): Use raw-text to
Eli Zaretskii <eliz@gnu.org>
parents: 29549
diff changeset
370 ;; but still decode EOLs.
6144bd28b9b5 (update-file-autoloads): Use raw-text to
Eli Zaretskii <eliz@gnu.org>
parents: 29549
diff changeset
371 (let ((coding-system-for-read 'raw-text))
21369
9ca6953d7ce8 (update-file-autoloads): Redo 1997-08-23 change.
Richard M. Stallman <rms@gnu.org>
parents: 21119
diff changeset
372 (set-buffer (find-file-noselect
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
373 (autoload-ensure-default-file
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
374 (expand-file-name generated-autoload-file
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
375 (expand-file-name "lisp"
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
376 source-directory)))))
34267
6144bd28b9b5 (update-file-autoloads): Use raw-text to
Eli Zaretskii <eliz@gnu.org>
parents: 29549
diff changeset
377 ;; This is to make generated-autoload-file have Unix EOLs, so
6144bd28b9b5 (update-file-autoloads): Use raw-text to
Eli Zaretskii <eliz@gnu.org>
parents: 29549
diff changeset
378 ;; that it is portable to all platforms.
6144bd28b9b5 (update-file-autoloads): Use raw-text to
Eli Zaretskii <eliz@gnu.org>
parents: 29549
diff changeset
379 (setq buffer-file-coding-system 'raw-text-unix))
20817
297fefd12ecf (update-file-autoloads): Give clean errors
Richard M. Stallman <rms@gnu.org>
parents: 19482
diff changeset
380 (or (> (buffer-size) 0)
297fefd12ecf (update-file-autoloads): Give clean errors
Richard M. Stallman <rms@gnu.org>
parents: 19482
diff changeset
381 (error "Autoloads file %s does not exist" buffer-file-name))
297fefd12ecf (update-file-autoloads): Give clean errors
Richard M. Stallman <rms@gnu.org>
parents: 19482
diff changeset
382 (or (file-writable-p buffer-file-name)
297fefd12ecf (update-file-autoloads): Give clean errors
Richard M. Stallman <rms@gnu.org>
parents: 19482
diff changeset
383 (error "Autoloads file %s is not writable" buffer-file-name))
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
384 (save-excursion
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
385 (save-restriction
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
386 (widen)
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
387 (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
388 ;; 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
389 (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
390 (search-forward generate-autoload-section-header nil t))
21479
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
391 (let ((form (autoload-read-section-header)))
5815
b1e5e6efed1d (update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents: 4555
diff changeset
392 (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
393 ;; 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
394 ;; 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
395 (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
396 (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
397 (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
398 (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
399 (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
400 (listp last-time) (= (length last-time) 2)
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
401 (not (autoload-before-p last-time file-time)))
5815
b1e5e6efed1d (update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents: 4555
diff changeset
402 (progn
14252
7ef2eabb1a9c (update-file-autoloads): Only give "up to date" msg if (interactive-p).
Roland McGrath <roland@gnu.org>
parents: 14192
diff changeset
403 (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
404 (message "\
7ef2eabb1a9c (update-file-autoloads): Only give "up to date" msg if (interactive-p).
Roland McGrath <roland@gnu.org>
parents: 14192
diff changeset
405 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
406 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
407 (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
408 (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
409 (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
410 (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
411 ((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
412 ;; 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
413 ;; 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
414 ;; 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
415 ;; 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
416 (goto-char (match-beginning 0))
5837
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
417 (setq found 'new)))))
14044
1c331f9332ae (update-file-autoloads): Fix placement of new sections.
Roland McGrath <roland@gnu.org>
parents: 14043
diff changeset
418 (or found
1c331f9332ae (update-file-autoloads): Fix placement of new sections.
Roland McGrath <roland@gnu.org>
parents: 14043
diff changeset
419 (progn
1c331f9332ae (update-file-autoloads): Fix placement of new sections.
Roland McGrath <roland@gnu.org>
parents: 14043
diff changeset
420 (setq found 'new)
1c331f9332ae (update-file-autoloads): Fix placement of new sections.
Roland McGrath <roland@gnu.org>
parents: 14043
diff changeset
421 ;; 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
422 (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
423 (search-backward "\f" nil t)))
5837
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
424 (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
425 (and (eq found 'new)
5837
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
426 ;; 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
427 ;; new section for it.
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
428 (save-excursion
14043
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
429 (if existing-buffer
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
430 (set-buffer existing-buffer)
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
431 ;; 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
432 (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
433 (kill-all-local-variables)
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
434 (erase-buffer)
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
435 (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
436 buffer-read-only nil)
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
437 (emacs-lisp-mode)
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
438 (insert-file-contents file nil))
5837
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
439 (save-excursion
14043
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
440 (save-restriction
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
441 (widen)
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
442 (goto-char (point-min))
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
443 (prog1
19209
50857b41060a (update-file-autoloads): Use anchored regexp search instead of requiring
Roland McGrath <roland@gnu.org>
parents: 19170
diff changeset
444 (if (re-search-forward
50857b41060a (update-file-autoloads): Use anchored regexp search instead of requiring
Roland McGrath <roland@gnu.org>
parents: 19170
diff changeset
445 (concat "^" (regexp-quote
50857b41060a (update-file-autoloads): Use anchored regexp search instead of requiring
Roland McGrath <roland@gnu.org>
parents: 19170
diff changeset
446 generate-autoload-cookie))
14043
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
447 nil t)
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
448 nil
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
449 (if (interactive-p)
14192
b1bc0f5d8cf3 (update-file-autoloads): Fix message.
Erik Naggum <erik@naggum.no>
parents: 14169
diff changeset
450 (message "%s has no autoloads" file))
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
451 (setq no-autoloads t)
14043
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
452 t)
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
453 (or existing-buffer
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
454 (kill-buffer (current-buffer))))))))
7456
493a32789e7d (update-file-autoloads): Delete leftover variable.
Karl Heuer <kwzh@gnu.org>
parents: 7437
diff changeset
455 (generate-file-autoloads file))))
21479
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
456 (and (interactive-p)
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
457 (buffer-modified-p)
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
458 (save-buffer))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
459
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
460 (if no-autoloads file))))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
461
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
462 (defun autoload-before-p (time1 time2)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
463 (or (< (car time1) (car time2))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
464 (and (= (car time1) (car time2))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
465 (< (nth 1 time1) (nth 1 time2)))))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
466
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
467 (defun autoload-remove-section (begin)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
468 (goto-char begin)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
469 (search-forward generate-autoload-section-trailer)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
470 (delete-region begin (point)))
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
471
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
472 ;;;###autoload
17851
6e7bb77cd7e1 (update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 17750
diff changeset
473 (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
474 "\
17851
6e7bb77cd7e1 (update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 17750
diff changeset
475 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
476 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
477 (interactive "DUpdate autoloads from directory: ")
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
478 (let* ((files (apply 'nconc
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
479 (mapcar (lambda (dir)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
480 (directory-files (expand-file-name dir)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
481 ;; FIXME: add .gz etc...
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
482 t "^[^=.].*\\.el\\'"))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
483 dirs)))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
484 (this-time (current-time))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
485 (no-autoloads nil) ;files with no autoload cookies.
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
486 (autoloads-file
19019
65f371a2cf00 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 17851
diff changeset
487 (expand-file-name generated-autoload-file
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
488 (expand-file-name "lisp" source-directory)))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
489 (top-dir (file-name-directory autoloads-file)))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
490
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
491 (with-current-buffer
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
492 (find-file-noselect (autoload-ensure-default-file autoloads-file))
2535
86d5500624d5 (update-file-autoloads, update-directory-autoloads): If called
Roland McGrath <roland@gnu.org>
parents: 2494
diff changeset
493 (save-excursion
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
494
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
495 ;; Canonicalize file names and remove the autoload file itself.
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
496 (setq files (delete (autoload-trim-file-name buffer-file-name)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
497 (mapcar 'autoload-trim-file-name files)))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
498
14043
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
499 (goto-char (point-min))
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
500 (while (search-forward generate-autoload-section-header nil t)
21479
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
501 (let* ((form (autoload-read-section-header))
14043
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
502 (file (nth 3 form)))
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
503 (cond ((and (consp file) (stringp (car file)))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
504 ;; This is a list of files that have no autoload cookies.
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
505 ;; There shouldn't be more than one such entry.
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
506 ;; Remove the obsolete section.
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
507 (autoload-remove-section (match-beginning 0))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
508 (let ((last-time (nth 4 form)))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
509 (dolist (file file)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
510 (let ((file-time (nth 5 (file-attributes file))))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
511 (when (and file-time
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
512 (not (autoload-before-p last-time
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
513 file-time)))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
514 ;; file unchanged
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
515 (push file no-autoloads)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
516 (setq files (delete file files)))))))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
517 ((not (stringp file)))
17851
6e7bb77cd7e1 (update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 17750
diff changeset
518 ((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
519 ;; Remove the obsolete section.
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
520 (autoload-remove-section (match-beginning 0)))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
521 ((equal (nth 4 form) (nth 5 (file-attributes file)))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
522 ;; File hasn't changed.
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
523 nil)
14043
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
524 (t
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
525 (update-file-autoloads file)))
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
526 (setq files (delete file files)))))
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
527 ;; Elements remaining in FILES have no existing autoload sections yet.
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
528 (setq no-autoloads
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
529 (append no-autoloads
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
530 (delq nil (mapcar 'update-file-autoloads files))))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
531 (when no-autoloads
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
532 ;; Add the `no-autoloads' section.
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
533 (goto-char (point-max))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
534 (search-backward "\f" nil t)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
535 (autoload-insert-section-header
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
536 (current-buffer) nil nil no-autoloads this-time)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
537 (insert generate-autoload-section-trailer))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
538
14043
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
539 (save-buffer))))
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
540
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
541 ;;;###autoload
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
542 (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
543 "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
544 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
545 (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
546 (setq command-line-args-left nil))
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
547
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
548 (provide 'autoload)
648
70b112526394 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 473
diff changeset
549
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 648
diff changeset
550 ;;; autoload.el ends here