Mercurial > emacs
annotate lisp/emacs-lisp/autoload.el @ 28472:bae9218986ac
* composite.c (run_composite_function): Use NILP when checking for nil.
(syms_of_composite): Delete local var NARGS, pass an int as first argument to
Fmake_hash_table.
author | Ken Raeburn <raeburn@raeburn.org> |
---|---|
date | Sun, 02 Apr 2000 02:42:12 +0000 |
parents | 206604013d7f |
children | 6d8ceb166666 |
rev | line source |
---|---|
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
648
diff
changeset
|
1 ;;; autoload.el --- maintain autoloads in loaddefs.el. |
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
648
diff
changeset
|
2 |
16995
22c9b578e220
(update-autoloads-from-directory): Get absolute file names from
Roland McGrath <roland@gnu.org>
parents:
16158
diff
changeset
|
3 ;; Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc. |
14169 | 4 |
25278 | 5 ;; Author: Roland McGrath <roland@gnu.org> |
2247
2c7997f249eb
Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1975
diff
changeset
|
6 ;; Keywords: maint |
846
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
811
diff
changeset
|
7 |
14169 | 8 ;; This file is part of GNU Emacs. |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
473 | 24 |
7942 | 25 ;;; Commentary: |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
26 |
7437 | 27 ;; This code helps GNU Emacs maintainers keep the loaddefs.el file up to |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
28 ;; date. It interprets magic cookies of the form ";;;###autoload" in |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
29 ;; lisp source files in various useful ways. To learn more, read the |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
30 ;; source; if you're going to use this, you'd better be able to. |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2247
diff
changeset
|
31 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
732
diff
changeset
|
32 ;;; Code: |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
732
diff
changeset
|
33 |
19170
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
34 (defvar generated-autoload-file "loaddefs.el" |
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
35 "*File \\[update-file-autoloads] puts autoloads into. |
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
36 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
|
37 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
|
38 trailer starting with a FormFeed character.") |
19170
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
39 |
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
40 (defconst generate-autoload-cookie ";;;###autoload" |
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
41 "Magic comment indicating the following form should be autoloaded. |
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
42 Used by \\[update-file-autoloads]. This string should be |
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
43 meaningless to Lisp (e.g., a comment). |
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
44 |
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
45 This string is used: |
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
46 |
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
47 ;;;###autoload |
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
48 \(defun function-to-be-autoloaded () ...) |
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
49 |
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
50 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
|
51 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
|
52 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
|
53 |
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
54 (defconst generate-autoload-section-header "\f\n;;;### " |
21479
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
55 "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
|
56 |
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
57 (defconst generate-autoload-section-trailer "\n;;;***\n" |
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
58 "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
|
59 |
21479
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
60 (defconst generate-autoload-section-continuation ";;;;;; " |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
61 "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
|
62 |
473 | 63 (defun make-autoload (form file) |
17750
f11a3a49088c
(defcustom): Add doc-string-elt property.
Richard M. Stallman <rms@gnu.org>
parents:
17591
diff
changeset
|
64 "Turn FORM into an autoload or defvar for source file FILE. |
22371
f3cf0507c362
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22249
diff
changeset
|
65 Returns nil if FORM is not a `defun', `define-skeleton', |
26552
88324520c7fc
(make-autoload): Recognize the new `define-minor-mode'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25534
diff
changeset
|
66 `define-derived-mode', `define-generic-mode', `defmacro', `defcustom', |
88324520c7fc
(make-autoload): Recognize the new `define-minor-mode'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25534
diff
changeset
|
67 `define-minor-mode' or `easy-mmode-define-minor-mode'." |
473 | 68 (let ((car (car-safe form))) |
22371
f3cf0507c362
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22249
diff
changeset
|
69 (if (memq car '(defun define-skeleton defmacro define-derived-mode |
25534
297c943363ed
(make-autoload): Handle defun* like defun.
Richard M. Stallman <rms@gnu.org>
parents:
25278
diff
changeset
|
70 define-generic-mode easy-mmode-define-minor-mode |
26552
88324520c7fc
(make-autoload): Recognize the new `define-minor-mode'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25534
diff
changeset
|
71 define-minor-mode defun*)) |
3777
d6f56b9586f7
(make-autoload): Use memq once instead eq twice.
Roland McGrath <roland@gnu.org>
parents:
3774
diff
changeset
|
72 (let ((macrop (eq car 'defmacro)) |
d6f56b9586f7
(make-autoload): Use memq once instead eq twice.
Roland McGrath <roland@gnu.org>
parents:
3774
diff
changeset
|
73 name doc) |
12500
6aba36eda051
(make-autoload): Generate `(autoload ...)' form for
Karl Heuer <kwzh@gnu.org>
parents:
8864
diff
changeset
|
74 (setq form (cdr form) |
6aba36eda051
(make-autoload): Generate `(autoload ...)' form for
Karl Heuer <kwzh@gnu.org>
parents:
8864
diff
changeset
|
75 name (car form) |
6aba36eda051
(make-autoload): Generate `(autoload ...)' form for
Karl Heuer <kwzh@gnu.org>
parents:
8864
diff
changeset
|
76 ;; Ignore the arguments. |
22247
7db7ffb27feb
(make-autoload): Add support for define-derived-mode. Update the
Richard M. Stallman <rms@gnu.org>
parents:
22242
diff
changeset
|
77 form (cdr (cond |
26552
88324520c7fc
(make-autoload): Recognize the new `define-minor-mode'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25534
diff
changeset
|
78 ((memq car '(define-skeleton define-minor-mode |
22371
f3cf0507c362
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22249
diff
changeset
|
79 easy-mmode-define-minor-mode)) form) |
22247
7db7ffb27feb
(make-autoload): Add support for define-derived-mode. Update the
Richard M. Stallman <rms@gnu.org>
parents:
22242
diff
changeset
|
80 ((eq car 'define-derived-mode) (cdr (cdr form))) |
22371
f3cf0507c362
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22249
diff
changeset
|
81 ((eq car 'define-generic-mode) |
f3cf0507c362
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22249
diff
changeset
|
82 (cdr (cdr (cdr (cdr (cdr form)))))) |
22247
7db7ffb27feb
(make-autoload): Add support for define-derived-mode. Update the
Richard M. Stallman <rms@gnu.org>
parents:
22242
diff
changeset
|
83 (t (cdr form)))) |
12500
6aba36eda051
(make-autoload): Generate `(autoload ...)' form for
Karl Heuer <kwzh@gnu.org>
parents:
8864
diff
changeset
|
84 doc (car form)) |
473 | 85 (if (stringp doc) |
86 (setq form (cdr form)) | |
87 (setq doc nil)) | |
22371
f3cf0507c362
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22249
diff
changeset
|
88 ;; `define-generic-mode' quotes the name, so take care of that |
f3cf0507c362
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22249
diff
changeset
|
89 (list 'autoload (if (listp name) name (list 'quote name)) file doc |
22247
7db7ffb27feb
(make-autoload): Add support for define-derived-mode. Update the
Richard M. Stallman <rms@gnu.org>
parents:
22242
diff
changeset
|
90 (or (eq car 'define-skeleton) (eq car 'define-derived-mode) |
22371
f3cf0507c362
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22249
diff
changeset
|
91 (eq car 'define-generic-mode) |
f3cf0507c362
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22249
diff
changeset
|
92 (eq car 'easy-mmode-define-minor-mode) |
26552
88324520c7fc
(make-autoload): Recognize the new `define-minor-mode'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25534
diff
changeset
|
93 (eq car 'define-minor-mode) |
12500
6aba36eda051
(make-autoload): Generate `(autoload ...)' form for
Karl Heuer <kwzh@gnu.org>
parents:
8864
diff
changeset
|
94 (eq (car-safe (car form)) 'interactive)) |
1552
f2901040a07b
* autoload.el (make-autoload): When creating an autoload
Jim Blandy <jimb@redhat.com>
parents:
1108
diff
changeset
|
95 (if macrop (list 'quote 'macro) nil))) |
19131
962be4e083c2
(make-autoload): For a defcustom,
Richard M. Stallman <rms@gnu.org>
parents:
19019
diff
changeset
|
96 ;; Convert defcustom to a simpler (and less space-consuming) defvar, |
962be4e083c2
(make-autoload): For a defcustom,
Richard M. Stallman <rms@gnu.org>
parents:
19019
diff
changeset
|
97 ;; but add some extra stuff if it uses :require. |
17750
f11a3a49088c
(defcustom): Add doc-string-elt property.
Richard M. Stallman <rms@gnu.org>
parents:
17591
diff
changeset
|
98 (if (eq car 'defcustom) |
f11a3a49088c
(defcustom): Add doc-string-elt property.
Richard M. Stallman <rms@gnu.org>
parents:
17591
diff
changeset
|
99 (let ((varname (car-safe (cdr-safe form))) |
f11a3a49088c
(defcustom): Add doc-string-elt property.
Richard M. Stallman <rms@gnu.org>
parents:
17591
diff
changeset
|
100 (init (car-safe (cdr-safe (cdr-safe form)))) |
19131
962be4e083c2
(make-autoload): For a defcustom,
Richard M. Stallman <rms@gnu.org>
parents:
19019
diff
changeset
|
101 (doc (car-safe (cdr-safe (cdr-safe (cdr-safe form))))) |
962be4e083c2
(make-autoload): For a defcustom,
Richard M. Stallman <rms@gnu.org>
parents:
19019
diff
changeset
|
102 (rest (cdr-safe (cdr-safe (cdr-safe (cdr-safe form)))))) |
962be4e083c2
(make-autoload): For a defcustom,
Richard M. Stallman <rms@gnu.org>
parents:
19019
diff
changeset
|
103 (if (not (plist-get rest :require)) |
962be4e083c2
(make-autoload): For a defcustom,
Richard M. Stallman <rms@gnu.org>
parents:
19019
diff
changeset
|
104 `(defvar ,varname ,init ,doc) |
962be4e083c2
(make-autoload): For a defcustom,
Richard M. Stallman <rms@gnu.org>
parents:
19019
diff
changeset
|
105 `(progn |
962be4e083c2
(make-autoload): For a defcustom,
Richard M. Stallman <rms@gnu.org>
parents:
19019
diff
changeset
|
106 (defvar ,varname ,init ,doc) |
962be4e083c2
(make-autoload): For a defcustom,
Richard M. Stallman <rms@gnu.org>
parents:
19019
diff
changeset
|
107 (custom-add-to-group ,(plist-get rest :group) |
962be4e083c2
(make-autoload): For a defcustom,
Richard M. Stallman <rms@gnu.org>
parents:
19019
diff
changeset
|
108 ',varname 'custom-variable) |
962be4e083c2
(make-autoload): For a defcustom,
Richard M. Stallman <rms@gnu.org>
parents:
19019
diff
changeset
|
109 (custom-add-load ',varname |
962be4e083c2
(make-autoload): For a defcustom,
Richard M. Stallman <rms@gnu.org>
parents:
19019
diff
changeset
|
110 ,(plist-get rest :require))))) |
17750
f11a3a49088c
(defcustom): Add doc-string-elt property.
Richard M. Stallman <rms@gnu.org>
parents:
17591
diff
changeset
|
111 nil)))) |
473 | 112 |
727 | 113 ;;; Forms which have doc-strings which should be printed specially. |
114 ;;; A doc-string-elt property of ELT says that (nth ELT FORM) is | |
115 ;;; the doc-string in FORM. | |
116 ;;; | |
117 ;;; There used to be the following note here: | |
118 ;;; ;;; Note: defconst and defvar should NOT be marked in this way. | |
119 ;;; ;;; We don't want to produce defconsts and defvars that | |
120 ;;; ;;; make-docfile can grok, because then it would grok them twice, | |
121 ;;; ;;; once in foo.el (where they are given with ;;;###autoload) and | |
122 ;;; ;;; once in loaddefs.el. | |
123 ;;; | |
124 ;;; Counter-note: Yes, they should be marked in this way. | |
125 ;;; make-docfile only processes those files that are loaded into the | |
126 ;;; dumped Emacs, and those files should never have anything | |
127 ;;; autoloaded here. The above-feared problem only occurs with files | |
128 ;;; which have autoloaded entries *and* are processed by make-docfile; | |
129 ;;; there should be no such files. | |
130 | |
473 | 131 (put 'autoload 'doc-string-elt 3) |
727 | 132 (put 'defun 'doc-string-elt 3) |
133 (put 'defvar 'doc-string-elt 3) | |
17750
f11a3a49088c
(defcustom): Add doc-string-elt property.
Richard M. Stallman <rms@gnu.org>
parents:
17591
diff
changeset
|
134 (put 'defcustom 'doc-string-elt 3) |
727 | 135 (put 'defconst 'doc-string-elt 3) |
136 (put 'defmacro 'doc-string-elt 3) | |
28400
206604013d7f
Also print defsubst doc string
Andreas Schwab <schwab@suse.de>
parents:
26552
diff
changeset
|
137 (put 'defsubst 'doc-string-elt 3) |
22371
f3cf0507c362
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22249
diff
changeset
|
138 (put 'define-skeleton 'doc-string-elt 3) |
23092
4e1b3d1dac36
Fix doc-string-elt property on define-derived-mode.
Andreas Schwab <schwab@suse.de>
parents:
22371
diff
changeset
|
139 (put 'define-derived-mode 'doc-string-elt 3) |
22371
f3cf0507c362
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22249
diff
changeset
|
140 (put 'easy-mmode-define-minor-mode 'doc-string-elt 3) |
26552
88324520c7fc
(make-autoload): Recognize the new `define-minor-mode'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
25534
diff
changeset
|
141 (put 'define-minor-mode 'doc-string-elt 3) |
22371
f3cf0507c362
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22249
diff
changeset
|
142 (put 'define-generic-mode 'doc-string-elt 3) |
22247
7db7ffb27feb
(make-autoload): Add support for define-derived-mode. Update the
Richard M. Stallman <rms@gnu.org>
parents:
22242
diff
changeset
|
143 |
473 | 144 |
5837
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
145 (defun autoload-trim-file-name (file) |
7477
a01cc9d6398d
(autoload-trim-file-name): Make it relative
Richard M. Stallman <rms@gnu.org>
parents:
7472
diff
changeset
|
146 ;; Returns a relative pathname of FILE |
a01cc9d6398d
(autoload-trim-file-name): Make it relative
Richard M. Stallman <rms@gnu.org>
parents:
7472
diff
changeset
|
147 ;; starting from the directory that loaddefs.el is in. |
a01cc9d6398d
(autoload-trim-file-name): Make it relative
Richard M. Stallman <rms@gnu.org>
parents:
7472
diff
changeset
|
148 ;; That is normally a directory in load-path, |
a01cc9d6398d
(autoload-trim-file-name): Make it relative
Richard M. Stallman <rms@gnu.org>
parents:
7472
diff
changeset
|
149 ;; which means Emacs will be able to find FILE when it looks. |
a01cc9d6398d
(autoload-trim-file-name): Make it relative
Richard M. Stallman <rms@gnu.org>
parents:
7472
diff
changeset
|
150 ;; Any extra directory names here would prevent finding the file. |
5837
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
151 (setq file (expand-file-name file)) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
152 (file-relative-name file |
7477
a01cc9d6398d
(autoload-trim-file-name): Make it relative
Richard M. Stallman <rms@gnu.org>
parents:
7472
diff
changeset
|
153 (file-name-directory generated-autoload-file))) |
5837
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
154 |
21479
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
155 (defun autoload-read-section-header () |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
156 "Read a section header form. |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
157 Since continuation lines have been marked as comments, |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
158 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
|
159 markers before we call `read'." |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
160 (save-match-data |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
161 (let ((beginning (point)) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
162 string) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
163 (forward-line 1) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
164 (while (looking-at generate-autoload-section-continuation) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
165 (forward-line 1)) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
166 (setq string (buffer-substring beginning (point))) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
167 (with-current-buffer (get-buffer-create " *autoload*") |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
168 (erase-buffer) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
169 (insert string) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
170 (goto-char (point-min)) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
171 (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
|
172 (replace-match " ")) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
173 (goto-char (point-min)) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
174 (read (current-buffer)))))) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
175 |
473 | 176 (defun generate-file-autoloads (file) |
177 "Insert at point a loaddefs autoload section for FILE. | |
178 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
|
179 marked by `generate-autoload-cookie' (which see). |
473 | 180 If FILE is being visited in a buffer, the contents of the buffer |
181 are used." | |
182 (interactive "fGenerate autoloads for file: ") | |
183 (let ((outbuf (current-buffer)) | |
184 (autoloads-done '()) | |
185 (load-name (let ((name (file-name-nondirectory file))) | |
186 (if (string-match "\\.elc?$" name) | |
187 (substring name 0 (match-beginning 0)) | |
188 name))) | |
189 (print-length nil) | |
5837
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
190 (print-readably t) ; This does something in Lucid Emacs. |
4555
434ef4c2fda7
(generate-file-autoloads): Set float-output-format to
Richard M. Stallman <rms@gnu.org>
parents:
4215
diff
changeset
|
191 (float-output-format nil) |
473 | 192 (done-any nil) |
1884
4a8bc12e7017
(generate-file-autoloads): If no buffer was visiting FILE when we started,
Roland McGrath <roland@gnu.org>
parents:
1552
diff
changeset
|
193 (visited (get-file-buffer file)) |
473 | 194 output-end) |
727 | 195 |
196 ;; If the autoload section we create here uses an absolute | |
197 ;; pathname for FILE in its header, and then Emacs is installed | |
198 ;; under a different path on another system, | |
199 ;; `update-autoloads-here' won't be able to find the files to be | |
200 ;; autoloaded. So, if FILE is in the same directory or a | |
732 | 201 ;; subdirectory of the current buffer's directory, we'll make it |
727 | 202 ;; relative to the current buffer's directory. |
203 (setq file (expand-file-name file)) | |
4089
410395998370
(generate-file-autoloads): Fix FILE truename hacking to substring
Roland McGrath <roland@gnu.org>
parents:
4068
diff
changeset
|
204 (let* ((source-truename (file-truename file)) |
410395998370
(generate-file-autoloads): Fix FILE truename hacking to substring
Roland McGrath <roland@gnu.org>
parents:
4068
diff
changeset
|
205 (dir-truename (file-name-as-directory |
410395998370
(generate-file-autoloads): Fix FILE truename hacking to substring
Roland McGrath <roland@gnu.org>
parents:
4068
diff
changeset
|
206 (file-truename default-directory))) |
410395998370
(generate-file-autoloads): Fix FILE truename hacking to substring
Roland McGrath <roland@gnu.org>
parents:
4068
diff
changeset
|
207 (len (length dir-truename))) |
410395998370
(generate-file-autoloads): Fix FILE truename hacking to substring
Roland McGrath <roland@gnu.org>
parents:
4068
diff
changeset
|
208 (if (and (< len (length source-truename)) |
410395998370
(generate-file-autoloads): Fix FILE truename hacking to substring
Roland McGrath <roland@gnu.org>
parents:
4068
diff
changeset
|
209 (string= dir-truename (substring source-truename 0 len))) |
410395998370
(generate-file-autoloads): Fix FILE truename hacking to substring
Roland McGrath <roland@gnu.org>
parents:
4068
diff
changeset
|
210 (setq file (substring source-truename len)))) |
727 | 211 |
473 | 212 (message "Generating autoloads for %s..." file) |
1975
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
213 (save-excursion |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
214 (unwind-protect |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
215 (progn |
13730
87eb8f956a00
(generate-file-autoloads): If no buffer visiting FILE exists, read it into
Roland McGrath <roland@gnu.org>
parents:
12500
diff
changeset
|
216 (if visited |
87eb8f956a00
(generate-file-autoloads): If no buffer visiting FILE exists, read it into
Roland McGrath <roland@gnu.org>
parents:
12500
diff
changeset
|
217 (set-buffer visited) |
87eb8f956a00
(generate-file-autoloads): If no buffer visiting FILE exists, read it into
Roland McGrath <roland@gnu.org>
parents:
12500
diff
changeset
|
218 ;; It is faster to avoid visiting the file. |
87eb8f956a00
(generate-file-autoloads): If no buffer visiting FILE exists, read it into
Roland McGrath <roland@gnu.org>
parents:
12500
diff
changeset
|
219 (set-buffer (get-buffer-create " *generate-autoload-file*")) |
87eb8f956a00
(generate-file-autoloads): If no buffer visiting FILE exists, read it into
Roland McGrath <roland@gnu.org>
parents:
12500
diff
changeset
|
220 (kill-all-local-variables) |
87eb8f956a00
(generate-file-autoloads): If no buffer visiting FILE exists, read it into
Roland McGrath <roland@gnu.org>
parents:
12500
diff
changeset
|
221 (erase-buffer) |
14043
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
222 (setq buffer-undo-list t |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
223 buffer-read-only nil) |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
224 (emacs-lisp-mode) |
13730
87eb8f956a00
(generate-file-autoloads): If no buffer visiting FILE exists, read it into
Roland McGrath <roland@gnu.org>
parents:
12500
diff
changeset
|
225 (insert-file-contents file nil)) |
1975
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
226 (save-excursion |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
227 (save-restriction |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
228 (widen) |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
229 (goto-char (point-min)) |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
230 (while (not (eobp)) |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
231 (skip-chars-forward " \t\n\f") |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
232 (cond |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
233 ((looking-at (regexp-quote generate-autoload-cookie)) |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
234 (search-forward generate-autoload-cookie) |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
235 (skip-chars-forward " \t") |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
236 (setq done-any t) |
5854
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
237 (if (eolp) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
238 ;; Read the next form and make an autoload. |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
239 (let* ((form (prog1 (read (current-buffer)) |
6280
54968237a1ac
(generate-file-autoloads): Don't ignore the line
Richard M. Stallman <rms@gnu.org>
parents:
6184
diff
changeset
|
240 (or (bolp) (forward-line 1)))) |
22003
ea83fc4c4f77
(generate-file-autoloads): Handle progn forms generated by
Richard M. Stallman <rms@gnu.org>
parents:
21479
diff
changeset
|
241 (autoload-1 (make-autoload form load-name)) |
ea83fc4c4f77
(generate-file-autoloads): Handle progn forms generated by
Richard M. Stallman <rms@gnu.org>
parents:
21479
diff
changeset
|
242 (autoload (if (eq (car autoload-1) 'progn) |
ea83fc4c4f77
(generate-file-autoloads): Handle progn forms generated by
Richard M. Stallman <rms@gnu.org>
parents:
21479
diff
changeset
|
243 (cadr autoload-1) |
ea83fc4c4f77
(generate-file-autoloads): Handle progn forms generated by
Richard M. Stallman <rms@gnu.org>
parents:
21479
diff
changeset
|
244 autoload-1)) |
5854
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
245 (doc-string-elt (get (car-safe form) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
246 'doc-string-elt))) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
247 (if autoload |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
248 (setq autoloads-done (cons (nth 1 form) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
249 autoloads-done)) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
250 (setq autoload form)) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
251 (if (and doc-string-elt |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
252 (stringp (nth doc-string-elt autoload))) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
253 ;; We need to hack the printing because the |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
254 ;; doc-string must be printed specially for |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
255 ;; make-docfile (sigh). |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
256 (let* ((p (nthcdr (1- doc-string-elt) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
257 autoload)) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
258 (elt (cdr p))) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
259 (setcdr p nil) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
260 (princ "\n(" outbuf) |
22242
00ce0bf9b723
(generate-file-autoloads): Set
Richard M. Stallman <rms@gnu.org>
parents:
22003
diff
changeset
|
261 (let ((print-escape-newlines t) |
00ce0bf9b723
(generate-file-autoloads): Set
Richard M. Stallman <rms@gnu.org>
parents:
22003
diff
changeset
|
262 (print-escape-nonascii t)) |
5854
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
263 (mapcar (function (lambda (elt) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
264 (prin1 elt outbuf) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
265 (princ " " outbuf))) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
266 autoload)) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
267 (princ "\"\\\n" outbuf) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
268 (let ((begin (save-excursion |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
269 (set-buffer outbuf) |
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
270 (point)))) |
1975
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
271 (princ (substring |
5837
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
272 (prin1-to-string (car elt)) 1) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
273 outbuf) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
274 ;; Insert a backslash before each ( that |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
275 ;; appears at the beginning of a line in |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
276 ;; the doc string. |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
277 (save-excursion |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
278 (set-buffer outbuf) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
279 (save-excursion |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
280 (while (search-backward "\n(" begin t) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
281 (forward-char 1) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
282 (insert "\\")))) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
283 (if (null (cdr elt)) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
284 (princ ")" outbuf) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
285 (princ " " outbuf) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
286 (princ (substring |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
287 (prin1-to-string (cdr elt)) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
288 1) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
289 outbuf)) |
5854
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
290 (terpri outbuf))) |
22242
00ce0bf9b723
(generate-file-autoloads): Set
Richard M. Stallman <rms@gnu.org>
parents:
22003
diff
changeset
|
291 (let ((print-escape-newlines t) |
00ce0bf9b723
(generate-file-autoloads): Set
Richard M. Stallman <rms@gnu.org>
parents:
22003
diff
changeset
|
292 (print-escape-nonascii t)) |
22003
ea83fc4c4f77
(generate-file-autoloads): Handle progn forms generated by
Richard M. Stallman <rms@gnu.org>
parents:
21479
diff
changeset
|
293 (print autoload outbuf))) |
ea83fc4c4f77
(generate-file-autoloads): Handle progn forms generated by
Richard M. Stallman <rms@gnu.org>
parents:
21479
diff
changeset
|
294 (if (eq (car autoload-1) 'progn) |
ea83fc4c4f77
(generate-file-autoloads): Handle progn forms generated by
Richard M. Stallman <rms@gnu.org>
parents:
21479
diff
changeset
|
295 ;; Print the rest of the form |
22242
00ce0bf9b723
(generate-file-autoloads): Set
Richard M. Stallman <rms@gnu.org>
parents:
22003
diff
changeset
|
296 (let ((print-escape-newlines t) |
00ce0bf9b723
(generate-file-autoloads): Set
Richard M. Stallman <rms@gnu.org>
parents:
22003
diff
changeset
|
297 (print-escape-nonascii t)) |
22003
ea83fc4c4f77
(generate-file-autoloads): Handle progn forms generated by
Richard M. Stallman <rms@gnu.org>
parents:
21479
diff
changeset
|
298 (mapcar (function (lambda (elt) |
ea83fc4c4f77
(generate-file-autoloads): Handle progn forms generated by
Richard M. Stallman <rms@gnu.org>
parents:
21479
diff
changeset
|
299 (print elt outbuf))) |
ea83fc4c4f77
(generate-file-autoloads): Handle progn forms generated by
Richard M. Stallman <rms@gnu.org>
parents:
21479
diff
changeset
|
300 (cddr autoload-1))))) |
5854
9d1ae808403b
(generate-file-autoloads): Don't frob literal formfeeds into \f; just bind
Roland McGrath <roland@gnu.org>
parents:
5843
diff
changeset
|
301 ;; Copy the rest of the line to the output. |
13937
35c457f8bedf
(generate-file-autoloads): Preserve whitespace after cookie in literal text
Roland McGrath <roland@gnu.org>
parents:
13730
diff
changeset
|
302 (princ (buffer-substring |
35c457f8bedf
(generate-file-autoloads): Preserve whitespace after cookie in literal text
Roland McGrath <roland@gnu.org>
parents:
13730
diff
changeset
|
303 (progn |
35c457f8bedf
(generate-file-autoloads): Preserve whitespace after cookie in literal text
Roland McGrath <roland@gnu.org>
parents:
13730
diff
changeset
|
304 ;; Back up over whitespace, to preserve it. |
35c457f8bedf
(generate-file-autoloads): Preserve whitespace after cookie in literal text
Roland McGrath <roland@gnu.org>
parents:
13730
diff
changeset
|
305 (skip-chars-backward " \f\t") |
35c457f8bedf
(generate-file-autoloads): Preserve whitespace after cookie in literal text
Roland McGrath <roland@gnu.org>
parents:
13730
diff
changeset
|
306 (if (= (char-after (1+ (point))) ? ) |
35c457f8bedf
(generate-file-autoloads): Preserve whitespace after cookie in literal text
Roland McGrath <roland@gnu.org>
parents:
13730
diff
changeset
|
307 ;; Eat one space. |
35c457f8bedf
(generate-file-autoloads): Preserve whitespace after cookie in literal text
Roland McGrath <roland@gnu.org>
parents:
13730
diff
changeset
|
308 (forward-char 1)) |
35c457f8bedf
(generate-file-autoloads): Preserve whitespace after cookie in literal text
Roland McGrath <roland@gnu.org>
parents:
13730
diff
changeset
|
309 (point)) |
35c457f8bedf
(generate-file-autoloads): Preserve whitespace after cookie in literal text
Roland McGrath <roland@gnu.org>
parents:
13730
diff
changeset
|
310 (progn (forward-line 1) (point))) |
35c457f8bedf
(generate-file-autoloads): Preserve whitespace after cookie in literal text
Roland McGrath <roland@gnu.org>
parents:
13730
diff
changeset
|
311 outbuf))) |
5837
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
312 ((looking-at ";") |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
313 ;; Don't read the comment. |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
314 (forward-line 1)) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
315 (t |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
316 (forward-sexp 1) |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
317 (forward-line 1))))))) |
1975
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
318 (or visited |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
319 ;; We created this buffer, so we should kill it. |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
320 (kill-buffer (current-buffer))) |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
321 (set-buffer outbuf) |
3334e2489824
* autoload.el (generate-file-autoloads): Add another
Jim Blandy <jimb@redhat.com>
parents:
1884
diff
changeset
|
322 (setq output-end (point-marker)))) |
473 | 323 (if done-any |
324 (progn | |
21479
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
325 ;; Insert the section-header line |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
326 ;; which lists the file name and which functions are in it, etc. |
473 | 327 (insert generate-autoload-section-header) |
5837
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
328 (prin1 (list 'autoloads autoloads-done load-name |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
329 (autoload-trim-file-name file) |
473 | 330 (nth 5 (file-attributes file))) |
331 outbuf) | |
332 (terpri outbuf) | |
21479
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
333 ;; Break that line at spaces, to avoid very long lines. |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
334 ;; Make each sub-line into a comment. |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
335 (with-current-buffer outbuf |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
336 (save-excursion |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
337 (forward-line -1) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
338 (while (not (eolp)) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
339 (move-to-column 64) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
340 (skip-chars-forward "^ \n") |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
341 (or (eolp) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
342 (insert "\n" generate-autoload-section-continuation))))) |
5837
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
343 (insert ";;; Generated autoloads from " |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
344 (autoload-trim-file-name file) "\n") |
8864
65731429a2c1
(generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents:
7942
diff
changeset
|
345 ;; Warn if we put a line in loaddefs.el |
65731429a2c1
(generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents:
7942
diff
changeset
|
346 ;; that is long enough to cause trouble. |
65731429a2c1
(generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents:
7942
diff
changeset
|
347 (while (< (point) output-end) |
65731429a2c1
(generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents:
7942
diff
changeset
|
348 (let ((beg (point))) |
65731429a2c1
(generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents:
7942
diff
changeset
|
349 (end-of-line) |
65731429a2c1
(generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents:
7942
diff
changeset
|
350 (if (> (- (point) beg) 900) |
65731429a2c1
(generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents:
7942
diff
changeset
|
351 (progn |
65731429a2c1
(generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents:
7942
diff
changeset
|
352 (message "A line is too long--over 900 characters") |
65731429a2c1
(generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents:
7942
diff
changeset
|
353 (sleep-for 2) |
65731429a2c1
(generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents:
7942
diff
changeset
|
354 (goto-char output-end)))) |
65731429a2c1
(generate-file-autoloads): Warn if we put a line
Richard M. Stallman <rms@gnu.org>
parents:
7942
diff
changeset
|
355 (forward-line 1)) |
473 | 356 (goto-char output-end) |
357 (insert generate-autoload-section-trailer))) | |
358 (message "Generating autoloads for %s...done" file))) | |
2535
86d5500624d5
(update-file-autoloads, update-directory-autoloads): If called
Roland McGrath <roland@gnu.org>
parents:
2494
diff
changeset
|
359 |
473 | 360 ;;;###autoload |
361 (defun update-file-autoloads (file) | |
362 "Update the autoloads for FILE in `generated-autoload-file' | |
363 \(which FILE might bind in its local variables)." | |
364 (interactive "fUpdate autoloads for file: ") | |
365 (let ((load-name (let ((name (file-name-nondirectory file))) | |
366 (if (string-match "\\.elc?$" name) | |
367 (substring name 0 (match-beginning 0)) | |
368 name))) | |
5815
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
369 (found nil) |
473 | 370 (existing-buffer (get-file-buffer file))) |
371 (save-excursion | |
372 ;; We want to get a value for generated-autoload-file from | |
373 ;; the local variables section if it's there. | |
14043
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
374 (if existing-buffer |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
375 (set-buffer existing-buffer)) |
17001
ce8565274e49
(update-file-autoloads): Read loaddefs.el without
Karl Heuer <kwzh@gnu.org>
parents:
16995
diff
changeset
|
376 ;; We must read/write the file without any code conversion. |
ce8565274e49
(update-file-autoloads): Read loaddefs.el without
Karl Heuer <kwzh@gnu.org>
parents:
16995
diff
changeset
|
377 (let ((coding-system-for-read 'no-conversion)) |
21369
9ca6953d7ce8
(update-file-autoloads): Redo 1997-08-23 change.
Richard M. Stallman <rms@gnu.org>
parents:
21119
diff
changeset
|
378 (set-buffer (find-file-noselect |
9ca6953d7ce8
(update-file-autoloads): Redo 1997-08-23 change.
Richard M. Stallman <rms@gnu.org>
parents:
21119
diff
changeset
|
379 (expand-file-name generated-autoload-file |
9ca6953d7ce8
(update-file-autoloads): Redo 1997-08-23 change.
Richard M. Stallman <rms@gnu.org>
parents:
21119
diff
changeset
|
380 (expand-file-name "lisp" |
9ca6953d7ce8
(update-file-autoloads): Redo 1997-08-23 change.
Richard M. Stallman <rms@gnu.org>
parents:
21119
diff
changeset
|
381 source-directory))))) |
20817
297fefd12ecf
(update-file-autoloads): Give clean errors
Richard M. Stallman <rms@gnu.org>
parents:
19482
diff
changeset
|
382 (or (> (buffer-size) 0) |
297fefd12ecf
(update-file-autoloads): Give clean errors
Richard M. Stallman <rms@gnu.org>
parents:
19482
diff
changeset
|
383 (error "Autoloads file %s does not exist" buffer-file-name)) |
297fefd12ecf
(update-file-autoloads): Give clean errors
Richard M. Stallman <rms@gnu.org>
parents:
19482
diff
changeset
|
384 (or (file-writable-p buffer-file-name) |
297fefd12ecf
(update-file-autoloads): Give clean errors
Richard M. Stallman <rms@gnu.org>
parents:
19482
diff
changeset
|
385 (error "Autoloads file %s is not writable" buffer-file-name)) |
473 | 386 (save-excursion |
387 (save-restriction | |
388 (widen) | |
389 (goto-char (point-min)) | |
5815
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
390 ;; Look for the section for LOAD-NAME. |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
391 (while (and (not found) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
392 (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
|
393 (let ((form (autoload-read-section-header))) |
5815
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
394 (cond ((string= (nth 2 form) load-name) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
395 ;; We found the section for this file. |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
396 ;; Check if it is up to date. |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
397 (let ((begin (match-beginning 0)) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
398 (last-time (nth 4 form)) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
399 (file-time (nth 5 (file-attributes file)))) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
400 (if (and (or (null existing-buffer) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
401 (not (buffer-modified-p existing-buffer))) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
402 (listp last-time) (= (length last-time) 2) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
403 (or (> (car last-time) (car file-time)) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
404 (and (= (car last-time) (car file-time)) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
405 (>= (nth 1 last-time) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
406 (nth 1 file-time))))) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
407 (progn |
14252
7ef2eabb1a9c
(update-file-autoloads): Only give "up to date" msg if (interactive-p).
Roland McGrath <roland@gnu.org>
parents:
14192
diff
changeset
|
408 (if (interactive-p) |
7ef2eabb1a9c
(update-file-autoloads): Only give "up to date" msg if (interactive-p).
Roland McGrath <roland@gnu.org>
parents:
14192
diff
changeset
|
409 (message "\ |
7ef2eabb1a9c
(update-file-autoloads): Only give "up to date" msg if (interactive-p).
Roland McGrath <roland@gnu.org>
parents:
14192
diff
changeset
|
410 Autoload section for %s is up to date." |
7ef2eabb1a9c
(update-file-autoloads): Only give "up to date" msg if (interactive-p).
Roland McGrath <roland@gnu.org>
parents:
14192
diff
changeset
|
411 file)) |
5815
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
412 (setq found 'up-to-date)) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
413 (search-forward generate-autoload-section-trailer) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
414 (delete-region begin (point)) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
415 (setq found t)))) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
416 ((string< load-name (nth 2 form)) |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
417 ;; We've come to a section alphabetically later than |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
418 ;; LOAD-NAME. We assume the file is in order and so |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
419 ;; there must be no section for LOAD-NAME. We will |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
420 ;; insert one before the section here. |
b1e5e6efed1d
(update-file-autoloads): Never ask the user where to put a new section.
Roland McGrath <roland@gnu.org>
parents:
4555
diff
changeset
|
421 (goto-char (match-beginning 0)) |
5837
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
422 (setq found 'new))))) |
14044
1c331f9332ae
(update-file-autoloads): Fix placement of new sections.
Roland McGrath <roland@gnu.org>
parents:
14043
diff
changeset
|
423 (or found |
1c331f9332ae
(update-file-autoloads): Fix placement of new sections.
Roland McGrath <roland@gnu.org>
parents:
14043
diff
changeset
|
424 (progn |
1c331f9332ae
(update-file-autoloads): Fix placement of new sections.
Roland McGrath <roland@gnu.org>
parents:
14043
diff
changeset
|
425 (setq found 'new) |
1c331f9332ae
(update-file-autoloads): Fix placement of new sections.
Roland McGrath <roland@gnu.org>
parents:
14043
diff
changeset
|
426 ;; No later sections in the file. Put before the last page. |
1c331f9332ae
(update-file-autoloads): Fix placement of new sections.
Roland McGrath <roland@gnu.org>
parents:
14043
diff
changeset
|
427 (goto-char (point-max)) |
16158
af6ef293cb42
(update-file-autoloads): Don't barf if autoloads file
Richard M. Stallman <rms@gnu.org>
parents:
14252
diff
changeset
|
428 (search-backward "\f" nil t))) |
5837
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
429 (or (eq found 'up-to-date) |
14044
1c331f9332ae
(update-file-autoloads): Fix placement of new sections.
Roland McGrath <roland@gnu.org>
parents:
14043
diff
changeset
|
430 (and (eq found 'new) |
5837
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
431 ;; Check that FILE has any cookies before generating a |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
432 ;; new section for it. |
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
433 (save-excursion |
14043
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
434 (if existing-buffer |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
435 (set-buffer existing-buffer) |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
436 ;; It is faster to avoid visiting the file. |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
437 (set-buffer (get-buffer-create " *autoload-file*")) |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
438 (kill-all-local-variables) |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
439 (erase-buffer) |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
440 (setq buffer-undo-list t |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
441 buffer-read-only nil) |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
442 (emacs-lisp-mode) |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
443 (insert-file-contents file nil)) |
5837
fd1e2c6f7bf5
(autoload-trim-file-name): New function.
Roland McGrath <roland@gnu.org>
parents:
5815
diff
changeset
|
444 (save-excursion |
14043
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
445 (save-restriction |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
446 (widen) |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
447 (goto-char (point-min)) |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
448 (prog1 |
19209
50857b41060a
(update-file-autoloads): Use anchored regexp search instead of requiring
Roland McGrath <roland@gnu.org>
parents:
19170
diff
changeset
|
449 (if (re-search-forward |
50857b41060a
(update-file-autoloads): Use anchored regexp search instead of requiring
Roland McGrath <roland@gnu.org>
parents:
19170
diff
changeset
|
450 (concat "^" (regexp-quote |
50857b41060a
(update-file-autoloads): Use anchored regexp search instead of requiring
Roland McGrath <roland@gnu.org>
parents:
19170
diff
changeset
|
451 generate-autoload-cookie)) |
14043
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
452 nil t) |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
453 nil |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
454 (if (interactive-p) |
14192
b1bc0f5d8cf3
(update-file-autoloads): Fix message.
Erik Naggum <erik@naggum.no>
parents:
14169
diff
changeset
|
455 (message "%s has no autoloads" file)) |
14043
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
456 t) |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
457 (or existing-buffer |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
458 (kill-buffer (current-buffer)))))))) |
7456
493a32789e7d
(update-file-autoloads): Delete leftover variable.
Karl Heuer <kwzh@gnu.org>
parents:
7437
diff
changeset
|
459 (generate-file-autoloads file)))) |
21479
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
460 (and (interactive-p) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
461 (buffer-modified-p) |
89c1bfb63571
(generate-autoload-section-header): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
21369
diff
changeset
|
462 (save-buffer))))) |
473 | 463 |
464 ;;;###autoload | |
17851
6e7bb77cd7e1
(update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
17750
diff
changeset
|
465 (defun update-autoloads-from-directories (&rest dirs) |
3774
3b0cb275ca29
(generate-autoload-cookie, update-autoloads-here): Doc fixes.
Roland McGrath <roland@gnu.org>
parents:
2535
diff
changeset
|
466 "\ |
17851
6e7bb77cd7e1
(update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
17750
diff
changeset
|
467 Update loaddefs.el with all the current autoloads from DIRS, and no old ones. |
14043
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
468 This uses `update-file-autoloads' (which see) do its work." |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
469 (interactive "DUpdate autoloads from directory: ") |
17851
6e7bb77cd7e1
(update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
17750
diff
changeset
|
470 (let ((files (apply 'nconc |
6e7bb77cd7e1
(update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
17750
diff
changeset
|
471 (mapcar (function (lambda (dir) |
6e7bb77cd7e1
(update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
17750
diff
changeset
|
472 (directory-files (expand-file-name dir) |
6e7bb77cd7e1
(update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
17750
diff
changeset
|
473 t |
19170
ecc4375537e3
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
19131
diff
changeset
|
474 "^[^=.].*\\.el$"))) |
17851
6e7bb77cd7e1
(update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
17750
diff
changeset
|
475 dirs))) |
6e7bb77cd7e1
(update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
17750
diff
changeset
|
476 autoloads-file |
6e7bb77cd7e1
(update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
17750
diff
changeset
|
477 top-dir) |
19019
65f371a2cf00
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
17851
diff
changeset
|
478 (setq autoloads-file |
65f371a2cf00
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
17851
diff
changeset
|
479 (expand-file-name generated-autoload-file |
65f371a2cf00
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
17851
diff
changeset
|
480 (expand-file-name "lisp" |
65f371a2cf00
(update-autoloads-from-directories):
Richard M. Stallman <rms@gnu.org>
parents:
17851
diff
changeset
|
481 source-directory))) |
17851
6e7bb77cd7e1
(update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
17750
diff
changeset
|
482 (setq top-dir (file-name-directory autoloads-file)) |
473 | 483 (save-excursion |
17851
6e7bb77cd7e1
(update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
17750
diff
changeset
|
484 (set-buffer (find-file-noselect autoloads-file)) |
2535
86d5500624d5
(update-file-autoloads, update-directory-autoloads): If called
Roland McGrath <roland@gnu.org>
parents:
2494
diff
changeset
|
485 (save-excursion |
14043
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
486 (goto-char (point-min)) |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
487 (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
|
488 (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
|
489 (file (nth 3 form))) |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
490 (cond ((not (stringp file))) |
17851
6e7bb77cd7e1
(update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
17750
diff
changeset
|
491 ((not (file-exists-p (expand-file-name file top-dir))) |
14043
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
492 ;; Remove the obsolete section. |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
493 (let ((begin (match-beginning 0))) |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
494 (search-forward generate-autoload-section-trailer) |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
495 (delete-region begin (point)))) |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
496 (t |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
497 (update-file-autoloads file))) |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
498 (setq files (delete file files))))) |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
499 ;; Elements remaining in FILES have no existing autoload sections. |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
500 (mapcar 'update-file-autoloads files) |
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
501 (save-buffer)))) |
473 | 502 |
503 ;;;###autoload | |
504 (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
|
505 "Update loaddefs.el autoloads in batch mode. |
17851
6e7bb77cd7e1
(update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
17750
diff
changeset
|
506 Calls `update-autoloads-from-directories' on the command line arguments." |
6e7bb77cd7e1
(update-autoloads-from-directories): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
17750
diff
changeset
|
507 (apply 'update-autoloads-from-directories command-line-args-left) |
14043
d44a43c284e7
(update-file-autoloads): Notice when searching found nothing at all.
Roland McGrath <roland@gnu.org>
parents:
14022
diff
changeset
|
508 (setq command-line-args-left nil)) |
473 | 509 |
510 (provide 'autoload) | |
648 | 511 |
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
648
diff
changeset
|
512 ;;; autoload.el ends here |