Mercurial > emacs
annotate lisp/emacs-lisp/autoload.el @ 111087:8d485e5aa143
Small autoloads fix.
* lisp/emacs-lisp/autoload.el (batch-update-autoloads): Update for
src/Makefile no longer being pre-processed.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Thu, 21 Oct 2010 20:32:46 -0700 |
parents | 280c8ae2476d |
children | 3655cc4062e4 |
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, |
107418
8aeda91ab827
* emacs-lisp/autoload.el (autoload-rubric): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
4 ;; 2004, 2005, 2006, 2007, 2008, 2009, 2010 |
8aeda91ab827
* emacs-lisp/autoload.el (autoload-rubric): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
5 ;; Free Software Foundation, Inc. |
14169 | 6 |
25278 | 7 ;; Author: Roland McGrath <roland@gnu.org> |
2247
2c7997f249eb
Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1975
diff
changeset
|
8 ;; Keywords: maint |
110015
280c8ae2476d
Add "Package:" file headers to denote built-in packages.
Chong Yidong <cyd@stupidchicken.com>
parents:
109837
diff
changeset
|
9 ;; Package: emacs |
846
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
811
diff
changeset
|
10 |
14169 | 11 ;; This file is part of GNU Emacs. |
12 | |
94655
90a2847062be
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94293
diff
changeset
|
13 ;; GNU Emacs is free software: you can redistribute it and/or modify |
14169 | 14 ;; it under the terms of the GNU General Public License as published by |
94655
90a2847062be
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94293
diff
changeset
|
15 ;; the Free Software Foundation, either version 3 of the License, or |
90a2847062be
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94293
diff
changeset
|
16 ;; (at your option) any later version. |
14169 | 17 |
18 ;; GNU Emacs is distributed in the hope that it will be useful, | |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 ;; GNU General Public License for more details. | |
22 | |
23 ;; You should have received a copy of the GNU General Public License | |
94655
90a2847062be
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94293
diff
changeset
|
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
473 | 25 |
7942 | 26 ;;; Commentary: |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
27 |
7437 | 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 |
105235
f2e56d1eff32
* menu-bar.el: Remove menu-bar-ediff-misc-menu from the Tools
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
47 (defvar generated-autoload-load-name nil |
f2e56d1eff32
* menu-bar.el: Remove menu-bar-ediff-misc-menu from the Tools
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
48 "Load name for `autoload' statements generated from autoload cookies. |
f2e56d1eff32
* menu-bar.el: Remove menu-bar-ediff-misc-menu from the Tools
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
49 If nil, this defaults to the file name, sans extension.") |
f2e56d1eff32
* menu-bar.el: Remove menu-bar-ediff-misc-menu from the Tools
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
50 ;;;###autoload |
f2e56d1eff32
* menu-bar.el: Remove menu-bar-ediff-misc-menu from the Tools
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
51 (put 'generated-autoload-load-name 'safe-local-variable 'stringp) |
f2e56d1eff32
* menu-bar.el: Remove menu-bar-ediff-misc-menu from the Tools
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
52 |
81590
ffabac9ec014
(autoload-generated-file): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75640
diff
changeset
|
53 ;; 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
|
54 ;; ";;;###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
|
55 (defvar generate-autoload-cookie ";;;###autoload" |
19170
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
56 "Magic comment indicating the following form should be autoloaded. |
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
57 Used by \\[update-file-autoloads]. This string should be |
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
58 meaningless to Lisp (e.g., a comment). |
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
59 |
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
60 This string is used: |
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
61 |
81590
ffabac9ec014
(autoload-generated-file): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75640
diff
changeset
|
62 \;;;###autoload |
19170
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
63 \(defun function-to-be-autoloaded () ...) |
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
64 |
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
65 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
|
66 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
|
67 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
|
68 |
105484
fe4228529c23
(autoload-excludes): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105372
diff
changeset
|
69 (defvar autoload-excludes nil |
fe4228529c23
(autoload-excludes): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105372
diff
changeset
|
70 "If non-nil, list of absolute file names not to scan for autoloads.") |
fe4228529c23
(autoload-excludes): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105372
diff
changeset
|
71 |
19170
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
72 (defconst generate-autoload-section-header "\f\n;;;### " |
21479
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
73 "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
|
74 |
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
75 (defconst generate-autoload-section-trailer "\n;;;***\n" |
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
76 "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
|
77 |
21479
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
78 (defconst generate-autoload-section-continuation ";;;;;; " |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
79 "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
|
80 |
81622
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
81 (defvar autoload-modified-buffers) ;Dynamically scoped var. |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
82 |
473 | 83 (defun make-autoload (form file) |
17750
f11a3a49088c
(defcustom): Add doc-string-elt property.
Richard M. Stallman <rms@gnu.org>
parents:
17591
diff
changeset
|
84 "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
|
85 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
|
86 or macro definition or a defcustom)." |
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
87 (let ((car (car-safe form)) expand) |
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
88 (cond |
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
89 ;; 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
|
90 ((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
|
91 define-globalized-minor-mode |
29549
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
92 easy-mmode-define-minor-mode define-minor-mode)) |
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
93 (setq expand (let ((load-file-name file)) (macroexpand form))) |
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
94 (eq (car expand) 'progn) |
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
95 (memq :autoload-end expand)) |
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
96 (let ((end (memq :autoload-end expand))) |
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
97 ;; Cut-off anything after the :autoload-end marker. |
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
98 (setcdr end nil) |
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
99 (cons 'progn |
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
100 (mapcar (lambda (form) (make-autoload form file)) |
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
101 (cdr expand))))) |
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
102 |
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
103 ;; For special function-like operators, use the `autoload' function. |
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
104 ((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
|
105 define-compilation-mode define-generic-mode |
cf5b42f7a962
(make-autoload): Add define-global-minor-mode.
Juri Linkov <juri@jurta.org>
parents:
67223
diff
changeset
|
106 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
|
107 define-globalized-minor-mode |
67291
cf5b42f7a962
(make-autoload): Add define-global-minor-mode.
Juri Linkov <juri@jurta.org>
parents:
67223
diff
changeset
|
108 easy-mmode-define-minor-mode define-minor-mode |
105235
f2e56d1eff32
* menu-bar.el: Remove menu-bar-ediff-misc-menu from the Tools
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
109 defun* defmacro* define-overloadable-function)) |
41811
0343ccd72be1
(make-autoload): Also generate autoloads for `defmacro*' forms.
Colin Walters <walters@gnu.org>
parents:
39763
diff
changeset
|
110 (let* ((macrop (memq car '(defmacro defmacro*))) |
29549
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
111 (name (nth 1 form)) |
51012
a7817088fe0d
(make-autoload): Add arglist for define-derived-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50815
diff
changeset
|
112 (args (case car |
109837
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
113 ((defun defmacro defun* defmacro* |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
114 define-overloadable-function) (nth 2 form)) |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
115 ((define-skeleton) '(&optional str arg)) |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
116 ((define-generic-mode define-derived-mode |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
117 define-compilation-mode) nil) |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
118 (t))) |
29549
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
119 (body (nthcdr (get car 'doc-string-elt) form)) |
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
120 (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
|
121 (when (listp args) |
a0d27828cf39
(make-autoload): Add usage info to docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42767
diff
changeset
|
122 ;; 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
|
123 ;; can recover it. |
a0d27828cf39
(make-autoload): Add usage info to docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42767
diff
changeset
|
124 (setq doc (help-add-fundoc-usage doc args))) |
109837
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
125 (let ((exp |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
126 ;; `define-generic-mode' quotes the name, so take care of that |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
127 (list 'autoload (if (listp name) name (list 'quote name)) |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
128 file doc |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
129 (or (and (memq car '(define-skeleton define-derived-mode |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
130 define-generic-mode |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
131 easy-mmode-define-global-mode |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
132 define-global-minor-mode |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
133 define-globalized-minor-mode |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
134 easy-mmode-define-minor-mode |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
135 define-minor-mode)) t) |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
136 (eq (car-safe (car body)) 'interactive)) |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
137 (if macrop (list 'quote 'macro) nil)))) |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
138 (when macrop |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
139 ;; Special case to autoload some of the macro's declarations. |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
140 (let ((decls (nth (if (stringp (nth 3 form)) 4 3) form)) |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
141 (exps '())) |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
142 (when (eq (car decls) 'declare) |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
143 ;; FIXME: We'd like to reuse macro-declaration-function, |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
144 ;; but we can't since it doesn't return anything. |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
145 (dolist (decl decls) |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
146 (case (car-safe decl) |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
147 (indent |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
148 (push `(put ',name 'lisp-indent-function ',(cadr decl)) |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
149 exps)) |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
150 (doc-string |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
151 (push `(put ',name 'doc-string-elt ',(cadr decl)) exps)))) |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
152 (when exps |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
153 (setq exp `(progn ,exp ,@exps)))))) |
b668431e0039
* lisp/emacs-lisp/autoload.el (make-autoload): Preload the macros's
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107894
diff
changeset
|
154 exp))) |
29549
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
155 |
105235
f2e56d1eff32
* menu-bar.el: Remove menu-bar-ediff-misc-menu from the Tools
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
156 ;; For defclass forms, use `eieio-defclass-autoload'. |
f2e56d1eff32
* menu-bar.el: Remove menu-bar-ediff-misc-menu from the Tools
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
157 ((eq car 'defclass) |
f2e56d1eff32
* menu-bar.el: Remove menu-bar-ediff-misc-menu from the Tools
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
158 (let ((name (nth 1 form)) |
f2e56d1eff32
* menu-bar.el: Remove menu-bar-ediff-misc-menu from the Tools
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
159 (superclasses (nth 2 form)) |
f2e56d1eff32
* menu-bar.el: Remove menu-bar-ediff-misc-menu from the Tools
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
160 (doc (nth 4 form))) |
f2e56d1eff32
* menu-bar.el: Remove menu-bar-ediff-misc-menu from the Tools
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
161 (list 'eieio-defclass-autoload (list 'quote name) |
f2e56d1eff32
* menu-bar.el: Remove menu-bar-ediff-misc-menu from the Tools
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
162 (list 'quote superclasses) file doc))) |
f2e56d1eff32
* menu-bar.el: Remove menu-bar-ediff-misc-menu from the Tools
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
163 |
49100
b418e4d949ac
(make-autoload): Generate custom-autoload for autoloaded defcustoms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48855
diff
changeset
|
164 ;; Convert defcustom to less space-consuming data. |
29549
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
165 ((eq car 'defcustom) |
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
166 (let ((varname (car-safe (cdr-safe form))) |
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
167 (init (car-safe (cdr-safe (cdr-safe form)))) |
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
168 (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
|
169 ;; (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
|
170 ) |
b418e4d949ac
(make-autoload): Generate custom-autoload for autoloaded defcustoms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48855
diff
changeset
|
171 `(progn |
b418e4d949ac
(make-autoload): Generate custom-autoload for autoloaded defcustoms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48855
diff
changeset
|
172 (defvar ,varname ,init ,doc) |
71955
e768c05d6e71
(make-autoload): Use new arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71874
diff
changeset
|
173 (custom-autoload ',varname ,file |
e768c05d6e71
(make-autoload): Use new arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71874
diff
changeset
|
174 ,(condition-case nil |
e768c05d6e71
(make-autoload): Use new arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71874
diff
changeset
|
175 (null (cadr (memq :set form))) |
e768c05d6e71
(make-autoload): Use new arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71874
diff
changeset
|
176 (error nil)))))) |
29549
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
177 |
67223
23fa76e60a61
(make-autoload): Handle defgroup specially.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66748
diff
changeset
|
178 ((eq car 'defgroup) |
23fa76e60a61
(make-autoload): Handle defgroup specially.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66748
diff
changeset
|
179 ;; 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
|
180 ;; 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
|
181 ;; a group. |
23fa76e60a61
(make-autoload): Handle defgroup specially.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66748
diff
changeset
|
182 (let ((groupname (nth 1 form))) |
23fa76e60a61
(make-autoload): Handle defgroup specially.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66748
diff
changeset
|
183 `(let ((loads (get ',groupname 'custom-loads))) |
23fa76e60a61
(make-autoload): Handle defgroup specially.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66748
diff
changeset
|
184 (if (member ',file loads) nil |
23fa76e60a61
(make-autoload): Handle defgroup specially.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66748
diff
changeset
|
185 (put ',groupname 'custom-loads (cons ',file loads)))))) |
23fa76e60a61
(make-autoload): Handle defgroup specially.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66748
diff
changeset
|
186 |
29549
eafd45bcdcc1
(make-autoload): Use `cond'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
29419
diff
changeset
|
187 ;; 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
|
188 (t nil)))) |
473 | 189 |
47664
a0d27828cf39
(make-autoload): Add usage info to docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42767
diff
changeset
|
190 ;; 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
|
191 ;; 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
|
192 ;; the doc-string in FORM. |
a0d27828cf39
(make-autoload): Add usage info to docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42767
diff
changeset
|
193 ;; 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
|
194 |
81590
ffabac9ec014
(autoload-generated-file): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75640
diff
changeset
|
195 (defun autoload-generated-file () |
ffabac9ec014
(autoload-generated-file): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75640
diff
changeset
|
196 (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
|
197 ;; 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
|
198 ;; 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
|
199 ;; of course. |
835baa7a130c
(autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81622
diff
changeset
|
200 (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
|
201 (expand-file-name "lisp" source-directory)))) |
473 | 202 |
5837
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
203 |
21479
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
204 (defun autoload-read-section-header () |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
205 "Read a section header form. |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
206 Since continuation lines have been marked as comments, |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
207 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
|
208 markers before we call `read'." |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
209 (save-match-data |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
210 (let ((beginning (point)) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
211 string) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
212 (forward-line 1) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
213 (while (looking-at generate-autoload-section-continuation) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
214 (forward-line 1)) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
215 (setq string (buffer-substring beginning (point))) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
216 (with-current-buffer (get-buffer-create " *autoload*") |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
217 (erase-buffer) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
218 (insert string) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
219 (goto-char (point-min)) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
220 (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
|
221 (replace-match " ")) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
222 (goto-char (point-min)) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
223 (read (current-buffer)))))) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
224 |
66015
4ad1dc6bc1e0
(update-directory-autoloads): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
64751
diff
changeset
|
225 (defvar autoload-print-form-outbuf nil |
4ad1dc6bc1e0
(update-directory-autoloads): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
64751
diff
changeset
|
226 "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
|
227 |
29416
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
228 (defun autoload-print-form (form) |
48718
c1ae448c795b
(autoload-print-form-outbuf): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48368
diff
changeset
|
229 "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
|
230 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
|
231 put the output in." |
29416
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
232 (cond |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
233 ;; If the form is a sequence, recurse. |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
234 ((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
|
235 ;; Symbols at the toplevel are meaningless. |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
236 ((symbolp form) nil) |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
237 (t |
48718
c1ae448c795b
(autoload-print-form-outbuf): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48368
diff
changeset
|
238 (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
|
239 (outbuf autoload-print-form-outbuf)) |
29416
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
240 (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
|
241 ;; We need to hack the printing because the |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
242 ;; doc-string must be printed specially for |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
243 ;; make-docfile (sigh). |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
244 (let* ((p (nthcdr (1- doc-string-elt) form)) |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
245 (elt (cdr p))) |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
246 (setcdr p nil) |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
247 (princ "\n(" outbuf) |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
248 (let ((print-escape-newlines t) |
82358
386452a14fe0
(autoload-print-form): Use print-quoted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
249 (print-quoted t) |
29416
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
250 (print-escape-nonascii t)) |
47867
f91cebb0f333
(autoload-print-form): Cleanup.
Richard M. Stallman <rms@gnu.org>
parents:
47664
diff
changeset
|
251 (dolist (elt form) |
f91cebb0f333
(autoload-print-form): Cleanup.
Richard M. Stallman <rms@gnu.org>
parents:
47664
diff
changeset
|
252 (prin1 elt outbuf) |
f91cebb0f333
(autoload-print-form): Cleanup.
Richard M. Stallman <rms@gnu.org>
parents:
47664
diff
changeset
|
253 (princ " " outbuf))) |
29416
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
254 (princ "\"\\\n" outbuf) |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
255 (let ((begin (with-current-buffer outbuf (point)))) |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
256 (princ (substring (prin1-to-string (car elt)) 1) |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
257 outbuf) |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
258 ;; Insert a backslash before each ( that |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
259 ;; appears at the beginning of a line in |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
260 ;; the doc string. |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
261 (with-current-buffer outbuf |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
262 (save-excursion |
47664
a0d27828cf39
(make-autoload): Add usage info to docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42767
diff
changeset
|
263 (while (re-search-backward "\n[[(]" begin t) |
29416
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
264 (forward-char 1) |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
265 (insert "\\")))) |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
266 (if (null (cdr elt)) |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
267 (princ ")" outbuf) |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
268 (princ " " outbuf) |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
269 (princ (substring (prin1-to-string (cdr elt)) 1) |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
270 outbuf)) |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
271 (terpri outbuf))) |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
272 (let ((print-escape-newlines t) |
82358
386452a14fe0
(autoload-print-form): Use print-quoted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
273 (print-quoted t) |
29416
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
274 (print-escape-nonascii t)) |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
275 (print form outbuf))))))) |
6d8ceb166666
(make-autoload): Simplify docstring.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28400
diff
changeset
|
276 |
105858
e413a8093e28
(autoload-rubric): Add optional feature arg.
Glenn Morris <rgm@gnu.org>
parents:
105842
diff
changeset
|
277 (defun autoload-rubric (file &optional type feature) |
95558
8c1e2d447217
(autoload-rubric): New function, extracted from autoload-ensure-default-file.
Glenn Morris <rgm@gnu.org>
parents:
94738
diff
changeset
|
278 "Return a string giving the appropriate autoload rubric for FILE. |
8c1e2d447217
(autoload-rubric): New function, extracted from autoload-ensure-default-file.
Glenn Morris <rgm@gnu.org>
parents:
94738
diff
changeset
|
279 TYPE (default \"autoloads\") is a string stating the type of |
105858
e413a8093e28
(autoload-rubric): Add optional feature arg.
Glenn Morris <rgm@gnu.org>
parents:
105842
diff
changeset
|
280 information contained in FILE. If FEATURE is non-nil, FILE |
e413a8093e28
(autoload-rubric): Add optional feature arg.
Glenn Morris <rgm@gnu.org>
parents:
105842
diff
changeset
|
281 will provide a feature. FEATURE may be a string naming the |
107418
8aeda91ab827
* emacs-lisp/autoload.el (autoload-rubric): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
282 feature, otherwise it will be based on FILE's name. |
8aeda91ab827
* emacs-lisp/autoload.el (autoload-rubric): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
283 |
8aeda91ab827
* emacs-lisp/autoload.el (autoload-rubric): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
284 At present, a feature is in fact always provided, but this should |
8aeda91ab827
* emacs-lisp/autoload.el (autoload-rubric): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
285 not be relied upon." |
95558
8c1e2d447217
(autoload-rubric): New function, extracted from autoload-ensure-default-file.
Glenn Morris <rgm@gnu.org>
parents:
94738
diff
changeset
|
286 (let ((basename (file-name-nondirectory file))) |
8c1e2d447217
(autoload-rubric): New function, extracted from autoload-ensure-default-file.
Glenn Morris <rgm@gnu.org>
parents:
94738
diff
changeset
|
287 (concat ";;; " basename |
8c1e2d447217
(autoload-rubric): New function, extracted from autoload-ensure-default-file.
Glenn Morris <rgm@gnu.org>
parents:
94738
diff
changeset
|
288 " --- automatically extracted " (or type "autoloads") "\n" |
8c1e2d447217
(autoload-rubric): New function, extracted from autoload-ensure-default-file.
Glenn Morris <rgm@gnu.org>
parents:
94738
diff
changeset
|
289 ";;\n" |
8c1e2d447217
(autoload-rubric): New function, extracted from autoload-ensure-default-file.
Glenn Morris <rgm@gnu.org>
parents:
94738
diff
changeset
|
290 ";;; Code:\n\n" |
8c1e2d447217
(autoload-rubric): New function, extracted from autoload-ensure-default-file.
Glenn Morris <rgm@gnu.org>
parents:
94738
diff
changeset
|
291 "\n" |
107418
8aeda91ab827
* emacs-lisp/autoload.el (autoload-rubric): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
292 ;; This is used outside of autoload.el, eg cus-dep, finder. |
105886
544761863e24
* emacs-lisp/autoload.el (autoload-rubric): Always issue a provide
Chong Yidong <cyd@stupidchicken.com>
parents:
105858
diff
changeset
|
293 "(provide '" |
544761863e24
* emacs-lisp/autoload.el (autoload-rubric): Always issue a provide
Chong Yidong <cyd@stupidchicken.com>
parents:
105858
diff
changeset
|
294 (if (stringp feature) |
544761863e24
* emacs-lisp/autoload.el (autoload-rubric): Always issue a provide
Chong Yidong <cyd@stupidchicken.com>
parents:
105858
diff
changeset
|
295 feature |
544761863e24
* emacs-lisp/autoload.el (autoload-rubric): Always issue a provide
Chong Yidong <cyd@stupidchicken.com>
parents:
105858
diff
changeset
|
296 (file-name-sans-extension basename)) |
544761863e24
* emacs-lisp/autoload.el (autoload-rubric): Always issue a provide
Chong Yidong <cyd@stupidchicken.com>
parents:
105858
diff
changeset
|
297 ")\n" |
95558
8c1e2d447217
(autoload-rubric): New function, extracted from autoload-ensure-default-file.
Glenn Morris <rgm@gnu.org>
parents:
94738
diff
changeset
|
298 ";; Local Variables:\n" |
8c1e2d447217
(autoload-rubric): New function, extracted from autoload-ensure-default-file.
Glenn Morris <rgm@gnu.org>
parents:
94738
diff
changeset
|
299 ";; version-control: never\n" |
8c1e2d447217
(autoload-rubric): New function, extracted from autoload-ensure-default-file.
Glenn Morris <rgm@gnu.org>
parents:
94738
diff
changeset
|
300 ";; no-byte-compile: t\n" |
8c1e2d447217
(autoload-rubric): New function, extracted from autoload-ensure-default-file.
Glenn Morris <rgm@gnu.org>
parents:
94738
diff
changeset
|
301 ";; no-update-autoloads: t\n" |
95771
b661c50a0f77
(autoload-rubric): Fix coding cookie not to force Unix EOL.
Juanma Barranquero <lekktu@gmail.com>
parents:
95751
diff
changeset
|
302 ";; coding: utf-8\n" |
95558
8c1e2d447217
(autoload-rubric): New function, extracted from autoload-ensure-default-file.
Glenn Morris <rgm@gnu.org>
parents:
94738
diff
changeset
|
303 ";; End:\n" |
8c1e2d447217
(autoload-rubric): New function, extracted from autoload-ensure-default-file.
Glenn Morris <rgm@gnu.org>
parents:
94738
diff
changeset
|
304 ";;; " basename |
8c1e2d447217
(autoload-rubric): New function, extracted from autoload-ensure-default-file.
Glenn Morris <rgm@gnu.org>
parents:
94738
diff
changeset
|
305 " ends here\n"))) |
8c1e2d447217
(autoload-rubric): New function, extracted from autoload-ensure-default-file.
Glenn Morris <rgm@gnu.org>
parents:
94738
diff
changeset
|
306 |
39560
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
307 (defun autoload-ensure-default-file (file) |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
308 "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
|
309 (unless (file-exists-p file) |
95558
8c1e2d447217
(autoload-rubric): New function, extracted from autoload-ensure-default-file.
Glenn Morris <rgm@gnu.org>
parents:
94738
diff
changeset
|
310 (write-region (autoload-rubric file) nil file)) |
39560
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
311 file) |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
312 |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
313 (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
|
314 "Insert the section-header line, |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
315 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
|
316 (insert generate-autoload-section-header) |
81622
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
317 (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
|
318 outbuf) |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
319 (terpri outbuf) |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
320 ;; 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
|
321 ;; 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
|
322 (with-current-buffer outbuf |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
323 (save-excursion |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
324 (forward-line -1) |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
325 (while (not (eolp)) |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
326 (move-to-column 64) |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
327 (skip-chars-forward "^ \n") |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
328 (or (eolp) |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
329 (insert "\n" generate-autoload-section-continuation)))))) |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
330 |
71047
e98e3d0ee915
(autoload-find-file): New fun. This one calls hack-local-variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69167
diff
changeset
|
331 (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
|
332 "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
|
333 ;; 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
|
334 (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
|
335 (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
|
336 (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
|
337 (erase-buffer) |
e98e3d0ee915
(autoload-find-file): New fun. This one calls hack-local-variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69167
diff
changeset
|
338 (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
|
339 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
|
340 (emacs-lisp-mode) |
81590
ffabac9ec014
(autoload-generated-file): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75640
diff
changeset
|
341 (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
|
342 (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
|
343 (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
|
344 (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
|
345 (current-buffer))) |
e98e3d0ee915
(autoload-find-file): New fun. This one calls hack-local-variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69167
diff
changeset
|
346 |
71048
29150c5d541b
(no-update-autoloads): Declare.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71047
diff
changeset
|
347 (defvar no-update-autoloads nil |
29150c5d541b
(no-update-autoloads): Declare.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71047
diff
changeset
|
348 "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
|
349 |
81590
ffabac9ec014
(autoload-generated-file): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75640
diff
changeset
|
350 (defun autoload-file-load-name (file) |
107894
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
351 "Compute the name that will be used to load FILE." |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
352 ;; OUTFILE should be the name of the global loaddefs.el file, which |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
353 ;; is expected to be at the root directory of the files we're |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
354 ;; scanning for autoloads and will be in the `load-path'. |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
355 (let* ((outfile (default-value 'generated-autoload-file)) |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
356 (name (file-relative-name file (file-name-directory outfile))) |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
357 (names '()) |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
358 (dir (file-name-directory outfile))) |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
359 ;; If `name' has directory components, only keep the |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
360 ;; last few that are really needed. |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
361 (while name |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
362 (setq name (directory-file-name name)) |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
363 (push (file-name-nondirectory name) names) |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
364 (setq name (file-name-directory name))) |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
365 (while (not name) |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
366 (cond |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
367 ((null (cdr names)) (setq name (car names))) |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
368 ((file-exists-p (expand-file-name "subdirs.el" dir)) |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
369 ;; FIXME: here we only check the existence of subdirs.el, |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
370 ;; without checking its content. This makes it generate wrong load |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
371 ;; names for cases like lisp/term which is not added to load-path. |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
372 (setq dir (expand-file-name (pop names) dir))) |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
373 (t (setq name (mapconcat 'identity names "/"))))) |
81590
ffabac9ec014
(autoload-generated-file): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75640
diff
changeset
|
374 (if (string-match "\\.elc?\\(\\.\\|\\'\\)" name) |
ffabac9ec014
(autoload-generated-file): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75640
diff
changeset
|
375 (substring name 0 (match-beginning 0)) |
ffabac9ec014
(autoload-generated-file): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75640
diff
changeset
|
376 name))) |
ffabac9ec014
(autoload-generated-file): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75640
diff
changeset
|
377 |
473 | 378 (defun generate-file-autoloads (file) |
379 "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
|
380 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
|
381 marked by `generate-autoload-cookie' (which see). |
473 | 382 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
|
383 are used. |
29150c5d541b
(no-update-autoloads): Declare.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71047
diff
changeset
|
384 Return non-nil in the case where no autoloads were added at point." |
473 | 385 (interactive "fGenerate autoloads for file: ") |
81603
6a5ecb520686
Refactor for upcoming changes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81602
diff
changeset
|
386 (autoload-generate-file-autoloads file (current-buffer))) |
6a5ecb520686
Refactor for upcoming changes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81602
diff
changeset
|
387 |
107894
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
388 (defvar print-readably) |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
389 |
81623
835baa7a130c
(autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81622
diff
changeset
|
390 ;; 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
|
391 ;; `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
|
392 ;; `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
|
393 ;; `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
|
394 ;; `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
|
395 ;; `generated-autoload-file'. |
835baa7a130c
(autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81622
diff
changeset
|
396 (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
|
397 "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
|
398 Autoloads are generated for defuns and defmacros in FILE |
6a5ecb520686
Refactor for upcoming changes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81602
diff
changeset
|
399 marked by `generate-autoload-cookie' (which see). |
6a5ecb520686
Refactor for upcoming changes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81602
diff
changeset
|
400 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
|
401 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
|
402 If OUTBUF is nil, it will be determined by `autoload-generated-file'. |
727 | 403 |
81623
835baa7a130c
(autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81622
diff
changeset
|
404 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
|
405 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
|
406 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
|
407 |
94738
9a5b7d040f2b
(autoload-generate-file-autoloads): Don't use `iff' in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
94655
diff
changeset
|
408 Return non-nil if and only if FILE adds no autoloads to OUTFILE |
81623
835baa7a130c
(autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81622
diff
changeset
|
409 \(or OUTBUF if OUTFILE is nil)." |
81622
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
410 (catch 'done |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
411 (let ((autoloads-done '()) |
105235
f2e56d1eff32
* menu-bar.el: Remove menu-bar-ediff-misc-menu from the Tools
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
412 load-name |
81622
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
413 (print-length nil) |
94293 | 414 (print-level nil) |
81622
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
415 (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
|
416 (float-output-format nil) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
417 (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
|
418 (otherbuf nil) |
81622
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
419 (absfile (expand-file-name file)) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
420 ;; nil until we found a cookie. |
107894
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
421 output-start ostart) |
81622
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
422 (with-current-buffer (or visited |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
423 ;; It is faster to avoid visiting the file. |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
424 (autoload-find-file file)) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
425 ;; Obey the no-update-autoloads file local variable. |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
426 (unless no-update-autoloads |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
427 (message "Generating autoloads for %s..." file) |
105235
f2e56d1eff32
* menu-bar.el: Remove menu-bar-ediff-misc-menu from the Tools
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
428 (setq load-name |
f2e56d1eff32
* menu-bar.el: Remove menu-bar-ediff-misc-menu from the Tools
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
429 (if (stringp generated-autoload-load-name) |
f2e56d1eff32
* menu-bar.el: Remove menu-bar-ediff-misc-menu from the Tools
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
430 generated-autoload-load-name |
107894
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
431 (autoload-file-load-name absfile))) |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
432 (when (and outfile |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
433 (not (equal outfile (autoload-generated-file)))) |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
434 (setq otherbuf t)) |
81622
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
435 (save-excursion |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
436 (save-restriction |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
437 (widen) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
438 (goto-char (point-min)) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
439 (while (not (eobp)) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
440 (skip-chars-forward " \t\n\f") |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
441 (cond |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
442 ((looking-at (regexp-quote generate-autoload-cookie)) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
443 ;; 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
|
444 (unless output-start |
107894
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
445 (let ((outbuf |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
446 (or (if otherbuf |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
447 ;; A file-local setting of |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
448 ;; autoload-generated-file says we |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
449 ;; should ignore OUTBUF. |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
450 nil |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
451 outbuf) |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
452 (autoload-find-destination absfile load-name) |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
453 ;; The file has autoload cookies, but they're |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
454 ;; already up-to-date. If OUTFILE is nil, the |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
455 ;; entries are in the expected OUTBUF, |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
456 ;; otherwise they're elsewhere. |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
457 (throw 'done otherbuf)))) |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
458 (with-current-buffer outbuf |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
459 (setq output-start (point-marker) |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
460 ostart (point))))) |
81622
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
461 (search-forward generate-autoload-cookie) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
462 (skip-chars-forward " \t") |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
463 (if (eolp) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
464 (condition-case err |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
465 ;; Read the next form and make an autoload. |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
466 (let* ((form (prog1 (read (current-buffer)) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
467 (or (bolp) (forward-line 1)))) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
468 (autoload (make-autoload form load-name))) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
469 (if autoload |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
470 (push (nth 1 form) autoloads-done) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
471 (setq autoload form)) |
107894
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
472 (let ((autoload-print-form-outbuf |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
473 (marker-buffer output-start))) |
81622
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
474 (autoload-print-form autoload))) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
475 (error |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
476 (message "Error in %s: %S" file err))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49100
diff
changeset
|
477 |
81622
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
478 ;; 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
|
479 (princ (buffer-substring |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
480 (progn |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
481 ;; Back up over whitespace, to preserve it. |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
482 (skip-chars-backward " \f\t") |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
483 (if (= (char-after (1+ (point))) ? ) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
484 ;; Eat one space. |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
485 (forward-char 1)) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
486 (point)) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
487 (progn (forward-line 1) (point))) |
107894
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
488 (marker-buffer output-start)))) |
81622
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
489 ((looking-at ";") |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
490 ;; Don't read the comment. |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
491 (forward-line 1)) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
492 (t |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
493 (forward-sexp 1) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
494 (forward-line 1)))))) |
71048
29150c5d541b
(no-update-autoloads): Declare.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
71047
diff
changeset
|
495 |
81622
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
496 (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
|
497 (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
|
498 (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
|
499 (current-buffer)))) |
107894
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
500 (with-current-buffer (marker-buffer 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
|
501 (save-excursion |
6416cbdef0fa
(autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81623
diff
changeset
|
502 ;; 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
|
503 ;; and which functions are in it, etc. |
107894
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
504 (assert (= ostart 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
|
505 (goto-char output-start) |
107894
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
506 (let ((relfile (file-relative-name absfile))) |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
507 (autoload-insert-section-header |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
508 (marker-buffer output-start) |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
509 autoloads-done load-name relfile |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
510 (if secondary-autoloads-file-buf |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
511 ;; MD5 checksums are much better because they do not |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
512 ;; change unless the file changes (so they'll be |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
513 ;; equal on two different systems and will change |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
514 ;; less often than time-stamps, thus leading to fewer |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
515 ;; unneeded changes causing spurious conflicts), but |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
516 ;; using time-stamps is a very useful optimization, |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
517 ;; so we use time-stamps for the main autoloads file |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
518 ;; (loaddefs.el) where we have special ways to |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
519 ;; circumvent the "random change problem", and MD5 |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
520 ;; checksum in secondary autoload files where we do |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
521 ;; not need the time-stamp optimization because it is |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
522 ;; already provided by the primary autoloads file. |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
523 (md5 secondary-autoloads-file-buf |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
524 ;; We'd really want to just use |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
525 ;; `emacs-internal' instead. |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
526 nil nil 'emacs-mule-unix) |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
527 (nth 5 (file-attributes relfile)))) |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
528 (insert ";;; Generated autoloads from " relfile "\n"))) |
81731
6416cbdef0fa
(autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81623
diff
changeset
|
529 (insert generate-autoload-section-trailer)))) |
81622
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
530 (message "Generating autoloads for %s...done" file)) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
531 (or visited |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
532 ;; We created this buffer, so we should kill it. |
106519
ee0a7551c875
Let loaddefs.el adjust to changes in autoload-excludes (bug#5162).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105886
diff
changeset
|
533 (kill-buffer (current-buffer)))) |
107894
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
534 (or (not output-start) |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
535 ;; If the entries were added to some other buffer, then the file |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
536 ;; doesn't add entries to OUTFILE. |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
537 otherbuf)))) |
2535
86d5500624d5
(update-file-autoloads, update-directory-autoloads): If called
Roland McGrath <roland@gnu.org>
parents:
2494
diff
changeset
|
538 |
81604
feafa882a0cf
(autoload-modified-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81603
diff
changeset
|
539 (defun autoload-save-buffers () |
feafa882a0cf
(autoload-modified-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81603
diff
changeset
|
540 (while autoload-modified-buffers |
feafa882a0cf
(autoload-modified-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81603
diff
changeset
|
541 (with-current-buffer (pop autoload-modified-buffers) |
feafa882a0cf
(autoload-modified-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81603
diff
changeset
|
542 (save-buffer)))) |
feafa882a0cf
(autoload-modified-buffers): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81603
diff
changeset
|
543 |
473 | 544 ;;;###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
|
545 (defun update-file-autoloads (file &optional save-after) |
473 | 546 "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
|
547 \(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
|
548 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
|
549 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
|
550 |
52307ec50b54
(update-file-autoloads): Don't use interactive-p; take new arg SAVE-AFTER.
Richard M. Stallman <rms@gnu.org>
parents:
56995
diff
changeset
|
551 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
|
552 (interactive "fUpdate autoloads for file: \np") |
81622
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
553 (let* ((autoload-modified-buffers nil) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
554 (no-autoloads (autoload-generate-file-autoloads file))) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
555 (if autoload-modified-buffers |
81607
56b815dd1abb
(autoload-generate-file-autoloads): Make `outbuf' optional.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81604
diff
changeset
|
556 (if save-after (autoload-save-buffers)) |
105372
bd2966850aac
Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents:
105235
diff
changeset
|
557 (if (called-interactively-p 'interactive) |
81607
56b815dd1abb
(autoload-generate-file-autoloads): Make `outbuf' optional.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81604
diff
changeset
|
558 (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
|
559 (if no-autoloads file))) |
39560
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
560 |
107894
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
561 (defun autoload-find-destination (file load-name) |
81602
ea507ef94ad6
Refactor for upcoming changes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81590
diff
changeset
|
562 "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
|
563 FILE is the file name of the current buffer. |
ea507ef94ad6
Refactor for upcoming changes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81590
diff
changeset
|
564 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
|
565 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
|
566 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
|
567 (catch 'up-to-date |
107894
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
568 (let* ((buf (current-buffer)) |
81731
6416cbdef0fa
(autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81623
diff
changeset
|
569 (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
|
570 (found nil)) |
81622
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
571 (with-current-buffer |
92710
123ee50ab055
(autoload-find-destination): Don't force raw-text.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
572 ;; We used to use `raw-text' to read this file, but this causes |
123ee50ab055
(autoload-find-destination): Don't force raw-text.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
573 ;; problems when the file contains non-ASCII characters. |
123ee50ab055
(autoload-find-destination): Don't force raw-text.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
574 (find-file-noselect |
123ee50ab055
(autoload-find-destination): Don't force raw-text.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
575 (autoload-ensure-default-file (autoload-generated-file))) |
81622
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
576 ;; 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
|
577 ;; that it is portable to all platforms. |
92710
123ee50ab055
(autoload-find-destination): Don't force raw-text.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
578 (unless (zerop (coding-system-eol-type buffer-file-coding-system)) |
123ee50ab055
(autoload-find-destination): Don't force raw-text.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
579 (set-buffer-file-coding-system 'unix)) |
81622
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
580 (or (> (buffer-size) 0) |
107894
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
581 (error "Autoloads file %s lacks boilerplate" buffer-file-name)) |
81622
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
582 (or (file-writable-p buffer-file-name) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
583 (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
|
584 (widen) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
585 (goto-char (point-min)) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
586 ;; Look for the section for LOAD-NAME. |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
587 (while (and (not found) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
588 (search-forward generate-autoload-section-header nil t)) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
589 (let ((form (autoload-read-section-header))) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
590 (cond ((string= (nth 2 form) load-name) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
591 ;; We found the section for this file. |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
592 ;; Check if it is up to date. |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
593 (let ((begin (match-beginning 0)) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
594 (last-time (nth 4 form)) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
595 (file-time (nth 5 (file-attributes file)))) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
596 (if (and (or (null existing-buffer) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
597 (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
|
598 (or |
6416cbdef0fa
(autoload-find-destination): Understand a new format of autoload block where
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81623
diff
changeset
|
599 ;; 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
|
600 ;; 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
|
601 ;; 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
|
602 (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
|
603 (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
|
604 ;; 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
|
605 (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
|
606 (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
|
607 (md5 buf nil nil 'emacs-mule))))) |
81622
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
608 (throw 'up-to-date nil) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
609 (autoload-remove-section begin) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
610 (setq found t)))) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
611 ((string< load-name (nth 2 form)) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
612 ;; 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
|
613 ;; 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
|
614 ;; 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
|
615 ;; insert one before the section here. |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
616 (goto-char (match-beginning 0)) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
617 (setq found t))))) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
618 (or found |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
619 (progn |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
620 ;; 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
|
621 (goto-char (point-max)) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
622 (search-backward "\f" nil t))) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
623 (unless (memq (current-buffer) autoload-modified-buffers) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
624 (push (current-buffer) autoload-modified-buffers)) |
9d32dd7131c3
(autoload-find-destination): Return nil
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81607
diff
changeset
|
625 (current-buffer))))) |
39560
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
626 |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
627 (defun autoload-remove-section (begin) |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
628 (goto-char begin) |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
629 (search-forward generate-autoload-section-trailer) |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
630 (delete-region begin (point))) |
473 | 631 |
632 ;;;###autoload | |
50806
50dd49abb157
(update-directory-autoloads): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
49598
diff
changeset
|
633 (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
|
634 "\ |
17851
6e7bb77cd7e1
(update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
17750
diff
changeset
|
635 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
|
636 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
|
637 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
|
638 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
|
639 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
|
640 |
50dd49abb157
(update-directory-autoloads): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
49598
diff
changeset
|
641 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
|
642 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
|
643 (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
|
644 (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
|
645 (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
|
646 (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
|
647 (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
|
648 (files (apply 'nconc |
39560
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
649 (mapcar (lambda (dir) |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
650 (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
|
651 t files-re)) |
39560
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
652 dirs))) |
81790
8aa7f1b66163
(update-directory-autoloads): Remove duplicates without also removing
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81731
diff
changeset
|
653 (done ()) |
39560
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
654 (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
|
655 ;; 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
|
656 ;; 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
|
657 (no-autoloads nil) |
835baa7a130c
(autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81622
diff
changeset
|
658 (autoload-modified-buffers nil)) |
39560
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
659 |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
660 (with-current-buffer |
81623
835baa7a130c
(autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81622
diff
changeset
|
661 (find-file-noselect |
835baa7a130c
(autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81622
diff
changeset
|
662 (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
|
663 (save-excursion |
39560
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
664 |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
665 ;; 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
|
666 (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
|
667 (mapcar 'file-relative-name files))) |
39560
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
668 |
14043
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
669 (goto-char (point-min)) |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
670 (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
|
671 (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
|
672 (file (nth 3 form))) |
39560
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
673 (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
|
674 ;; 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
|
675 ;; 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
|
676 ;; Remove the obsolete section. |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
677 (autoload-remove-section (match-beginning 0)) |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
678 (let ((last-time (nth 4 form))) |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
679 (dolist (file file) |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
680 (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
|
681 (when (and file-time |
55208
12f4731fd3aa
(autoload-before-p): Remove.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
682 (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
|
683 ;; file unchanged |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
684 (push file no-autoloads) |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
685 (setq files (delete file files))))))) |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
686 ((not (stringp file))) |
81790
8aa7f1b66163
(update-directory-autoloads): Remove duplicates without also removing
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81731
diff
changeset
|
687 ((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
|
688 ;; Remove duplicates as well, just in case. |
106519
ee0a7551c875
Let loaddefs.el adjust to changes in autoload-excludes (bug#5162).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105886
diff
changeset
|
689 (member file done) |
ee0a7551c875
Let loaddefs.el adjust to changes in autoload-excludes (bug#5162).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105886
diff
changeset
|
690 ;; If the file is actually excluded. |
ee0a7551c875
Let loaddefs.el adjust to changes in autoload-excludes (bug#5162).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105886
diff
changeset
|
691 (member (expand-file-name file) autoload-excludes)) |
81790
8aa7f1b66163
(update-directory-autoloads): Remove duplicates without also removing
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81731
diff
changeset
|
692 ;; Remove the obsolete section. |
39560
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
693 (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
|
694 ((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
|
695 (nth 5 (file-attributes file)))) |
39560
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
696 ;; File hasn't changed. |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
697 nil) |
14043
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
698 (t |
81623
835baa7a130c
(autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81622
diff
changeset
|
699 (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
|
700 (if (autoload-generate-file-autoloads |
107894
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
701 ;; Passing `current-buffer' makes it insert at point. |
81623
835baa7a130c
(autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81622
diff
changeset
|
702 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
|
703 (push file no-autoloads)))) |
81790
8aa7f1b66163
(update-directory-autoloads): Remove duplicates without also removing
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81731
diff
changeset
|
704 (push file done) |
14043
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
705 (setq files (delete file files))))) |
39560
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
706 ;; 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
|
707 (dolist (file files) |
106519
ee0a7551c875
Let loaddefs.el adjust to changes in autoload-excludes (bug#5162).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105886
diff
changeset
|
708 (cond |
ee0a7551c875
Let loaddefs.el adjust to changes in autoload-excludes (bug#5162).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105886
diff
changeset
|
709 ((member (expand-file-name file) autoload-excludes) nil) |
107894
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
710 ;; Passing nil as second argument forces |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
711 ;; autoload-generate-file-autoloads to look for the right |
9b05dc529495
Fix duplicate entries in cedet's loaddefs.el files.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107418
diff
changeset
|
712 ;; spot where to insert each autoloads section. |
106519
ee0a7551c875
Let loaddefs.el adjust to changes in autoload-excludes (bug#5162).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105886
diff
changeset
|
713 ((autoload-generate-file-autoloads file nil buffer-file-name) |
ee0a7551c875
Let loaddefs.el adjust to changes in autoload-excludes (bug#5162).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105886
diff
changeset
|
714 (push file no-autoloads)))) |
81623
835baa7a130c
(autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81622
diff
changeset
|
715 |
39560
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
716 (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
|
717 ;; 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
|
718 (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
|
719 ;; Add the `no-autoloads' section. |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
720 (goto-char (point-max)) |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
721 (search-backward "\f" nil t) |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
722 (autoload-insert-section-header |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
723 (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
|
724 (insert generate-autoload-section-trailer)) |
a05ad383618d
(autoload-ensure-default-file, autoload-insert-section-header)
Gerd Moellmann <gerd@gnu.org>
parents:
38436
diff
changeset
|
725 |
81623
835baa7a130c
(autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81622
diff
changeset
|
726 (save-buffer) |
835baa7a130c
(autoload-generated-file): Interpret names relative to current dir
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81622
diff
changeset
|
727 ;; 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
|
728 ;; 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
|
729 (autoload-save-buffers)))) |
473 | 730 |
66748
80aac6382ded
(update-directory-autoloads): Add obsolete function alias.
Lars Hansen <larsh@soem.dk>
parents:
66015
diff
changeset
|
731 (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
|
732 'update-directory-autoloads "22.1") |
80aac6382ded
(update-directory-autoloads): Add obsolete function alias.
Lars Hansen <larsh@soem.dk>
parents:
66015
diff
changeset
|
733 |
105605
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
734 (defvar autoload-make-program (or (getenv "MAKE") "make") |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
735 "Name of the make program in use during the Emacs build process.") |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
736 |
473 | 737 ;;;###autoload |
738 (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
|
739 "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
|
740 Calls `update-directory-autoloads' on the command line arguments." |
105501
e3e540de3898
(batch-update-autoloads): Rather than having the list of preloaded
Glenn Morris <rgm@gnu.org>
parents:
105484
diff
changeset
|
741 ;; For use during the Emacs build process only. |
e3e540de3898
(batch-update-autoloads): Rather than having the list of preloaded
Glenn Morris <rgm@gnu.org>
parents:
105484
diff
changeset
|
742 (unless autoload-excludes |
e3e540de3898
(batch-update-autoloads): Rather than having the list of preloaded
Glenn Morris <rgm@gnu.org>
parents:
105484
diff
changeset
|
743 (let* ((ldir (file-name-directory generated-autoload-file)) |
105605
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
744 (default-directory |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
745 (file-name-as-directory |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
746 (expand-file-name (if (eq system-type 'windows-nt) |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
747 "../lib-src" |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
748 "../src") ldir))) |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
749 (mfile "Makefile") |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
750 (tmpfile "echolisp.tmp") |
105501
e3e540de3898
(batch-update-autoloads): Rather than having the list of preloaded
Glenn Morris <rgm@gnu.org>
parents:
105484
diff
changeset
|
751 lim) |
105605
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
752 ;; Windows uses the 'echolisp' approach because: |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
753 ;; i) It does not have $lisp as a single simple definition, so |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
754 ;; it would be harder to parse the Makefile. |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
755 ;; ii) It can, since it already has $lisp broken up into pieces |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
756 ;; that the command-line can handle. |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
757 ;; Non-Windows builds do not use the 'echolisp' approach because |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
758 ;; no-one knows (?) the maximum safe command-line length on all |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
759 ;; supported systems. $lisp is much longer there since it uses |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
760 ;; absolute paths, and it would seem a shame to split it just for this. |
105501
e3e540de3898
(batch-update-autoloads): Rather than having the list of preloaded
Glenn Morris <rgm@gnu.org>
parents:
105484
diff
changeset
|
761 (when (file-readable-p mfile) |
105605
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
762 (if (eq system-type 'windows-nt) |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
763 (when (ignore-errors |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
764 (if (file-exists-p tmpfile) (delete-file tmpfile)) |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
765 ;; FIXME call-process is better, if it works. |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
766 (shell-command (format "%s echolisp > %s" |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
767 autoload-make-program tmpfile)) |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
768 (file-readable-p tmpfile)) |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
769 (with-temp-buffer |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
770 (insert-file-contents tmpfile) |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
771 ;; FIXME could be a single while loop. |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
772 (while (not (eobp)) |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
773 (setq lim (line-end-position)) |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
774 (while (re-search-forward "\\([^ ]+\\.el\\)c?\\>" lim t) |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
775 (push (expand-file-name (match-string 1)) |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
776 autoload-excludes)) |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
777 (forward-line 1)))) |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
778 (with-temp-buffer |
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
779 (insert-file-contents mfile) |
106602
2a684c6f926c
(batch-update-autoloads): Only exclude
Andreas Schwab <schwab@linux-m68k.org>
parents:
106519
diff
changeset
|
780 (when (re-search-forward "^shortlisp= " nil t) |
111087 | 781 (while (and (not lim) |
782 (re-search-forward "\\.\\./lisp/\\([^ ]+\\.el\\)c?\\>" | |
783 nil t)) | |
105605
97edf9210d35
(autoload-make-program): New variable.
Glenn Morris <rgm@gnu.org>
parents:
105515
diff
changeset
|
784 (push (expand-file-name (match-string 1) ldir) |
111087 | 785 autoload-excludes) |
786 (skip-chars-forward " \t") | |
787 (if (eolp) (setq lim t))))))))) | |
90854 | 788 (let ((args command-line-args-left)) |
789 (setq command-line-args-left nil) | |
790 (apply 'update-directory-autoloads args))) | |
473 | 791 |
792 (provide 'autoload) | |
648 | 793 |
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
648
diff
changeset
|
794 ;;; autoload.el ends here |