annotate lisp/emacs-lisp/autoload.el @ 86222:4aed8a9fb626

(compilation-forget-errors): Declare as function.
author Glenn Morris <rgm@gnu.org>
date Mon, 19 Nov 2007 00:10:22 +0000
parents 386452a14fe0
children 107ccd98fa12 424b655804ca
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
50806
50dd49abb157 (update-directory-autoloads): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 49598
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
63785
1220f6122b90 (make-autoload): Add the :setter for defcustoms corresponding to minor modes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61177
diff changeset
3 ;; Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2001, 2002, 2003,
75346
7a3f13e2dd57 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 71955
diff changeset
4 ;; 2004, 2005, 2006, 2007 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
78217
935157c0b596 Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents: 75640
diff changeset
13 ;; the Free Software Foundation; either version 3, or (at your option)
14169
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
64085
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63785
diff changeset
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63785
diff changeset
24 ;; Boston, MA 02110-1301, 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.
47664
a0d27828cf39 (make-autoload): Add usage info to docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42767
diff changeset
36 (require 'help-fns) ;for help-add-fundoc-usage.
51012
a7817088fe0d (make-autoload): Add arglist for define-derived-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50815
diff changeset
37 (eval-when-compile (require 'cl))
39763
c8f0d7b4bb40 (doc-string-elt): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39560
diff changeset
38
19170
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
39 (defvar generated-autoload-file "loaddefs.el"
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
40 "*File \\[update-file-autoloads] puts autoloads into.
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
41 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
42 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
43 trailer starting with a FormFeed character.")
81873
3bb49962b482 (generated-autoload-file): Autoload the safe-local-variable setting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81800
diff changeset
44 ;;;###autoload
81590
ffabac9ec014 (autoload-generated-file): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75640
diff changeset
45 (put 'generated-autoload-file 'safe-local-variable 'stringp)
19170
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
46
81590
ffabac9ec014 (autoload-generated-file): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75640
diff changeset
47 ;; This feels like it should be a defconst, but MH-E sets it to
ffabac9ec014 (autoload-generated-file): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75640
diff changeset
48 ;; ";;;###mh-autoload" for the autoloads that are to go into mh-loaddefs.el.
ffabac9ec014 (autoload-generated-file): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75640
diff changeset
49 (defvar generate-autoload-cookie ";;;###autoload"
19170
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
50 "Magic comment indicating the following form should be autoloaded.
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
51 Used by \\[update-file-autoloads]. This string should be
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
52 meaningless to Lisp (e.g., a comment).
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 This string is used:
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
55
81590
ffabac9ec014 (autoload-generated-file): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75640
diff changeset
56 \;;;###autoload
19170
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
57 \(defun function-to-be-autoloaded () ...)
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
58
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
59 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
60 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
61 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
62
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
63 (defconst generate-autoload-section-header "\f\n;;;### "
21479
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
64 "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
65
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
66 (defconst generate-autoload-section-trailer "\n;;;***\n"
ecc4375537e3 (update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents: 19131
diff changeset
67 "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
68
21479
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
69 (defconst generate-autoload-section-continuation ";;;;;; "
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
70 "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
71
81622
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
72 (defvar autoload-modified-buffers) ;Dynamically scoped var.
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
73
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74 (defun make-autoload (form file)
17750
f11a3a49088c (defcustom): Add doc-string-elt property.
Richard M. Stallman <rms@gnu.org>
parents: 17591
diff changeset
75 "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
76 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
77 or macro definition or a defcustom)."
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
78 (let ((car (car-safe form)) expand)
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
79 (cond
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
80 ;; For complex cases, try again on the macro-expansion.
61177
64c207ce6c20 (make-autoload): Handle define-global-minor-mode.
Richard M. Stallman <rms@gnu.org>
parents: 59427
diff changeset
81 ((and (memq car '(easy-mmode-define-global-mode define-global-minor-mode
75640
a70527c58a3f (global-cwarn-mode): Add define-globalized-minor-mode.
Chong Yidong <cyd@stupidchicken.com>
parents: 75346
diff changeset
82 define-globalized-minor-mode
29549
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
83 easy-mmode-define-minor-mode define-minor-mode))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
84 (setq expand (let ((load-file-name file)) (macroexpand form)))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
85 (eq (car expand) 'progn)
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
86 (memq :autoload-end expand))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
87 (let ((end (memq :autoload-end expand)))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
88 ;; Cut-off anything after the :autoload-end marker.
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
89 (setcdr end nil)
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
90 (cons 'progn
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
91 (mapcar (lambda (form) (make-autoload form file))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
92 (cdr expand)))))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
93
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
94 ;; For special function-like operators, use the `autoload' function.
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
95 ((memq car '(defun define-skeleton defmacro define-derived-mode
67291
cf5b42f7a962 (make-autoload): Add define-global-minor-mode.
Juri Linkov <juri@jurta.org>
parents: 67223
diff changeset
96 define-compilation-mode define-generic-mode
cf5b42f7a962 (make-autoload): Add define-global-minor-mode.
Juri Linkov <juri@jurta.org>
parents: 67223
diff changeset
97 easy-mmode-define-global-mode define-global-minor-mode
75640
a70527c58a3f (global-cwarn-mode): Add define-globalized-minor-mode.
Chong Yidong <cyd@stupidchicken.com>
parents: 75346
diff changeset
98 define-globalized-minor-mode
67291
cf5b42f7a962 (make-autoload): Add define-global-minor-mode.
Juri Linkov <juri@jurta.org>
parents: 67223
diff changeset
99 easy-mmode-define-minor-mode define-minor-mode
cf5b42f7a962 (make-autoload): Add define-global-minor-mode.
Juri Linkov <juri@jurta.org>
parents: 67223
diff changeset
100 defun* defmacro*))
41811
0343ccd72be1 (make-autoload): Also generate autoloads for `defmacro*' forms.
Colin Walters <walters@gnu.org>
parents: 39763
diff changeset
101 (let* ((macrop (memq car '(defmacro defmacro*)))
29549
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
102 (name (nth 1 form))
51012
a7817088fe0d (make-autoload): Add arglist for define-derived-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50815
diff changeset
103 (args (case car
a7817088fe0d (make-autoload): Add arglist for define-derived-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50815
diff changeset
104 ((defun defmacro defun* defmacro*) (nth 2 form))
a7817088fe0d (make-autoload): Add arglist for define-derived-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50815
diff changeset
105 ((define-skeleton) '(&optional str arg))
56995
fd1be95301bf (make-autoload): Handle `define-compilation-mode'.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 55208
diff changeset
106 ((define-generic-mode define-derived-mode
fd1be95301bf (make-autoload): Handle `define-compilation-mode'.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 55208
diff changeset
107 define-compilation-mode) nil)
51012
a7817088fe0d (make-autoload): Add arglist for define-derived-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50815
diff changeset
108 (t)))
29549
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
109 (body (nthcdr (get car 'doc-string-elt) form))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
110 (doc (if (stringp (car body)) (pop body))))
47664
a0d27828cf39 (make-autoload): Add usage info to docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42767
diff changeset
111 (when (listp args)
a0d27828cf39 (make-autoload): Add usage info to docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42767
diff changeset
112 ;; Add the usage form at the end where describe-function-1
a0d27828cf39 (make-autoload): Add usage info to docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42767
diff changeset
113 ;; can recover it.
a0d27828cf39 (make-autoload): Add usage info to docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42767
diff changeset
114 (setq doc (help-add-fundoc-usage doc args)))
29549
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
115 ;; `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
116 (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
117 (or (and (memq car '(define-skeleton define-derived-mode
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
118 define-generic-mode
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
119 easy-mmode-define-global-mode
67291
cf5b42f7a962 (make-autoload): Add define-global-minor-mode.
Juri Linkov <juri@jurta.org>
parents: 67223
diff changeset
120 define-global-minor-mode
75640
a70527c58a3f (global-cwarn-mode): Add define-globalized-minor-mode.
Chong Yidong <cyd@stupidchicken.com>
parents: 75346
diff changeset
121 define-globalized-minor-mode
29549
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
122 easy-mmode-define-minor-mode
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
123 define-minor-mode)) t)
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
124 (eq (car-safe (car body)) 'interactive))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
125 (if macrop (list 'quote 'macro) nil))))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
126
49100
b418e4d949ac (make-autoload): Generate custom-autoload for autoloaded defcustoms.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48855
diff changeset
127 ;; Convert defcustom to less space-consuming data.
29549
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
128 ((eq car 'defcustom)
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
129 (let ((varname (car-safe (cdr-safe form)))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
130 (init (car-safe (cdr-safe (cdr-safe form))))
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
131 (doc (car-safe (cdr-safe (cdr-safe (cdr-safe form)))))
49100
b418e4d949ac (make-autoload): Generate custom-autoload for autoloaded defcustoms.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48855
diff changeset
132 ;; (rest (cdr-safe (cdr-safe (cdr-safe (cdr-safe form)))))
b418e4d949ac (make-autoload): Generate custom-autoload for autoloaded defcustoms.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48855
diff changeset
133 )
b418e4d949ac (make-autoload): Generate custom-autoload for autoloaded defcustoms.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48855
diff changeset
134 `(progn
b418e4d949ac (make-autoload): Generate custom-autoload for autoloaded defcustoms.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48855
diff changeset
135 (defvar ,varname ,init ,doc)
71955
e768c05d6e71 (make-autoload): Use new arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71874
diff changeset
136 (custom-autoload ',varname ,file
e768c05d6e71 (make-autoload): Use new arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71874
diff changeset
137 ,(condition-case nil
e768c05d6e71 (make-autoload): Use new arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71874
diff changeset
138 (null (cadr (memq :set form)))
e768c05d6e71 (make-autoload): Use new arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71874
diff changeset
139 (error nil))))))
29549
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
140
67223
23fa76e60a61 (make-autoload): Handle defgroup specially.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66748
diff changeset
141 ((eq car 'defgroup)
23fa76e60a61 (make-autoload): Handle defgroup specially.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66748
diff changeset
142 ;; In Emacs this is normally handled separately by cus-dep.el, but for
23fa76e60a61 (make-autoload): Handle defgroup specially.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66748
diff changeset
143 ;; third party packages, it can be convenient to explicitly autoload
23fa76e60a61 (make-autoload): Handle defgroup specially.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66748
diff changeset
144 ;; a group.
23fa76e60a61 (make-autoload): Handle defgroup specially.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66748
diff changeset
145 (let ((groupname (nth 1 form)))
23fa76e60a61 (make-autoload): Handle defgroup specially.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66748
diff changeset
146 `(let ((loads (get ',groupname 'custom-loads)))
23fa76e60a61 (make-autoload): Handle defgroup specially.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66748
diff changeset
147 (if (member ',file loads) nil
23fa76e60a61 (make-autoload): Handle defgroup specially.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66748
diff changeset
148 (put ',groupname 'custom-loads (cons ',file loads))))))
23fa76e60a61 (make-autoload): Handle defgroup specially.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 66748
diff changeset
149
29549
eafd45bcdcc1 (make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 29419
diff changeset
150 ;; 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
151 (t nil))))
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
152
47664
a0d27828cf39 (make-autoload): Add usage info to docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42767
diff changeset
153 ;; Forms which have doc-strings which should be printed specially.
a0d27828cf39 (make-autoload): Add usage info to docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42767
diff changeset
154 ;; A doc-string-elt property of ELT says that (nth ELT FORM) is
a0d27828cf39 (make-autoload): Add usage info to docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42767
diff changeset
155 ;; the doc-string in FORM.
a0d27828cf39 (make-autoload): Add usage info to docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42767
diff changeset
156 ;; 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
157
81590
ffabac9ec014 (autoload-generated-file): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75640
diff changeset
158 (defun autoload-generated-file ()
ffabac9ec014 (autoload-generated-file): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75640
diff changeset
159 (expand-file-name generated-autoload-file
81623
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
160 ;; File-local settings of generated-autoload-file should
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
161 ;; be interpreted relative to the file's location,
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
162 ;; of course.
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
163 (if (not (local-variable-p 'generated-autoload-file))
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
164 (expand-file-name "lisp" source-directory))))
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
165
5837
fd1e2c6f7bf5 (autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents: 5815
diff changeset
166
21479
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
167 (defun autoload-read-section-header ()
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
168 "Read a section header form.
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
169 Since continuation lines have been marked as comments,
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
170 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
171 markers before we call `read'."
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
172 (save-match-data
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
173 (let ((beginning (point))
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
174 string)
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
175 (forward-line 1)
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
176 (while (looking-at generate-autoload-section-continuation)
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
177 (forward-line 1))
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
178 (setq string (buffer-substring beginning (point)))
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
179 (with-current-buffer (get-buffer-create " *autoload*")
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
180 (erase-buffer)
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
181 (insert string)
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
182 (goto-char (point-min))
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
183 (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
184 (replace-match " "))
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
185 (goto-char (point-min))
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
186 (read (current-buffer))))))
89c1bfb63571 (generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 21369
diff changeset
187
66015
4ad1dc6bc1e0 (update-directory-autoloads): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 64751
diff changeset
188 (defvar autoload-print-form-outbuf nil
4ad1dc6bc1e0 (update-directory-autoloads): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 64751
diff changeset
189 "Buffer which gets the output of `autoload-print-form'.")
48718
c1ae448c795b (autoload-print-form-outbuf): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 48368
diff changeset
190
29416
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
191 (defun autoload-print-form (form)
48718
c1ae448c795b (autoload-print-form-outbuf): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 48368
diff changeset
192 "Print FORM such that `make-docfile' will find the docstrings.
c1ae448c795b (autoload-print-form-outbuf): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 48368
diff changeset
193 The variable `autoload-print-form-outbuf' specifies the buffer to
c1ae448c795b (autoload-print-form-outbuf): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 48368
diff changeset
194 put the output in."
29416
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
195 (cond
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
196 ;; If the form is a sequence, recurse.
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
197 ((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
198 ;; Symbols at the toplevel are meaningless.
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
199 ((symbolp form) nil)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
200 (t
48718
c1ae448c795b (autoload-print-form-outbuf): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 48368
diff changeset
201 (let ((doc-string-elt (get (car-safe form) 'doc-string-elt))
c1ae448c795b (autoload-print-form-outbuf): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 48368
diff changeset
202 (outbuf autoload-print-form-outbuf))
29416
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
203 (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
204 ;; We need to hack the printing because the
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
205 ;; doc-string must be printed specially for
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
206 ;; make-docfile (sigh).
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
207 (let* ((p (nthcdr (1- doc-string-elt) form))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
208 (elt (cdr p)))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
209 (setcdr p nil)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
210 (princ "\n(" outbuf)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
211 (let ((print-escape-newlines t)
82358
386452a14fe0 (autoload-print-form): Use print-quoted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
212 (print-quoted t)
29416
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
213 (print-escape-nonascii t))
47867
f91cebb0f333 (autoload-print-form): Cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 47664
diff changeset
214 (dolist (elt form)
f91cebb0f333 (autoload-print-form): Cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 47664
diff changeset
215 (prin1 elt outbuf)
f91cebb0f333 (autoload-print-form): Cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 47664
diff changeset
216 (princ " " outbuf)))
29416
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
217 (princ "\"\\\n" outbuf)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
218 (let ((begin (with-current-buffer outbuf (point))))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
219 (princ (substring (prin1-to-string (car elt)) 1)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
220 outbuf)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
221 ;; Insert a backslash before each ( that
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
222 ;; appears at the beginning of a line in
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
223 ;; the doc string.
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
224 (with-current-buffer outbuf
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
225 (save-excursion
47664
a0d27828cf39 (make-autoload): Add usage info to docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 42767
diff changeset
226 (while (re-search-backward "\n[[(]" begin t)
29416
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
227 (forward-char 1)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
228 (insert "\\"))))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
229 (if (null (cdr elt))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
230 (princ ")" outbuf)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
231 (princ " " outbuf)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
232 (princ (substring (prin1-to-string (cdr elt)) 1)
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
233 outbuf))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
234 (terpri outbuf)))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
235 (let ((print-escape-newlines t)
82358
386452a14fe0 (autoload-print-form): Use print-quoted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
236 (print-quoted t)
29416
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
237 (print-escape-nonascii t))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
238 (print form outbuf)))))))
6d8ceb166666 (make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28400
diff changeset
239
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
240 (defun autoload-ensure-default-file (file)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
241 "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
242 (unless (file-exists-p file)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
243 (write-region
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
244 (concat ";;; " (file-name-nondirectory file)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
245 " --- automatically extracted autoloads\n"
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
246 ";;\n"
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
247 ";;; Code:\n\n"
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
248 " \n;; Local Variables:\n"
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
249 ";; version-control: never\n"
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
250 ";; no-byte-compile: t\n"
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
251 ";; no-update-autoloads: t\n"
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
252 ";; End:\n"
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
253 ";;; " (file-name-nondirectory file)
48855
b2730a8dee9a (autoload-ensure-default-file): insert
David Kastrup <dak@gnu.org>
parents: 48718
diff changeset
254 " ends here\n")
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
255 nil file))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
256 file)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
257
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
258 (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
259 "Insert the section-header line,
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
260 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
261 (insert generate-autoload-section-header)
81622
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
262 (prin1 (list 'autoloads autoloads load-name file time)
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
263 outbuf)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
264 (terpri outbuf)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
265 ;; 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
266 ;; 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
267 (with-current-buffer outbuf
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
268 (save-excursion
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
269 (forward-line -1)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
270 (while (not (eolp))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
271 (move-to-column 64)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
272 (skip-chars-forward "^ \n")
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
273 (or (eolp)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
274 (insert "\n" generate-autoload-section-continuation))))))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
275
71047
e98e3d0ee915 (autoload-find-file): New fun. This one calls hack-local-variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 69167
diff changeset
276 (defun autoload-find-file (file)
e98e3d0ee915 (autoload-find-file): New fun. This one calls hack-local-variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 69167
diff changeset
277 "Fetch file and put it in a temp buffer. Return the buffer."
e98e3d0ee915 (autoload-find-file): New fun. This one calls hack-local-variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 69167
diff changeset
278 ;; It is faster to avoid visiting the file.
81590
ffabac9ec014 (autoload-generated-file): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75640
diff changeset
279 (setq file (expand-file-name file))
71047
e98e3d0ee915 (autoload-find-file): New fun. This one calls hack-local-variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 69167
diff changeset
280 (with-current-buffer (get-buffer-create " *autoload-file*")
e98e3d0ee915 (autoload-find-file): New fun. This one calls hack-local-variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 69167
diff changeset
281 (kill-all-local-variables)
e98e3d0ee915 (autoload-find-file): New fun. This one calls hack-local-variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 69167
diff changeset
282 (erase-buffer)
e98e3d0ee915 (autoload-find-file): New fun. This one calls hack-local-variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 69167
diff changeset
283 (setq buffer-undo-list t
e98e3d0ee915 (autoload-find-file): New fun. This one calls hack-local-variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 69167
diff changeset
284 buffer-read-only nil)
e98e3d0ee915 (autoload-find-file): New fun. This one calls hack-local-variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 69167
diff changeset
285 (emacs-lisp-mode)
81590
ffabac9ec014 (autoload-generated-file): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75640
diff changeset
286 (setq default-directory (file-name-directory file))
71047
e98e3d0ee915 (autoload-find-file): New fun. This one calls hack-local-variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 69167
diff changeset
287 (insert-file-contents file nil)
e98e3d0ee915 (autoload-find-file): New fun. This one calls hack-local-variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 69167
diff changeset
288 (let ((enable-local-variables :safe))
e98e3d0ee915 (autoload-find-file): New fun. This one calls hack-local-variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 69167
diff changeset
289 (hack-local-variables))
e98e3d0ee915 (autoload-find-file): New fun. This one calls hack-local-variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 69167
diff changeset
290 (current-buffer)))
e98e3d0ee915 (autoload-find-file): New fun. This one calls hack-local-variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 69167
diff changeset
291
71048
29150c5d541b (no-update-autoloads): Declare.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71047
diff changeset
292 (defvar no-update-autoloads nil
29150c5d541b (no-update-autoloads): Declare.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71047
diff changeset
293 "File local variable to prevent scanning this file for autoload cookies.")
29150c5d541b (no-update-autoloads): Declare.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71047
diff changeset
294
81590
ffabac9ec014 (autoload-generated-file): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75640
diff changeset
295 (defun autoload-file-load-name (file)
ffabac9ec014 (autoload-generated-file): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75640
diff changeset
296 (let ((name (file-name-nondirectory file)))
ffabac9ec014 (autoload-generated-file): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75640
diff changeset
297 (if (string-match "\\.elc?\\(\\.\\|\\'\\)" name)
ffabac9ec014 (autoload-generated-file): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75640
diff changeset
298 (substring name 0 (match-beginning 0))
ffabac9ec014 (autoload-generated-file): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75640
diff changeset
299 name)))
ffabac9ec014 (autoload-generated-file): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75640
diff changeset
300
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
301 (defun generate-file-autoloads (file)
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
302 "Insert at point a loaddefs autoload section for FILE.
71048
29150c5d541b (no-update-autoloads): Declare.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71047
diff changeset
303 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
304 marked by `generate-autoload-cookie' (which see).
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
305 If FILE is being visited in a buffer, the contents of the buffer
71048
29150c5d541b (no-update-autoloads): Declare.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71047
diff changeset
306 are used.
29150c5d541b (no-update-autoloads): Declare.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71047
diff changeset
307 Return non-nil in the case where no autoloads were added at point."
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
308 (interactive "fGenerate autoloads for file: ")
81603
6a5ecb520686 Refactor for upcoming changes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81602
diff changeset
309 (autoload-generate-file-autoloads file (current-buffer)))
6a5ecb520686 Refactor for upcoming changes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81602
diff changeset
310
81623
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
311 ;; When called from `generate-file-autoloads' we should ignore
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
312 ;; `generated-autoload-file' altogether. When called from
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
313 ;; `update-file-autoloads' we don't know `outbuf'. And when called from
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
314 ;; `update-directory-autoloads' it's in between: we know the default
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
315 ;; `outbuf' but we should obey any file-local setting of
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
316 ;; `generated-autoload-file'.
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
317 (defun autoload-generate-file-autoloads (file &optional outbuf outfile)
81603
6a5ecb520686 Refactor for upcoming changes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81602
diff changeset
318 "Insert an autoload section for FILE in the appropriate buffer.
6a5ecb520686 Refactor for upcoming changes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81602
diff changeset
319 Autoloads are generated for defuns and defmacros in FILE
6a5ecb520686 Refactor for upcoming changes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81602
diff changeset
320 marked by `generate-autoload-cookie' (which see).
6a5ecb520686 Refactor for upcoming changes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81602
diff changeset
321 If FILE is being visited in a buffer, the contents of the buffer are used.
81623
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
322 OUTBUF is the buffer in which the autoload statements should be inserted.
81607
56b815dd1abb (autoload-generate-file-autoloads): Make `outbuf' optional.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81604
diff changeset
323 If OUTBUF is nil, it will be determined by `autoload-generated-file'.
727
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
324
81623
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
325 If provided, OUTFILE is expected to be the file name of OUTBUF.
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
326 If OUTFILE is non-nil and FILE specifies a `generated-autoload-file'
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
327 different from OUTFILE, then OUTBUF is ignored.
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
328
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
329 Return non-nil iff FILE adds no autoloads to OUTFILE
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
330 \(or OUTBUF if OUTFILE is nil)."
81622
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
331 (catch 'done
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
332 (let ((autoloads-done '())
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
333 (load-name (autoload-file-load-name file))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
334 (print-length nil)
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
335 (print-readably t) ; This does something in Lucid Emacs.
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
336 (float-output-format nil)
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
337 (visited (get-file-buffer file))
81623
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
338 (otherbuf nil)
81622
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
339 (absfile (expand-file-name file))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
340 relfile
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
341 ;; nil until we found a cookie.
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
342 output-start)
727
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
343
81622
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
344 (with-current-buffer (or visited
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
345 ;; It is faster to avoid visiting the file.
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
346 (autoload-find-file file))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
347 ;; Obey the no-update-autoloads file local variable.
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
348 (unless no-update-autoloads
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
349 (message "Generating autoloads for %s..." file)
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
350 (save-excursion
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
351 (save-restriction
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
352 (widen)
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
353 (goto-char (point-min))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
354 (while (not (eobp))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
355 (skip-chars-forward " \t\n\f")
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
356 (cond
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
357 ((looking-at (regexp-quote generate-autoload-cookie))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
358 ;; If not done yet, figure out where to insert this text.
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
359 (unless output-start
81623
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
360 (when (and outfile
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
361 (not (equal outfile (autoload-generated-file))))
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
362 ;; A file-local setting of autoload-generated-file says
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
363 ;; we should ignore OUTBUF.
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
364 (setq outbuf nil)
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
365 (setq otherbuf t))
81622
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
366 (unless outbuf
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
367 (setq outbuf (autoload-find-destination absfile))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
368 (unless outbuf
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
369 ;; The file has autoload cookies, but they're
81623
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
370 ;; already up-to-date. If OUTFILE is nil, the
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
371 ;; entries are in the expected OUTBUF, otherwise
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
372 ;; they're elsewhere.
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
373 (throw 'done outfile)))
81622
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
374 (with-current-buffer outbuf
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
375 (setq relfile (file-relative-name absfile))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
376 (setq output-start (point)))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
377 ;; (message "file=%S, relfile=%S, dest=%S"
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
378 ;; file relfile (autoload-generated-file))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
379 )
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
380 (search-forward generate-autoload-cookie)
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
381 (skip-chars-forward " \t")
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
382 (if (eolp)
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
383 (condition-case err
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
384 ;; Read the next form and make an autoload.
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
385 (let* ((form (prog1 (read (current-buffer))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
386 (or (bolp) (forward-line 1))))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
387 (autoload (make-autoload form load-name)))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
388 (if autoload
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
389 (push (nth 1 form) autoloads-done)
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
390 (setq autoload form))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
391 (let ((autoload-print-form-outbuf outbuf))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
392 (autoload-print-form autoload)))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
393 (error
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
394 (message "Error in %s: %S" file err)))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49100
diff changeset
395
81622
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
396 ;; Copy the rest of the line to the output.
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
397 (princ (buffer-substring
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
398 (progn
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
399 ;; Back up over whitespace, to preserve it.
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
400 (skip-chars-backward " \f\t")
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
401 (if (= (char-after (1+ (point))) ? )
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
402 ;; Eat one space.
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
403 (forward-char 1))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
404 (point))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
405 (progn (forward-line 1) (point)))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
406 outbuf)))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
407 ((looking-at ";")
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
408 ;; Don't read the comment.
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
409 (forward-line 1))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
410 (t
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
411 (forward-sexp 1)
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
412 (forward-line 1))))))
71048
29150c5d541b (no-update-autoloads): Declare.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71047
diff changeset
413
81622
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
414 (when output-start
81731
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
415 (let ((secondary-autoloads-file-buf
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
416 (if (local-variable-p 'generated-autoload-file)
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
417 (current-buffer))))
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
418 (with-current-buffer outbuf
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
419 (save-excursion
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
420 ;; Insert the section-header line which lists the file name
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
421 ;; and which functions are in it, etc.
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
422 (goto-char output-start)
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
423 (autoload-insert-section-header
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
424 outbuf autoloads-done load-name relfile
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
425 (if secondary-autoloads-file-buf
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
426 ;; MD5 checksums are much better because they do not
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
427 ;; change unless the file changes (so they'll be
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
428 ;; equal on two different systems and will change
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
429 ;; less often than time-stamps, thus leading to fewer
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
430 ;; unneeded changes causing spurious conflicts), but
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
431 ;; using time-stamps is a very useful optimization,
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
432 ;; so we use time-stamps for the main autoloads file
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
433 ;; (loaddefs.el) where we have special ways to
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
434 ;; circumvent the "random change problem", and MD5
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
435 ;; checksum in secondary autoload files where we do
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
436 ;; not need the time-stamp optimization because it is
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
437 ;; already provided by the primary autoloads file.
81800
e29d41367d51 (autoload-generate-file-autoloads): Be careful
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81790
diff changeset
438 (md5 secondary-autoloads-file-buf
e29d41367d51 (autoload-generate-file-autoloads): Be careful
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81790
diff changeset
439 ;; We'd really want to just use
e29d41367d51 (autoload-generate-file-autoloads): Be careful
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81790
diff changeset
440 ;; `emacs-internal' instead.
e29d41367d51 (autoload-generate-file-autoloads): Be careful
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81790
diff changeset
441 nil nil 'emacs-mule-unix)
81731
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
442 (nth 5 (file-attributes relfile))))
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
443 (insert ";;; Generated autoloads from " relfile "\n"))
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
444 (insert generate-autoload-section-trailer))))
81622
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
445 (message "Generating autoloads for %s...done" file))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
446 (or visited
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
447 ;; We created this buffer, so we should kill it.
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
448 (kill-buffer (current-buffer))))
81623
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
449 ;; If the entries were added to some other buffer, then the file
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
450 ;; doesn't add entries to OUTFILE.
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
451 (or (not output-start) otherbuf))))
2535
86d5500624d5 (update-file-autoloads, update-directory-autoloads): If called
Roland McGrath <roland@gnu.org>
parents: 2494
diff changeset
452
81604
feafa882a0cf (autoload-modified-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81603
diff changeset
453 (defun autoload-save-buffers ()
feafa882a0cf (autoload-modified-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81603
diff changeset
454 (while autoload-modified-buffers
feafa882a0cf (autoload-modified-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81603
diff changeset
455 (with-current-buffer (pop autoload-modified-buffers)
feafa882a0cf (autoload-modified-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81603
diff changeset
456 (save-buffer))))
feafa882a0cf (autoload-modified-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81603
diff changeset
457
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
458 ;;;###autoload
57880
52307ec50b54 (update-file-autoloads): Don't use interactive-p; take new arg SAVE-AFTER.
Richard M. Stallman <rms@gnu.org>
parents: 56995
diff changeset
459 (defun update-file-autoloads (file &optional save-after)
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
460 "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
461 \(which FILE might bind in its local variables).
57880
52307ec50b54 (update-file-autoloads): Don't use interactive-p; take new arg SAVE-AFTER.
Richard M. Stallman <rms@gnu.org>
parents: 56995
diff changeset
462 If SAVE-AFTER is non-nil (which is always, when called interactively),
52307ec50b54 (update-file-autoloads): Don't use interactive-p; take new arg SAVE-AFTER.
Richard M. Stallman <rms@gnu.org>
parents: 56995
diff changeset
463 save the buffer too.
52307ec50b54 (update-file-autoloads): Don't use interactive-p; take new arg SAVE-AFTER.
Richard M. Stallman <rms@gnu.org>
parents: 56995
diff changeset
464
52307ec50b54 (update-file-autoloads): Don't use interactive-p; take new arg SAVE-AFTER.
Richard M. Stallman <rms@gnu.org>
parents: 56995
diff changeset
465 Return FILE if there was no autoload cookie in it, else nil."
52307ec50b54 (update-file-autoloads): Don't use interactive-p; take new arg SAVE-AFTER.
Richard M. Stallman <rms@gnu.org>
parents: 56995
diff changeset
466 (interactive "fUpdate autoloads for file: \np")
81622
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
467 (let* ((autoload-modified-buffers nil)
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
468 (no-autoloads (autoload-generate-file-autoloads file)))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
469 (if autoload-modified-buffers
81607
56b815dd1abb (autoload-generate-file-autoloads): Make `outbuf' optional.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81604
diff changeset
470 (if save-after (autoload-save-buffers))
56b815dd1abb (autoload-generate-file-autoloads): Make `outbuf' optional.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81604
diff changeset
471 (if (interactive-p)
56b815dd1abb (autoload-generate-file-autoloads): Make `outbuf' optional.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81604
diff changeset
472 (message "Autoload section for %s is up to date." file)))
81604
feafa882a0cf (autoload-modified-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81603
diff changeset
473 (if no-autoloads file)))
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
474
81602
ea507ef94ad6 Refactor for upcoming changes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81590
diff changeset
475 (defun autoload-find-destination (file)
ea507ef94ad6 Refactor for upcoming changes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81590
diff changeset
476 "Find the destination point of the current buffer's autoloads.
ea507ef94ad6 Refactor for upcoming changes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81590
diff changeset
477 FILE is the file name of the current buffer.
ea507ef94ad6 Refactor for upcoming changes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81590
diff changeset
478 Returns a buffer whose point is placed at the requested location.
81622
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
479 Returns nil if the file's autoloads are uptodate, otherwise
81731
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
480 removes any prior now out-of-date autoload entries."
81622
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
481 (catch 'up-to-date
81731
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
482 (let* ((load-name (autoload-file-load-name file))
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
483 (buf (current-buffer))
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
484 (existing-buffer (if buffer-file-name buf))
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
485 (found nil))
81622
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
486 (with-current-buffer
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
487 ;; We must read/write the file without any code conversion,
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
488 ;; but still decode EOLs.
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
489 (let ((coding-system-for-read 'raw-text))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
490 (find-file-noselect
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
491 (autoload-ensure-default-file (autoload-generated-file))))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
492 ;; This is to make generated-autoload-file have Unix EOLs, so
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
493 ;; that it is portable to all platforms.
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
494 (setq buffer-file-coding-system 'raw-text-unix)
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
495 (or (> (buffer-size) 0)
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
496 (error "Autoloads file %s does not exist" buffer-file-name))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
497 (or (file-writable-p buffer-file-name)
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
498 (error "Autoloads file %s is not writable" buffer-file-name))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
499 (widen)
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
500 (goto-char (point-min))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
501 ;; Look for the section for LOAD-NAME.
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
502 (while (and (not found)
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
503 (search-forward generate-autoload-section-header nil t))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
504 (let ((form (autoload-read-section-header)))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
505 (cond ((string= (nth 2 form) load-name)
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
506 ;; We found the section for this file.
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
507 ;; Check if it is up to date.
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
508 (let ((begin (match-beginning 0))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
509 (last-time (nth 4 form))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
510 (file-time (nth 5 (file-attributes file))))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
511 (if (and (or (null existing-buffer)
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
512 (not (buffer-modified-p existing-buffer)))
81731
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
513 (or
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
514 ;; last-time is the time-stamp (specifying
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
515 ;; the last time we looked at the file) and
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
516 ;; the file hasn't been changed since.
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
517 (and (listp last-time) (= (length last-time) 2)
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
518 (not (time-less-p last-time file-time)))
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
519 ;; last-time is an MD5 checksum instead.
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
520 (and (stringp last-time)
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
521 (equal last-time
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
522 (md5 buf nil nil 'emacs-mule)))))
81622
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
523 (throw 'up-to-date nil)
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
524 (autoload-remove-section begin)
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
525 (setq found t))))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
526 ((string< load-name (nth 2 form))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
527 ;; We've come to a section alphabetically later than
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
528 ;; LOAD-NAME. We assume the file is in order and so
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
529 ;; there must be no section for LOAD-NAME. We will
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
530 ;; insert one before the section here.
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
531 (goto-char (match-beginning 0))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
532 (setq found t)))))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
533 (or found
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
534 (progn
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
535 ;; No later sections in the file. Put before the last page.
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
536 (goto-char (point-max))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
537 (search-backward "\f" nil t)))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
538 (unless (memq (current-buffer) autoload-modified-buffers)
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
539 (push (current-buffer) autoload-modified-buffers))
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
540 (current-buffer)))))
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
541
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
542 (defun autoload-remove-section (begin)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
543 (goto-char begin)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
544 (search-forward generate-autoload-section-trailer)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
545 (delete-region begin (point)))
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
546
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
547 ;;;###autoload
50806
50dd49abb157 (update-directory-autoloads): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 49598
diff changeset
548 (defun update-directory-autoloads (&rest dirs)
3774
3b0cb275ca29 (generate-autoload-cookie, update-autoloads-here): Doc fixes.
Roland McGrath <roland@gnu.org>
parents: 2535
diff changeset
549 "\
17851
6e7bb77cd7e1 (update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 17750
diff changeset
550 Update loaddefs.el with all the current autoloads from DIRS, and no old ones.
66015
4ad1dc6bc1e0 (update-directory-autoloads): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 64751
diff changeset
551 This uses `update-file-autoloads' (which see) to do its work.
50806
50dd49abb157 (update-directory-autoloads): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 49598
diff changeset
552 In an interactive call, you must give one argument, the name
50dd49abb157 (update-directory-autoloads): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 49598
diff changeset
553 of a single directory. In a call from Lisp, you can supply multiple
50dd49abb157 (update-directory-autoloads): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 49598
diff changeset
554 directories as separate arguments, but this usage is discouraged.
50dd49abb157 (update-directory-autoloads): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 49598
diff changeset
555
50dd49abb157 (update-directory-autoloads): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 49598
diff changeset
556 The function does NOT recursively descend into subdirectories of the
50dd49abb157 (update-directory-autoloads): Renamed from
Richard M. Stallman <rms@gnu.org>
parents: 49598
diff changeset
557 directory or directories specified."
14043
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
558 (interactive "DUpdate autoloads from directory: ")
48136
c102d9848214 (generate-file-autoloads, update-file-autoloads): Strip .gz extensions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47867
diff changeset
559 (let* ((files-re (let ((tmp nil))
69167
35ff03ec3238 (update-directory-autoloads): Use `get-load-suffixes' instead of
Luc Teirlinck <teirllm@auburn.edu>
parents: 68648
diff changeset
560 (dolist (suf (get-load-suffixes)
48136
c102d9848214 (generate-file-autoloads, update-file-autoloads): Strip .gz extensions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47867
diff changeset
561 (concat "^[^=.].*" (regexp-opt tmp t) "\\'"))
c102d9848214 (generate-file-autoloads, update-file-autoloads): Strip .gz extensions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47867
diff changeset
562 (unless (string-match "\\.elc" suf) (push suf tmp)))))
c102d9848214 (generate-file-autoloads, update-file-autoloads): Strip .gz extensions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47867
diff changeset
563 (files (apply 'nconc
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
564 (mapcar (lambda (dir)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
565 (directory-files (expand-file-name dir)
48136
c102d9848214 (generate-file-autoloads, update-file-autoloads): Strip .gz extensions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47867
diff changeset
566 t files-re))
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
567 dirs)))
81790
8aa7f1b66163 (update-directory-autoloads): Remove duplicates without also removing
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81731
diff changeset
568 (done ())
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
569 (this-time (current-time))
81623
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
570 ;; Files with no autoload cookies or whose autoloads go to other
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
571 ;; files because of file-local autoload-generated-file settings.
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
572 (no-autoloads nil)
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
573 (autoload-modified-buffers nil))
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
574
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
575 (with-current-buffer
81623
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
576 (find-file-noselect
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
577 (autoload-ensure-default-file (autoload-generated-file)))
2535
86d5500624d5 (update-file-autoloads, update-directory-autoloads): If called
Roland McGrath <roland@gnu.org>
parents: 2494
diff changeset
578 (save-excursion
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
579
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
580 ;; Canonicalize file names and remove the autoload file itself.
81622
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
581 (setq files (delete (file-relative-name buffer-file-name)
9d32dd7131c3 (autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81607
diff changeset
582 (mapcar 'file-relative-name files)))
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
583
14043
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
584 (goto-char (point-min))
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
585 (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
586 (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
587 (file (nth 3 form)))
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
588 (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
589 ;; 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
590 ;; 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
591 ;; Remove the obsolete section.
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
592 (autoload-remove-section (match-beginning 0))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
593 (let ((last-time (nth 4 form)))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
594 (dolist (file file)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
595 (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
596 (when (and file-time
55208
12f4731fd3aa (autoload-before-p): Remove.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
597 (not (time-less-p last-time file-time)))
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
598 ;; file unchanged
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
599 (push file no-autoloads)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
600 (setq files (delete file files)))))))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
601 ((not (stringp file)))
81790
8aa7f1b66163 (update-directory-autoloads): Remove duplicates without also removing
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81731
diff changeset
602 ((or (not (file-exists-p file))
8aa7f1b66163 (update-directory-autoloads): Remove duplicates without also removing
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81731
diff changeset
603 ;; Remove duplicates as well, just in case.
8aa7f1b66163 (update-directory-autoloads): Remove duplicates without also removing
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81731
diff changeset
604 (member file done))
8aa7f1b66163 (update-directory-autoloads): Remove duplicates without also removing
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81731
diff changeset
605 ;; Remove the obsolete section.
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
606 (autoload-remove-section (match-beginning 0)))
81731
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
607 ((not (time-less-p (nth 4 form)
6416cbdef0fa (autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81623
diff changeset
608 (nth 5 (file-attributes file))))
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
609 ;; File hasn't changed.
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
610 nil)
14043
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
611 (t
81623
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
612 (autoload-remove-section (match-beginning 0))
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
613 (if (autoload-generate-file-autoloads
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
614 file (current-buffer) buffer-file-name)
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
615 (push file no-autoloads))))
81790
8aa7f1b66163 (update-directory-autoloads): Remove duplicates without also removing
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81731
diff changeset
616 (push file done)
14043
d44a43c284e7 (update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents: 14022
diff changeset
617 (setq files (delete file files)))))
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
618 ;; Elements remaining in FILES have no existing autoload sections yet.
81623
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
619 (dolist (file files)
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
620 (if (autoload-generate-file-autoloads file nil buffer-file-name)
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
621 (push file no-autoloads)))
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
622
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
623 (when no-autoloads
48368
1fa683e2a917 (update-autoloads-from-directories): Sort the list of files with no
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48136
diff changeset
624 ;; Sort them for better readability.
1fa683e2a917 (update-autoloads-from-directories): Sort the list of files with no
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48136
diff changeset
625 (setq no-autoloads (sort no-autoloads 'string<))
39560
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
626 ;; Add the `no-autoloads' section.
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
627 (goto-char (point-max))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
628 (search-backward "\f" nil t)
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
629 (autoload-insert-section-header
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
630 (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
631 (insert generate-autoload-section-trailer))
a05ad383618d (autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
632
81623
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
633 (save-buffer)
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
634 ;; In case autoload entries were added to other files because of
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
635 ;; file-local autoload-generated-file settings.
835baa7a130c (autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81622
diff changeset
636 (autoload-save-buffers))))
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
637
66748
80aac6382ded (update-directory-autoloads): Add obsolete function alias.
Lars Hansen <larsh@soem.dk>
parents: 66015
diff changeset
638 (define-obsolete-function-alias 'update-autoloads-from-directories
80aac6382ded (update-directory-autoloads): Add obsolete function alias.
Lars Hansen <larsh@soem.dk>
parents: 66015
diff changeset
639 'update-directory-autoloads "22.1")
80aac6382ded (update-directory-autoloads): Add obsolete function alias.
Lars Hansen <larsh@soem.dk>
parents: 66015
diff changeset
640
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
641 ;;;###autoload
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
642 (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
643 "Update loaddefs.el autoloads in batch mode.
50815
4972b38db032 (batch-update-autoloads): Call `update-directory-autoloads'.
John Paul Wallington <jpw@pobox.com>
parents: 50806
diff changeset
644 Calls `update-directory-autoloads' on the command line arguments."
4972b38db032 (batch-update-autoloads): Call `update-directory-autoloads'.
John Paul Wallington <jpw@pobox.com>
parents: 50806
diff changeset
645 (apply 'update-directory-autoloads 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
646 (setq command-line-args-left nil))
473
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
647
999d0b38694e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
648 (provide 'autoload)
648
70b112526394 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 473
diff changeset
649
63785
1220f6122b90 (make-autoload): Add the :setter for defcustoms corresponding to minor modes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 61177
diff changeset
650 ;; arch-tag: 00244766-98f4-4767-bf42-8a22103441c6
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 648
diff changeset
651 ;;; autoload.el ends here