Mercurial > hg > xemacs-beta
annotate lisp/autoload.el @ 5305:09fed7053634
Handle slightly more complex type specifications, #'coerce, #'typep.
2010-11-17 Aidan Kehoe <kehoea@parhasard.net>
* cl-extra.el (coerce):
In the argument list, name the first argument OBJECT, not X; the
former name was always used in the doc string and is clearer.
Handle vector type specifications which include the length of the
target sequence, error if there's a mismatch.
* cl-macs.el (cl-make-type-test): Handle type specifications
starting with the symbol 'eql.
| author | Aidan Kehoe <kehoea@parhasard.net> |
|---|---|
| date | Wed, 17 Nov 2010 14:30:03 +0000 |
| parents | 65f5d45edc87 |
| children | 308d34e9f07d |
| rev | line source |
|---|---|
| 1232 | 1 ;;; autoload.el --- maintain autoloads in auto-autoloads files. |
| 428 | 2 |
| 1753 | 3 ;; Copyright (C) 1991-1994, 1997, 2003 Free Software Foundation, Inc. |
| 428 | 4 ;; Copyright (C) 1995 Tinker Systems and INS Engineering Corp. |
|
5070
b0f4adffca7d
fix so that CL docstrings (with &key, etc.) handled properly
Ben Wing <ben@xemacs.org>
parents:
4783
diff
changeset
|
5 ;; Copyright (C) 1996, 2000, 2002, 2003, 2004, 2010 Ben Wing. |
| 428 | 6 |
| 2548 | 7 ;; Original Author: Roland McGrath <roland@gnu.ai.mit.edu> |
| 8 ;; Heavily Modified: XEmacs Maintainers | |
| 428 | 9 ;; Keywords: maint |
| 10 | |
| 11 ;; This file is part of XEmacs. | |
| 12 | |
| 13 ;; XEmacs is free software; you can redistribute it and/or modify it | |
| 14 ;; under the terms of the GNU General Public License as published by | |
| 15 ;; the Free Software Foundation; either version 2, or (at your option) | |
| 16 ;; any later version. | |
| 17 | |
| 18 ;; XEmacs is distributed in the hope that it will be useful, but | |
| 19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 21 ;; General Public License for more details. | |
| 22 | |
| 23 ;; You should have received a copy of the GNU General Public License | |
| 24 ;; along with XEmacs; see the file COPYING. If not, write to the Free | |
| 25 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
| 26 ;; 02111-1307, USA. | |
| 27 | |
| 2548 | 28 ;;; Synched up with: FSF 21.2 by Ben Wing. |
| 29 ;;; Note that update-file-autoloads is seriously modified and not really | |
| 30 ;;; syncable. | |
| 428 | 31 |
| 32 ;;; Commentary: | |
| 33 | |
| 1232 | 34 ;; This code keeps auto-autoloads.el files up to date. It interprets |
| 35 ;; magic cookies (of the form ";;;###autoload" in Lisp source files | |
| 36 ;; and "/* ###autoload */" in C source files) in various useful ways. | |
| 2548 | 37 ;; It is also used to maintain custom-defines.el files, since most of |
| 38 ;; the logic for computing them is the same as for auto-autoloads.el. | |
| 1232 | 39 |
| 40 ;; Usage | |
| 41 ;; ===== | |
| 42 | |
| 43 ;; Recommended usage for this library, as implemented in the core | |
| 44 ;; build process, is | |
| 45 | |
| 46 ;; xemacs -no-packages -batch \ | |
| 2548 | 47 ;; -l autoload -f batch-update-directory-autoloads PREFIX DIRECTORY |
| 1232 | 48 |
| 49 ;; which causes XEmacs to update the file named by PATH from the .el | |
| 50 ;; files in DIRECTORY (but not recursing into subdirectories) and (if | |
| 51 ;; the autoload file is not already protected with a feature test) add | |
| 52 ;; a check and provide for 'PREFIX-autoloads. Currently there is no | |
| 53 ;; sanity check for the provided feature; it is recommended that you | |
| 54 ;; nuke any existing auto-autoloads.el before running the command. | |
| 55 | |
| 56 ;; There is not yet a recommended API for updating multiple directories | |
| 57 ;; into a single auto-autoloads file. Using the recipe above for each | |
| 58 ;; DIRECTORY with the same PATH should work but has not been tested. | |
| 59 ;; There is no API for recursing into subdirectories. There probably | |
| 60 ;; won't be; given the wide variety of ways that existing Lisp packages | |
| 61 ;; arrange their files, and the fact that source packages and installed | |
| 62 ;; packages have a somewhat different directory structure, this seems far | |
| 63 ;; too risky. Use a script or a Lisp library with an explicit list of | |
| 64 ;; PATHs; see update-elc.el for how to do this without recursive invocation | |
| 65 ;; of XEmacs). | |
| 66 | |
| 67 ;; The probable next step is to fix up the packages to use the | |
| 2548 | 68 ;; `batch-update-directory-autoloads' API. However, for backward |
| 1232 | 69 ;; compatibility with XEmacs 21.4 and 21.1, this can't be done quickly. |
| 70 | |
| 71 ;; For backward compatibility the API used in the packages/XEmacs.rules: | |
| 72 | |
| 73 ;; xemacs -vanilla -batch -eval "$(AUTOLOAD_PACKAGE_NAME)" \ | |
| 2548 | 74 ;; -l autoload -f batch-update-autoloads $(AUTOLOAD_PATH) |
| 1232 | 75 |
| 76 ;; is supported, and the implementation is unchanged. However, | |
| 77 ;; revision of the API (in a backward compatible way) and the | |
| 78 ;; implementation are planned, and until those stabilize it is too | |
| 79 ;; risky to use this version of XEmacs for package releases. | |
| 80 | |
| 81 ;; Implementation: | |
| 82 ;; =============== | |
| 83 | |
| 84 ;; #### This section should be moved to the Internals manual, or | |
| 85 ;; (maybe) the Lispref, and integrated with the information above. | |
| 86 ;; Don't believe anything written here; the code is still a mess, and | |
| 87 ;; this is a lot of guesswork. | |
| 88 | |
| 89 ;; Autoloads are used in a number of contexts, including core Lisp, | |
| 90 ;; packaged Lisp, and ELLs (dynamically loadable compiled objects | |
| 91 ;; providing Lisp functionality). There two general strategies for | |
| 92 ;; collecting autoloads. The first is to put autoloads for a package | |
| 93 ;; in a package-specific auto-autoloads file. This is easy to | |
| 94 ;; implement, and allows packages to be distributed with prebuilt | |
| 95 ;; auto-autoloads files. The second is to collect all the autoloads | |
| 96 ;; in a single global auto-autoloads file. This is alleged to speed | |
| 97 ;; up initialization significantly, but requires care to ensure that | |
| 98 ;; auto-autoloads files remain synchronized with the libraries. | |
| 99 | |
| 100 ;; The traditional logic for determining where to put autoload | |
| 101 ;; definitions is complex and is now deprecated. The special variable | |
| 102 ;; `generated-autoload-file' is used to hold the path to the file, and | |
| 103 ;; is initialized to the traditional (well, it's a new tradition with | |
| 104 ;; XEmacs 20) $blddir/lisp/auto-autoloads.el. However, this variable | |
| 105 ;; may be bound by calling code, or may be generated at collect time | |
| 106 ;; and I'm not even sure the initialized value was ever used any more. | |
| 107 | |
| 108 ;; Because there may be multiple auto-autoloads files in use (in XEmacs | |
| 109 ;; 21.x with a full complement of packages there are dozens), and they may | |
| 110 ;; contain initializations that would be dangerous to reexecute, each is | |
| 111 ;; protected by a feature test. By convention, the feature symbol is of | |
| 112 ;; the form "NAME-autoloads". For packages, the special variable | |
| 113 ;; `autoload-package-name' is used to determine NAME. In the core, | |
| 114 ;; autoloads are defined in the modules (all of which are collected in a | |
| 115 ;; single auto-autoloads file), using NAME=modules, in the lisp directory | |
| 116 ;; using NAME=lisp, and in the lisp/mule directory, using NAME=mule, for | |
| 117 ;; the autoloads feature. These latter are computed by the autoloads | |
| 118 ;; function at collect time. | |
| 428 | 119 |
| 120 ;; ChangeLog: | |
| 121 | |
| 1232 | 122 ;; See ./ChangeLog. |
| 428 | 123 |
| 124 ;;; Code: | |
| 125 | |
| 2548 | 126 ;; Need to load easy-mmode because we expand macro calls to easy-mmode |
| 127 ;; macros in make-autoloads below. | |
| 128 (require 'easy-mmode) | |
| 129 | |
| 1232 | 130 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 131 ;; Standard file and directory names | |
| 132 | |
| 133 ;; `autoload-file-name' is defvar'd and initialized in packages.el, | |
| 134 ;; which is loaded (and dumped) very early. If you find it isn't, you | |
| 135 ;; know what you're doing. | |
| 136 | |
| 137 (defconst autoload-target-directory "../lisp/" | |
| 138 "Standard directory containing autoload declaration file. | |
| 139 | |
| 140 Use `generated-autoload-file' (q.v.) to change its installation location.") | |
| 141 | |
| 142 ;; Dynamic variables for communication among functions | |
| 143 | |
| 2548 | 144 ;; FSF 21.2: |
| 145 ;; The autoload file is assumed to contain a trailer starting with a FormFeed | |
| 146 ;; character. | |
| 147 | |
| 1232 | 148 (defvar generated-autoload-file |
| 149 (expand-file-name autoload-file-name lisp-directory) | |
| 150 "*File `update-file-autoloads' puts autoloads into. | |
| 151 A .el file can set this in its local variables section to make its | |
| 152 autoloads go somewhere else. | |
| 153 | |
| 154 Note that `batch-update-directory' binds this variable to its own value, | |
| 155 generally the file named by `autoload-file-name' in the directory being | |
| 156 updated. XEmacs.rules setq's this variable for package autoloads.") | |
| 157 | |
| 2548 | 158 (defvar generate-autoload-function |
| 159 #'generate-file-autoloads | |
| 160 "Function to generate the autoloads for a file and insert at point. | |
| 161 Called with one argument, the file.") | |
| 162 | |
| 1232 | 163 (define-obsolete-variable-alias 'autoload-package-name |
| 164 'autoload-feature-prefix) | |
| 165 (defvar autoload-feature-prefix nil | |
| 166 "If non-nil, use this string to prefix the autoload feature name. | |
| 167 | |
| 168 Usually a package name (from AUTOLOAD_PACKAGE_NAME, defined in XEmacs.rules | |
| 169 in the top of the package hierarchy), or \"auto\" (reserved for the core Lisp | |
| 170 auto-autoloads file). Highest priority candidate except for an explicit | |
| 171 argument to `autoload-make-feature-name' (q.v.).") | |
| 172 | |
| 2548 | 173 (defvar autoload-feature-suffix "-autoloads" |
| 174 "String added to `autoload-feature-prefix' to create the autoload feature name.") | |
| 175 | |
| 1232 | 176 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 177 ;; Magic strings in source files | |
| 178 | |
| 179 (defconst generate-autoload-cookie ";;;###autoload" | |
| 180 "Magic comment indicating the following form should be autoloaded. | |
| 181 Used by `update-file-autoloads'. This string should be | |
| 182 meaningless to Lisp (e.g., a comment). | |
| 183 | |
| 184 This string is used: | |
| 185 | |
| 186 ;;;###autoload | |
| 187 \(defun function-to-be-autoloaded () ...) | |
| 188 | |
| 189 If this string appears alone on a line, the following form will be | |
| 190 read and an autoload made for it. If it is followed by the string | |
| 191 \"immediate\", then the form on the following line will be copied | |
| 192 verbatim. If there is further text on the line, that text will be | |
| 193 copied verbatim to `generated-autoload-file'.") | |
| 194 | |
| 195 (defconst generate-c-autoload-cookie "/* ###autoload" | |
| 196 "Magic C comment indicating the following form should be autoloaded. | |
| 197 Used by `update-file-autoloads'. This string should be | |
| 198 meaningless to C (e.g., a comment). | |
| 199 | |
| 200 This string is used: | |
| 201 | |
| 202 /* ###autoload */ | |
| 203 DEFUN (\"function-to-be-autoloaded\", ... ) | |
| 204 | |
| 205 If this string appears alone on a line, the following form will be | |
| 206 read and an autoload made for it. If there is further text on the line, | |
| 207 that text will be copied verbatim to `generated-autoload-file'.") | |
| 208 | |
| 209 (defconst generate-c-autoload-module "/* ###module" | |
| 210 "Magic C comment indicating the module containing autoloaded functions. | |
| 211 Since a module can consist of multiple C files, the module name may not be | |
| 212 the same as the C source file base name. In that case, use this comment to | |
| 213 indicate the actual name of the module from which to autoload functions.") | |
| 214 | |
| 215 (defconst generate-autoload-section-header "\f\n;;;### " | |
| 216 "String inserted before the form identifying | |
| 217 the section of autoloads for a file.") | |
| 218 | |
| 219 (defconst generate-autoload-section-trailer "\n;;;***\n" | |
| 220 "String which indicates the end of the section of autoloads for a file.") | |
| 221 | |
| 2548 | 222 (defconst generate-autoload-section-continuation ";;;;;; " |
| 223 "String to add on each continuation of the section header form.") | |
| 224 | |
| 1232 | 225 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 226 ;; Parsing the source file text. | |
| 2548 | 227 ;; Autoloads in C source differ from those in Lisp source. |
| 1232 | 228 |
|
4425
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
229 ; Add operator definitions to autoload-operators.el in the xemacs-base |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
230 ; package. |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
231 (ignore-errors (require 'autoload-operators)) |
|
4352
d2f4dd8611d9
Factor out lists of operators specially treated by 'make-autoload'.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4332
diff
changeset
|
232 |
|
4425
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
233 ; As autoload-operators is new, provide stopgap measure for a while. |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
234 (if (not (boundp 'autoload-make-autoload-operators)) |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
235 (progn |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
236 (defvar autoload-make-autoload-operators |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
237 '(defun define-skeleton defmacro define-derived-mode define-generic-mode |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
238 easy-mmode-define-minor-mode easy-mmode-define-global-mode |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
239 define-minor-mode defun* defmacro*) |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
240 "`defun'-like operators that use `autoload' to load the library.") |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
241 |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
242 (defvar autoload-make-autoload-complex-operators |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
243 '(easy-mmode-define-minor-mode easy-mmode-define-global-mode |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
244 define-minor-mode) |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
245 "`defun'-like operators to macroexpand before using `autoload'.") |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
246 |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
247 (put 'autoload 'doc-string-elt 3) |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
248 (put 'defun 'doc-string-elt 3) |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
249 (put 'defun* 'doc-string-elt 3) |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
250 (put 'defvar 'doc-string-elt 3) |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
251 (put 'defcustom 'doc-string-elt 3) |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
252 (put 'defconst 'doc-string-elt 3) |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
253 (put 'defmacro 'doc-string-elt 3) |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
254 (put 'defmacro* 'doc-string-elt 3) |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
255 (put 'defsubst 'doc-string-elt 3) |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
256 (put 'define-skeleton 'doc-string-elt 2) |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
257 (put 'define-derived-mode 'doc-string-elt 4) |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
258 (put 'easy-mmode-define-minor-mode 'doc-string-elt 2) |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
259 (put 'define-minor-mode 'doc-string-elt 2) |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
260 (put 'define-generic-mode 'doc-string-elt 7) |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
261 ;; defin-global-mode has no explicit docstring. |
|
bfb8a26de3cb
Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents:
4352
diff
changeset
|
262 (put 'easy-mmode-define-global-mode 'doc-string-elt 1000))) |
|
4352
d2f4dd8611d9
Factor out lists of operators specially treated by 'make-autoload'.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4332
diff
changeset
|
263 |
| 428 | 264 (defun make-autoload (form file) |
| 2548 | 265 "Turn FORM into an autoload or defvar for source file FILE. |
| 266 Returns nil if FORM is not a special autoload form (i.e. a function definition | |
| 267 or macro definition or a defcustom)." | |
| 268 (let ((car (car-safe form)) expand) | |
| 269 (cond | |
| 270 ;; For complex cases, try again on the macro-expansion. | |
|
4352
d2f4dd8611d9
Factor out lists of operators specially treated by 'make-autoload'.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4332
diff
changeset
|
271 ((and (memq car autoload-make-autoload-complex-operators) |
| 2548 | 272 (setq expand (let ((load-file-name file)) (macroexpand form))) |
| 273 (eq (car expand) 'progn) | |
| 274 (memq :autoload-end expand)) | |
| 275 (let ((end (memq :autoload-end expand))) | |
| 276 ;; Cut-off anything after the :autoload-end marker. | |
| 277 (setcdr end nil) | |
| 278 (cons 'progn | |
| 279 (mapcar (lambda (form) (make-autoload form file)) | |
| 280 (cdr expand))))) | |
| 281 | |
| 282 ;; For special function-like operators, use the `autoload' function. | |
|
4352
d2f4dd8611d9
Factor out lists of operators specially treated by 'make-autoload'.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4332
diff
changeset
|
283 ((memq car autoload-make-autoload-operators) |
| 2548 | 284 (let* ((macrop (memq car '(defmacro defmacro*))) |
| 285 (name (nth 1 form)) | |
| 286 (body (nthcdr (get car 'doc-string-elt) form)) | |
|
4702
eb1a409c317b
Unbreak autoload.el
Mike Sperber <sperber@deinprogramm.de>
parents:
4695
diff
changeset
|
287 (doc (if (stringp (car body)) (pop body)))) |
|
eb1a409c317b
Unbreak autoload.el
Mike Sperber <sperber@deinprogramm.de>
parents:
4695
diff
changeset
|
288 (if (memq car '(defmacro defmacro* defun defun*)) |
|
5076
d555581e3cba
fix issues with display of argument docstrings
Ben Wing <ben@xemacs.org>
parents:
5070
diff
changeset
|
289 (let ((arglist (nth 2 form))) |
|
4702
eb1a409c317b
Unbreak autoload.el
Mike Sperber <sperber@deinprogramm.de>
parents:
4695
diff
changeset
|
290 (setq doc (concat (or doc "") |
|
eb1a409c317b
Unbreak autoload.el
Mike Sperber <sperber@deinprogramm.de>
parents:
4695
diff
changeset
|
291 "\n\narguments: " |
|
5076
d555581e3cba
fix issues with display of argument docstrings
Ben Wing <ben@xemacs.org>
parents:
5070
diff
changeset
|
292 (cl-function-arglist arglist) |
|
5070
b0f4adffca7d
fix so that CL docstrings (with &key, etc.) handled properly
Ben Wing <ben@xemacs.org>
parents:
4783
diff
changeset
|
293 "\n")))) |
| 2548 | 294 ;; `define-generic-mode' quotes the name, so take care of that |
| 295 (list 'autoload (if (listp name) name (list 'quote name)) file doc | |
| 296 (or (and (memq car '(define-skeleton define-derived-mode | |
| 297 define-generic-mode | |
| 298 easy-mmode-define-global-mode | |
| 299 easy-mmode-define-minor-mode | |
| 300 define-minor-mode)) t) | |
| 301 (eq (car-safe (car body)) 'interactive)) | |
| 302 (if macrop (list 'quote 'macro) nil)))) | |
| 303 | |
| 304 ;; Convert defcustom to a simpler (and less space-consuming) defvar, | |
| 305 ;; but add some extra stuff if it uses :require. | |
| 306 ((eq car 'defcustom) | |
| 307 (let ((varname (car-safe (cdr-safe form))) | |
| 308 (init (car-safe (cdr-safe (cdr-safe form)))) | |
| 309 (doc (car-safe (cdr-safe (cdr-safe (cdr-safe form))))) | |
| 310 (rest (cdr-safe (cdr-safe (cdr-safe (cdr-safe form)))))) | |
| 311 (if (not (plist-get rest :require)) | |
| 312 `(defvar ,varname ,init ,doc) | |
| 313 `(progn | |
| 314 (defvar ,varname ,init ,doc) | |
| 315 (custom-add-to-group ,(plist-get rest :group) | |
| 316 ',varname 'custom-variable) | |
| 317 (custom-add-load ',varname | |
| 318 ,(plist-get rest :require)))))) | |
| 4303 | 319 ;; Coding systems. #### Would be nice to handle the docstring here too. |
| 320 ((memq car '(make-coding-system make-8-bit-coding-system)) | |
| 321 `(autoload-coding-system ,(nth 1 form) '(load ,file))) | |
| 2548 | 322 ;; nil here indicates that this is not a special autoload form. |
| 323 (t nil)))) | |
| 428 | 324 |
| 996 | 325 (defun make-c-autoload (module) |
| 326 "Make an autoload list for the DEFUN at point in MODULE. | |
| 327 Returns nil if the DEFUN is malformed." | |
| 328 (and | |
| 329 ;; Match the DEFUN | |
| 330 (search-forward "DEFUN" nil t) | |
| 331 ;; Match the opening parenthesis | |
| 332 (progn | |
| 333 (skip-syntax-forward " ") | |
| 334 (eq (char-after) ?\()) | |
| 335 ;; Match the opening quote of the Lisp function name | |
| 336 (progn | |
| 337 (forward-char) | |
| 338 (skip-syntax-forward " ") | |
| 339 (eq (char-after) ?\")) | |
| 340 ;; Extract the Lisp function name, interactive indicator, and docstring | |
| 341 (let* ((func-name (let ((begin (progn (forward-char) (point)))) | |
| 342 (search-forward "\"" nil t) | |
| 343 (backward-char) | |
| 344 (intern (buffer-substring begin (point))))) | |
| 345 (interact (progn | |
| 346 (search-forward "," nil t 4) | |
| 347 (skip-syntax-forward " ") | |
| 348 (not (eq (char-after) ?0)))) | |
| 349 (begin (progn | |
| 350 (search-forward "/*" nil t) | |
| 351 (forward-line 1) | |
| 352 (point)))) | |
| 353 (search-forward "*/" nil t) | |
| 354 (goto-char (match-beginning 0)) | |
| 355 (skip-chars-backward " \t\n\f") | |
| 356 (list 'autoload (list 'quote func-name) module | |
| 357 (buffer-substring begin (point)) interact nil)))) | |
| 358 | |
| 1232 | 359 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 360 ;; Generating autoloads for a single file | |
| 428 | 361 |
| 362 ;;;###autoload | |
| 2548 | 363 (defun generate-file-autoloads (file) |
| 1232 | 364 "Insert at point an autoload section for FILE. |
| 428 | 365 autoloads are generated for defuns and defmacros in FILE |
| 366 marked by `generate-autoload-cookie' (which see). | |
| 367 If FILE is being visited in a buffer, the contents of the buffer | |
| 368 are used." | |
| 369 (interactive "fGenerate autoloads for file: ") | |
| 1232 | 370 (cond ((string-match "\\.el$" file) |
| 2548 | 371 (generate-autoload-type-section |
| 1298 | 372 file |
| 373 (replace-in-string (file-name-nondirectory file) "\\.elc?$" "") | |
| 2548 | 374 nil #'generate-lisp-file-autoloads-1)) |
| 1232 | 375 ;; #### jj, are C++ modules possible? |
| 376 ((string-match "\\.c$" file) | |
| 2548 | 377 (generate-autoload-type-section |
| 1298 | 378 file |
| 379 (replace-in-string (file-name-nondirectory file) "\\.c$" "") | |
| 2548 | 380 t #'generate-c-file-autoloads-1)) |
| 1232 | 381 (t |
| 382 (error 'wrong-type-argument file "not a C or Elisp source file")))) | |
| 428 | 383 |
| 2548 | 384 (defun* generate-autoload-type-section (file load-name literal fun-to-call) |
| 1298 | 385 "Insert at point an autoload-type section for FILE. |
| 2548 | 386 LOAD-NAME is the non-directory portion of the name, with the final .el, .elc |
| 387 or .c section removed. If LITERAL, open the file literally, without decoding. | |
| 388 Calls FUN-TO-CALL to compute the autoloads, with the loaded file in the | |
| 389 current buffer, passing it OUTBUF (where to write the autoloads), LOAD-NAME, | |
| 390 and TRIM-NAME (result of calling `autoload-trim-file-name' on FILE)." | |
| 428 | 391 (let ((outbuf (current-buffer)) |
| 1298 | 392 (trim-name (autoload-trim-file-name file)) |
| 428 | 393 (autoloads-done '()) |
| 394 (print-length nil) | |
| 395 (print-readably t) ; XEmacs | |
| 396 (float-output-format nil) | |
| 1298 | 397 (visited (get-file-buffer file)) |
| 2548 | 398 suppress-form |
| 428 | 399 ;; (done-any nil) |
| 400 output-end) | |
| 401 | |
| 402 ;; If the autoload section we create here uses an absolute | |
| 403 ;; pathname for FILE in its header, and then Emacs is installed | |
| 404 ;; under a different path on another system, | |
| 405 ;; `update-autoloads-here' won't be able to find the files to be | |
| 406 ;; autoloaded. So, if FILE is in the same directory or a | |
| 407 ;; subdirectory of the current buffer's directory, we'll make it | |
| 408 ;; relative to the current buffer's directory. | |
| 409 (setq file (expand-file-name file)) | |
| 2548 | 410 ;; #### FSF 21.2. Do we want this? |
| 411 ; (let* ((source-truename (file-truename file)) | |
| 412 ; (dir-truename (file-name-as-directory | |
| 413 ; (file-truename default-directory))) | |
| 414 ; (len (length dir-truename))) | |
| 415 ; (if (and (< len (length source-truename)) | |
| 416 ; (string= dir-truename (substring source-truename 0 len))) | |
| 417 ; (setq file (substring source-truename len)))) | |
| 418 | |
| 419 ;; Check for suppression form (XEmacs) | |
| 420 (let* ((dir (file-name-directory file)) | |
| 421 (_pkg (expand-file-name "_pkg.el" dir)) | |
| 422 (pkg-vis (get-file-buffer _pkg)) | |
| 423 pkg-buf) | |
| 424 (save-excursion | |
| 425 (when (file-readable-p _pkg) | |
| 426 (unwind-protect | |
| 427 (progn | |
| 428 (let ((find-file-hooks nil) | |
| 429 (enable-local-variables nil)) | |
| 430 (set-buffer (or pkg-vis (find-file-noselect _pkg))) | |
| 431 (set-syntax-table emacs-lisp-mode-syntax-table)) | |
| 432 (save-excursion | |
| 433 (save-restriction | |
| 434 (widen) | |
| 435 (goto-char (point-min)) | |
| 436 (block nil | |
| 437 (while (search-forward "(package-suppress" nil t) | |
| 438 ;; skip over package-name | |
| 439 (forward-sexp 1) | |
| 440 (let ((supfile (read (current-buffer)))) | |
| 441 (when (equal supfile load-name) | |
| 442 (setq suppress-form (eval (read (current-buffer)))) | |
| 443 (return)))))))) | |
| 444 (unless pkg-vis | |
| 445 ;; We created this buffer, so we should kill it. | |
| 446 (if pkg-buf (kill-buffer pkg-buf))))))) | |
| 428 | 447 |
| 448 (save-excursion | |
| 449 (unwind-protect | |
| 450 (progn | |
| 2548 | 451 (let (;(find-file-hooks nil) |
| 452 ;(enable-local-variables nil) | |
| 453 ) | |
| 1298 | 454 (set-buffer (or visited (find-file-noselect file literal literal |
| 455 ))) | |
| 456 ;; This doesn't look right for C files, but it is. The only | |
| 457 ;; place we need the syntax table is when snarfing the Lisp | |
| 458 ;; function name. | |
| 460 | 459 (set-syntax-table emacs-lisp-mode-syntax-table)) |
| 2548 | 460 ; (if visited |
| 461 ; (set-buffer visited) | |
| 462 ; ;; It is faster to avoid visiting the file. | |
| 463 ; (set-buffer (get-buffer-create " *generate-autoload-file*")) | |
| 464 ; (kill-all-local-variables) | |
| 465 ; (erase-buffer) | |
| 466 ; (setq buffer-undo-list t | |
| 467 ; buffer-read-only nil) | |
| 468 ; ;; This doesn't look right for C files, but it is. The only | |
| 469 ; ;; place we need the syntax table is when snarfing the Lisp | |
| 470 ; ;; function name. | |
| 471 ; (emacs-lisp-mode) | |
| 472 ; (if literal | |
| 473 ; (insert-file-contents-literally file nil) | |
| 474 ; (insert-file-contents file nil))) | |
| 1298 | 475 (unless (setq autoloads-done |
| 2548 | 476 (funcall fun-to-call outbuf load-name trim-name)) |
| 477 (return-from generate-autoload-type-section)) | |
| 1298 | 478 ) |
| 428 | 479 (unless visited |
| 1298 | 480 ;; We created this buffer, so we should kill it. |
| 481 (kill-buffer (current-buffer))) | |
| 428 | 482 (set-buffer outbuf) |
| 483 (setq output-end (point-marker)))) | |
| 484 (if t ;; done-any | |
| 485 ;; XEmacs -- always do this so that we cache the information | |
| 486 ;; that we've processed the file already. | |
| 487 (progn | |
| 2548 | 488 ;; Insert the section-header line |
| 489 ;; which lists the file name and which functions are in it, etc. | |
| 428 | 490 (insert generate-autoload-section-header) |
| 2548 | 491 (prin1 (list 'autoloads autoloads-done load-name trim-name |
| 492 ;; In FSF 21.2. Also in FSF 19.30. Presumably | |
| 493 ;; deleted from XEmacs. | |
| 494 ;; (nth 5 (file-attributes file)) | |
| 495 ) | |
| 428 | 496 outbuf) |
| 497 (terpri outbuf) | |
| 2548 | 498 ;; #### Alas, we will have to think about this. Adding this means |
| 499 ;; that, once we have created or maintained an auto-autoloads file, | |
| 500 ;; we alone and our successors can update the file. The file itself | |
| 501 ;; will work fine in older XEmacsen, but they won't be able to | |
| 502 ;; update autoloads -- hence, to build. | |
| 503 ; ;; Break that line at spaces, to avoid very long lines. | |
| 504 ; ;; Make each sub-line into a comment. | |
| 505 ; (with-current-buffer outbuf | |
| 506 ; (save-excursion | |
| 507 ; (forward-line -1) | |
| 508 ; (while (not (eolp)) | |
| 509 ; (move-to-column 64) | |
| 510 ; (skip-chars-forward "^ \n") | |
| 511 ; (or (eolp) | |
| 512 ; (insert "\n" generate-autoload-section-continuation))))) | |
| 513 ;; XEmacs: This was commented out before. #### Correct? | |
| 514 ; (insert ";;; Generated autoloads from " | |
| 515 ; (autoload-trim-file-name file) "\n") | |
| 516 ;; XEmacs -- handle suppression | |
| 517 (when suppress-form | |
| 518 (insert "\n;;; Suppress form from _pkg.el\n") | |
| 519 (insert "(unless " (prin1-to-string suppress-form) "\n\n")) | |
| 428 | 520 (goto-char output-end) |
| 2548 | 521 ;; XEmacs -- handle suppression |
| 522 (when suppress-form | |
| 523 (insert "\n) ;; unless (suppressed)\n")) | |
| 428 | 524 (insert generate-autoload-section-trailer))) |
| 2548 | 525 )) |
| 526 | |
| 428 | 527 |
| 2548 | 528 (defun process-one-lisp-autoload (autoloads-done outbuf load-name) |
| 529 "Process a single autoload at point and write to OUTBUF. | |
| 530 Point should be just after a magic cookie string (e.g. ;;;###autoload). | |
| 531 Updates AUTOLOADS-DONE and returns the new value." | |
| 532 (skip-chars-forward " \t") | |
| 533 ;; (setq done-any t) | |
| 534 (if (eolp) | |
| 535 ;; Read the next form and make an autoload. | |
| 536 (let* ((form (prog1 (read (current-buffer)) | |
| 537 (or (bolp) (forward-line 1)))) | |
| 538 (autoload (make-autoload form load-name))) | |
| 539 (if autoload | |
| 540 (setq autoloads-done (cons (nth 1 form) | |
| 541 autoloads-done)) | |
| 542 (setq autoload form)) | |
| 543 (autoload-print-form autoload outbuf "")) | |
| 544 ;; Copy the rest of the line to the output. | |
| 545 (cond ((looking-at "immediate\\s *$") ; XEmacs | |
| 546 ;; This is here so that you can automatically | |
| 547 ;; have small hook functions copied to | |
| 548 ;; auto-autoloads.el so that it's not necessary | |
| 549 ;; to load a whole file just to get a two-line | |
| 550 ;; do-nothing find-file-hook... --Stig | |
| 551 (forward-line 1) | |
| 552 (let ((begin (point))) | |
| 553 (forward-sexp) | |
| 554 (forward-line 1) | |
|
4332
6ad202d453cb
Insert <immediate> into section header for immediate autoloads.
Mike Sperber <sperber@deinprogramm.de>
parents:
4303
diff
changeset
|
555 (princ (buffer-substring begin (point)) outbuf)) |
|
6ad202d453cb
Insert <immediate> into section header for immediate autoloads.
Mike Sperber <sperber@deinprogramm.de>
parents:
4303
diff
changeset
|
556 (setq autoloads-done (cons '<immediate> autoloads-done))) |
| 2548 | 557 (t |
| 558 (princ (buffer-substring | |
| 559 (progn | |
| 560 ;; Back up over whitespace, to preserve it. | |
| 561 (skip-chars-backward " \f\t") | |
| 562 (if (= (char-after (1+ (point))) ? ) | |
| 563 ;; Eat one space. | |
| 564 (forward-char 1)) | |
| 565 (point)) | |
| 566 (progn (forward-line 1) (point))) | |
| 567 outbuf)))) | |
| 568 autoloads-done) | |
| 569 | |
| 570 (defun* generate-lisp-file-autoloads-1 (outbuf load-name trim-name) | |
| 571 "Insert at point in OUTBUF an autoload section for an Elisp file. | |
| 572 The file is assumed to be already loaded and in the current buffer. | |
| 573 autoloads are generated for defuns and defmacros marked by | |
| 574 `generate-autoload-cookie' (which see)." | |
| 1298 | 575 (let ((autoloads-done '()) |
| 576 ) | |
| 577 (save-excursion | |
| 578 (save-restriction | |
| 579 (widen) | |
| 580 (goto-char (point-min)) | |
| 581 (unless (search-forward generate-autoload-cookie nil t) | |
| 582 (message "No autoloads found in %s" trim-name) | |
| 2548 | 583 (return-from generate-lisp-file-autoloads-1 nil)) |
| 1298 | 584 |
| 585 (message "Generating autoloads for %s..." trim-name) | |
| 586 (goto-char (point-min)) | |
| 2548 | 587 (while (not (eobp)) |
| 588 (skip-chars-forward " \t\n\f") | |
| 1298 | 589 (cond |
| 2548 | 590 ((looking-at (regexp-quote generate-autoload-cookie)) |
| 591 (search-forward generate-autoload-cookie) | |
| 592 (setq autoloads-done | |
| 593 (process-one-lisp-autoload autoloads-done outbuf load-name))) | |
| 1298 | 594 ((looking-at ";") |
| 595 ;; Don't read the comment. | |
| 596 (forward-line 1)) | |
| 597 (t | |
| 598 (forward-sexp 1) | |
| 599 (forward-line 1))) | |
| 2548 | 600 ))) |
| 601 (or noninteractive ; XEmacs: only need one line in -batch mode. | |
| 602 (message "Generating autoloads for %s...done" trim-name)) | |
| 1298 | 603 autoloads-done)) |
| 604 | |
| 2548 | 605 (defun* generate-c-file-autoloads-1 (outbuf load-name trim-name |
| 606 &optional funlist) | |
| 1232 | 607 "Insert at point an autoload section for the C file FILE. |
| 1048 | 608 autoloads are generated for defuns and defmacros in FILE |
| 996 | 609 marked by `generate-c-autoload-cookie' (which see). |
| 610 If FILE is being visited in a buffer, the contents of the buffer | |
| 611 are used." | |
| 1733 | 612 (let ((exists-p-format |
| 613 "(when (locate-file \"%s\" module-load-path module-extensions)\n") | |
| 614 autoloads-done) | |
| 996 | 615 (save-excursion |
| 1298 | 616 (save-restriction |
| 617 (widen) | |
| 618 (goto-char (point-min)) | |
| 619 ;; Is there a module name comment? | |
| 620 (when (search-forward generate-c-autoload-module nil t) | |
| 621 (skip-chars-forward " \t") | |
| 622 (let ((begin (point))) | |
| 623 (skip-chars-forward "^ \t\n\f") | |
| 624 (setq load-name (buffer-substring begin (point))))) | |
| 625 (if funlist | |
| 626 (progn | |
| 627 (message "Generating autoloads for %s..." trim-name) | |
| 1733 | 628 (princ (format exists-p-format load-name) outbuf) |
| 1298 | 629 (dolist (arg funlist) |
| 996 | 630 (goto-char (point-min)) |
| 1298 | 631 (re-search-forward |
| 632 (concat "DEFUN (\"" | |
| 633 (regexp-quote (symbol-name arg)) | |
| 634 "\"")) | |
| 635 (goto-char (match-beginning 0)) | |
| 636 (let ((autoload (make-c-autoload load-name))) | |
| 637 (when autoload | |
| 638 (push (nth 1 (nth 1 autoload)) autoloads-done) | |
| 2548 | 639 (autoload-print-form autoload outbuf " ")))) |
| 1298 | 640 ;; close the princ'd `when' form |
| 641 (princ ")" outbuf)) | |
| 642 (goto-char (point-min)) | |
| 643 (let ((match | |
| 644 (search-forward generate-c-autoload-cookie nil t))) | |
| 645 (unless match | |
| 646 (message "No autoloads found in %s" trim-name) | |
| 647 (return-from generate-c-file-autoloads-1 nil)) | |
| 648 | |
| 649 (message "Generating autoloads for %s..." trim-name) | |
| 1733 | 650 (princ (format exists-p-format load-name) outbuf) |
| 1298 | 651 (while match |
| 652 (forward-line 1) | |
| 653 (let ((autoload (make-c-autoload load-name))) | |
| 654 (when autoload | |
| 655 (push (nth 1 (nth 1 autoload)) autoloads-done) | |
| 2548 | 656 (autoload-print-form autoload outbuf " "))) |
| 1298 | 657 (setq match |
| 658 (search-forward generate-c-autoload-cookie nil t))) | |
| 659 ;; close the princ'd `when' form | |
| 660 (princ ")" outbuf))))) | |
| 2548 | 661 (or noninteractive ; XEmacs: only need one line in -batch mode. |
| 662 (message "Generating autoloads for %s...done" trim-name)) | |
| 1298 | 663 autoloads-done)) |
| 996 | 664 |
| 2548 | 665 ;;;###autoload |
| 666 (defun generate-custom-defines (file) | |
| 667 "Insert at point a custom-define section for FILE. | |
| 668 If FILE is being visited in a buffer, the contents of the buffer | |
| 669 are used." | |
| 670 (interactive "fGenerate custom defines for file: ") | |
| 671 (cond ((string-match "\\.el$" file) | |
| 672 (generate-autoload-type-section | |
| 673 file | |
| 674 (replace-in-string (file-name-nondirectory file) "\\.elc?$" "") | |
| 675 nil #'generate-custom-defines-1)) | |
| 676 ((string-match "\\.c$" file) | |
| 677 ;; no way to generate custom-defines for C files (currently?), | |
| 678 ;; but cannot signal an error. | |
| 679 nil) | |
| 680 (t | |
| 681 (error 'wrong-type-argument file "not a C or Elisp source file")))) | |
| 1232 | 682 |
| 2548 | 683 (defun* generate-custom-defines-1 (outbuf load-name trim-name) |
| 684 "Insert at point in OUTBUF a custom-define section for an Elisp file. | |
| 685 This contains all defcustoms and defgroups in the file. | |
| 686 The file is assumed to be already loaded and in the current buffer." | |
| 687 (let* ((search-regexp-1 "^(\\(defcustom\\|defgroup\\) ") | |
| 688 (search-string-2 ";;;###custom-define") | |
| 689 (search-regexp-2 (regexp-quote search-string-2)) | |
| 690 (autoloads-done '())) | |
| 691 (save-excursion | |
| 692 (save-restriction | |
| 693 (widen) | |
| 694 (goto-char (point-min)) | |
| 695 (unless (or (re-search-forward search-regexp-1 nil t) | |
| 696 (re-search-forward search-regexp-2 nil t)) | |
| 697 (message "No custom defines found in %s" trim-name) | |
| 698 (return-from generate-custom-defines-1 nil)) | |
| 699 (message "Generating custom defines for %s..." trim-name) | |
| 700 (princ "(defconst custom-define-current-source-file " outbuf) | |
| 701 (prin1 (file-relative-name (buffer-file-name) | |
| 702 (symbol-value-in-buffer 'default-directory | |
| 703 outbuf)) outbuf) | |
| 704 (princ ")\n" outbuf) | |
| 705 | |
| 706 (goto-char (point-min)) | |
| 707 (while (not (eobp)) | |
| 708 (skip-chars-forward " \t\n\f") | |
| 709 (cond | |
| 710 ((looking-at search-regexp-1) | |
| 711 ;; Read the next form and copy it to make an autoload. | |
| 712 (let* ((form (prog1 (read (current-buffer)) | |
| 713 (or (bolp) (forward-line 1)))) | |
| 714 (autoload form ;(make-autoload form load-name) | |
| 715 )) | |
| 716 (if autoload | |
| 717 (setq autoloads-done (cons (nth 1 form) | |
| 718 autoloads-done)) | |
| 719 (setq autoload form)) | |
| 720 (autoload-print-form autoload outbuf "")) | |
| 721 ) | |
| 722 ((looking-at search-regexp-2) | |
| 723 (search-forward search-string-2) | |
| 724 (beep) | |
| 725 (setq autoloads-done | |
| 726 (process-one-lisp-autoload autoloads-done outbuf load-name))) | |
| 727 ((looking-at ";") | |
| 728 ;; Don't read the comment. | |
| 729 (forward-line 1)) | |
| 730 (t | |
| 731 (forward-sexp 1) | |
| 732 (forward-line 1))) | |
| 733 ))) | |
| 734 (or noninteractive ; XEmacs: only need one line in -batch mode. | |
| 735 (message "Generating custom defines for %s...done" trim-name)) | |
| 736 autoloads-done)) | |
| 737 | |
| 738 ;; Assorted utilities for generating autoloads and pieces thereof | |
| 739 | |
| 740 (defun autoload-print-form (form outbuf margin) | |
| 996 | 741 "Print an autoload form, handling special characters. |
| 742 In particular, print docstrings with escapes inserted before left parentheses | |
| 743 at the beginning of lines and ^L characters." | |
| 2548 | 744 (cond |
| 745 ;; If the form is a sequence, recurse. | |
| 746 ((eq (car form) 'progn) | |
| 747 (mapcar #'(lambda (x) (autoload-print-form x outbuf margin)) | |
| 748 (cdr form))) | |
| 749 ;; Symbols at the toplevel are meaningless. | |
| 750 ((symbolp form) nil) | |
| 751 (t | |
| 752 (let ((doc-string-elt (get (car-safe form) 'doc-string-elt))) | |
| 753 (if (and doc-string-elt (stringp (nth doc-string-elt form))) | |
| 754 ;; We need to hack the printing because the doc-string must be | |
| 755 ;; printed specially for make-docfile (sigh). | |
| 756 (let* ((p (nthcdr (1- doc-string-elt) form)) | |
| 757 (elt (cdr p)) | |
| 758 (start-string (format "\n%s(" margin))) | |
| 759 (setcdr p nil) | |
| 760 (princ start-string outbuf) | |
| 761 ;; XEmacs change: don't let ^^L's get into | |
| 762 ;; the file or sorting is hard. | |
| 763 (let ((print-escape-newlines t) | |
| 764 ;;#### FSF 21.2 (print-escape-nonascii t) | |
| 765 (p (point outbuf)) | |
| 766 p2) | |
|
4783
e29fcfd8df5f
Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4702
diff
changeset
|
767 (mapc #'(lambda (elt) |
|
e29fcfd8df5f
Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4702
diff
changeset
|
768 (prin1 elt outbuf) |
|
e29fcfd8df5f
Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4702
diff
changeset
|
769 (princ " " outbuf)) |
|
e29fcfd8df5f
Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4702
diff
changeset
|
770 form) |
| 2548 | 771 (with-current-buffer outbuf |
| 772 (setq p2 (point-marker)) | |
| 773 (goto-char p) | |
| 774 (save-match-data | |
| 775 (while (search-forward "\^L" p2 t) | |
| 776 (delete-char -1) | |
| 777 (insert "\\^L"))) | |
| 778 (goto-char p2))) | |
| 779 (princ "\"\\\n" outbuf) | |
| 780 (let ((begin (point outbuf))) | |
| 781 (princ (substring (prin1-to-string (car elt)) 1) outbuf) | |
| 782 ;; Insert a backslash before each ( that appears at the beginning | |
| 783 ;; of a line in the doc string. | |
| 784 (with-current-buffer outbuf | |
| 785 (save-excursion | |
| 786 (while (search-backward start-string begin t) | |
| 787 (forward-char 1) | |
| 788 (insert "\\")))) | |
| 789 (if (null (cdr elt)) | |
| 790 (princ ")" outbuf) | |
| 791 (princ " " outbuf) | |
| 792 (princ (substring (prin1-to-string (cdr elt)) 1) outbuf)) | |
| 793 (terpri outbuf) | |
| 794 (princ margin outbuf))) | |
| 795 ;; XEmacs change: another ^L hack | |
| 796 (let ((p (point outbuf)) | |
| 797 (print-escape-newlines t) | |
| 798 ;;#### FSF 21.2 (print-escape-nonascii t) | |
| 996 | 799 p2) |
| 2548 | 800 (print form outbuf) |
| 801 (with-current-buffer outbuf | |
| 996 | 802 (setq p2 (point-marker)) |
| 803 (goto-char p) | |
| 804 (save-match-data | |
| 805 (while (search-forward "\^L" p2 t) | |
| 806 (delete-char -1) | |
| 807 (insert "\\^L"))) | |
| 2548 | 808 (goto-char p2)))))))) |
| 996 | 809 |
| 1232 | 810 (defun autoload-trim-file-name (file) |
| 811 "Returns relative pathname of FILE including the last directory. | |
| 428 | 812 |
| 1232 | 813 Hard-codes the directory separator as a forward slash." |
| 814 (setq file (expand-file-name file)) | |
| 815 (replace-in-string | |
| 816 (file-relative-name file (file-name-directory | |
| 817 (directory-file-name | |
| 818 (file-name-directory file)))) | |
| 819 ;; #### is this a good idea? | |
| 820 "\\\\" "/")) | |
| 428 | 821 |
| 2548 | 822 (defun autoload-read-section-header () |
| 823 "Read a section header form. | |
| 824 Since continuation lines have been marked as comments, | |
| 825 we must copy the text of the form and remove those comment | |
| 826 markers before we call `read'." | |
| 827 (save-match-data | |
| 828 (let ((beginning (point)) | |
| 829 string) | |
| 830 (forward-line 1) | |
| 831 (while (looking-at generate-autoload-section-continuation) | |
| 832 (forward-line 1)) | |
| 833 (setq string (buffer-substring beginning (point))) | |
| 834 (with-current-buffer (get-buffer-create " *autoload*") | |
| 835 (erase-buffer) | |
| 836 (insert string) | |
| 837 (goto-char (point-min)) | |
| 838 (while (search-forward generate-autoload-section-continuation nil t) | |
| 839 (replace-match " ")) | |
| 840 (goto-char (point-min)) | |
| 841 (read (current-buffer)))))) | |
| 842 | |
| 428 | 843 ;;;###autoload |
| 844 (defun update-file-autoloads (file) | |
| 845 "Update the autoloads for FILE in `generated-autoload-file' | |
| 846 \(which FILE might bind in its local variables). | |
| 1232 | 847 This function is a no-op for an autoloads file (ie, a file whose name is |
| 848 equal to `autoload-file-name')." | |
| 428 | 849 (interactive "fUpdate autoloads for file: ") |
| 850 (setq file (expand-file-name file)) | |
| 851 (when (and (file-newer-than-file-p file generated-autoload-file) | |
| 852 (not (member (file-name-nondirectory file) | |
| 853 (list autoload-file-name)))) | |
| 854 | |
| 855 (let ((load-name (replace-in-string (file-name-nondirectory file) | |
| 996 | 856 "\\.\\(elc?\\|c\\)$" |
| 428 | 857 "")) |
| 858 (trim-name (autoload-trim-file-name file)) | |
| 859 section-begin form) | |
| 860 (save-excursion | |
| 2548 | 861 ;; FSF has: [[ We want to get a value for generated-autoload-file |
| 862 ;; from the local variables section if it's there. ]] Not | |
| 863 ;; applicable in XEmacs, since we always keep the autoloads | |
| 864 ;; up-to-date. | |
| 865 | |
| 866 ;; #### FSF 21.2 adds: [[ We must read/write the file without any | |
| 867 ;; code conversion, but still decode EOLs. ]] Not clear if we need | |
| 868 ;; this. --ben | |
| 869 ;; (let ((coding-system-for-read 'raw-text)) | |
| 428 | 870 (let ((find-file-hooks nil)) |
| 871 (set-buffer (or (get-file-buffer generated-autoload-file) | |
| 872 (find-file-noselect generated-autoload-file)))) | |
| 2548 | 873 ;; FSF 21.2 says: |
| 874 | |
| 875 ;; [[ This is to make generated-autoload-file have Unix EOLs, so | |
| 876 ;; that it is portable to all platforms. ]] | |
| 877 ;; (setq buffer-file-coding-system 'raw-text-unix)) | |
| 878 ;; Not applicable in XEmacs, since we always keep the autoloads | |
| 879 ;; up-to-date and recompile when we build. | |
| 880 | |
| 881 ;; FSF 21.2: [not applicable to XEmacs] | |
| 882 ; (or (> (buffer-size) 0) | |
| 883 ; (error "Autoloads file %s does not exist" buffer-file-name)) | |
| 884 ; (or (file-writable-p buffer-file-name) | |
| 885 ; (error "Autoloads file %s is not writable" buffer-file-name)) | |
| 886 | |
| 887 ;; NOTE: The rest of this function is totally changed from FSF. | |
| 888 ;; Hence, not synched. | |
| 889 | |
| 428 | 890 ;; Make sure we can scribble in it. |
| 891 (setq buffer-read-only nil) | |
| 892 ;; First delete all sections for this file. | |
| 893 (goto-char (point-min)) | |
| 894 (while (search-forward generate-autoload-section-header nil t) | |
| 895 (setq section-begin (match-beginning 0)) | |
| 2548 | 896 (setq form (autoload-read-section-header)) |
| 428 | 897 (when (string= (nth 2 form) load-name) |
| 898 (search-forward generate-autoload-section-trailer) | |
| 899 (delete-region section-begin (point)))) | |
| 900 | |
| 901 ;; Now find insertion point for new section | |
| 902 (block find-insertion-point | |
| 903 (goto-char (point-min)) | |
| 904 (while (search-forward generate-autoload-section-header nil t) | |
| 2548 | 905 (setq form (autoload-read-section-header)) |
| 428 | 906 (when (string< trim-name (nth 3 form)) |
| 907 ;; Found alphabetically correct insertion point | |
| 908 (goto-char (match-beginning 0)) | |
| 909 (return-from find-insertion-point)) | |
| 910 (search-forward generate-autoload-section-trailer)) | |
| 911 (when (eq (point) (point-min)) ; No existing entries? | |
| 912 (goto-char (point-max)))) ; Append. | |
| 913 | |
| 914 ;; Add in new sections for file | |
| 2548 | 915 (funcall generate-autoload-function file)) |
| 428 | 916 |
| 917 (when (interactive-p) (save-buffer))))) | |
| 918 | |
| 1232 | 919 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 920 ;; Utilities for batch updates | |
| 921 | |
| 922 ;;;###autoload | |
| 2548 | 923 (defun batch-update-directory-autoloads () |
| 1232 | 924 "Update the autoloads for a directory, using a specified feature prefix. |
| 925 Must be used only with -batch. The feature prefix and directory to update | |
| 926 are taken from the first and second elements of `command-line-args-left', | |
| 927 respectively, and they are then removed from `command-line-args-left'. | |
| 928 | |
| 929 Runs `update-file-autoloads' on each file in the given directory. Always | |
| 930 rewrites the autoloads file, even if unchanged. Makes a feature name by | |
| 931 applying `autoload-make-feature-name' to the specified feature prefix. | |
| 932 | |
| 933 #### The API and semantics of this function are subject to change." | |
| 934 (unless noninteractive | |
| 2548 | 935 (error "batch-update-directory-autoloads: may be used only with -batch")) |
| 936 (update-autoload-files (list (cadr command-line-args-left)) | |
| 937 (car command-line-args-left) nil t) | |
| 938 (setq command-line-args-left (cddr command-line-args-left))) | |
| 1232 | 939 |
| 940 ;;;###autoload | |
| 2548 | 941 (defun batch-update-directory-custom-defines () |
| 942 "Update the custom defines for a directory, using a specified feature prefix. | |
| 943 Must be used only with -batch. The feature prefix and directory to update | |
| 944 are taken from the first and second elements of `command-line-args-left', | |
| 945 respectively, and they are then removed from `command-line-args-left'. | |
| 946 | |
| 947 Runs `update-file-autoloads' on each file in the given directory. Always | |
| 948 rewrites the autoloads file, even if unchanged. Makes a feature name by | |
| 949 applying `autoload-make-feature-name' to the specified feature prefix. | |
| 950 | |
| 951 #### The API and semantics of this function are subject to change." | |
| 952 (unless noninteractive | |
| 953 (error "batch-update-directory-custom-defines: may be used only with -batch")) | |
| 954 (update-custom-define-files (list (cadr command-line-args-left)) | |
| 955 (car command-line-args-left) nil t) | |
| 956 (setq command-line-args-left (cddr command-line-args-left))) | |
| 957 | |
| 958 ;;;###autoload | |
| 959 (defun update-autoload-files (files-or-dirs feature-prefix | |
| 960 &optional into-file force) | |
| 1232 | 961 "Update all the autoload files associated with FILES-OR-DIRS. |
| 962 FILES-OR-DIRS is a list of files and/or directories to be processed. | |
| 963 | |
| 964 An appropriate autoload file is chosen and a feature constructed for | |
| 965 each element of FILES-OR-DIRS. Fixup code testing for the autoload file's | |
| 966 feature and to provide the feature is added. | |
| 967 | |
| 2548 | 968 If optional INTO-FILE is non-`nil', it should specify a file into which |
| 969 the autoloads will be placed. Otherwise, the autoloads will be placed into | |
| 970 a file named `auto-autoloads.el' in the directory of each element in | |
| 971 FILES-OR-DIRS. | |
| 972 | |
| 973 FEATURE-PREFIX should be set to an appropriate prefix which will | |
| 974 be concatenated with \"-autoloads\" to produce the feature name. Otherwise | |
| 975 the appropriate autoload file for each file or directory (located in that | |
| 976 directory, or in the directory of the specified file) will be updated with | |
| 977 the directory's or file's autoloads and the protective forms will be added, | |
| 978 and the files will be saved. Use of the default here is unreliable, and | |
| 979 therefore deprecated. | |
| 1232 | 980 |
| 981 Note that if some of FILES-OR-DIRS are directories, recursion goes only | |
| 982 one level deep. | |
| 983 | |
| 984 If FORCE is non-nil, always save out the autoload files even if unchanged." | |
| 2548 | 985 (or (listp files-or-dirs) (setq files-or-dirs (list files-or-dirs))) |
| 1232 | 986 (let ((defdir (directory-file-name default-directory)) |
| 987 ;; value for all-into-one-file | |
| 2548 | 988 (autoload-feature-name (autoload-make-feature-name feature-prefix)) |
| 989 (enable-local-eval nil) ; Don't query in batch mode. | |
| 990 (autoload-feature-prefix feature-prefix) | |
| 991 ;; protect from change | |
| 992 (generated-autoload-file generated-autoload-file)) | |
| 1232 | 993 (dolist (arg files-or-dirs) |
| 994 (setq arg (expand-file-name arg defdir)) | |
| 995 (cond | |
| 996 ((file-directory-p arg) | |
| 2548 | 997 (setq generated-autoload-file |
| 998 (or into-file (expand-file-name autoload-file-name arg))) | |
| 1232 | 999 (message "Updating autoloads for directory %s..." arg) |
| 2548 | 1000 (let ((simple-dir (file-name-as-directory |
| 1001 (file-name-nondirectory | |
| 1002 (directory-file-name arg)))) | |
| 1003 (enable-local-eval nil)) | |
| 1004 (save-excursion | |
| 1005 (let ((find-file-hooks nil)) | |
| 1006 (set-buffer (find-file-noselect generated-autoload-file))) | |
| 1007 (goto-char (point-min)) | |
| 1008 (while (search-forward generate-autoload-section-header nil t) | |
| 1009 (let* ((begin (match-beginning 0)) | |
| 1010 (form (autoload-read-section-header)) | |
| 1011 (file (nth 3 form))) | |
| 1012 (when (and (stringp file) | |
| 1013 (string= (file-name-directory file) simple-dir) | |
| 1014 (not (file-exists-p | |
| 1015 (expand-file-name | |
| 1016 (file-name-nondirectory file) arg)))) | |
| 1017 ;; Remove the obsolete section. | |
| 1018 (search-forward generate-autoload-section-trailer) | |
| 1019 (delete-region begin (point))))) | |
| 1020 ;; Update or create autoload sections for existing files. | |
|
4783
e29fcfd8df5f
Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4702
diff
changeset
|
1021 (mapc 'update-file-autoloads |
|
e29fcfd8df5f
Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4702
diff
changeset
|
1022 (directory-files arg t "^[^=].*\\.\\(el\\|c\\)$"))))) |
| 1232 | 1023 ((file-exists-p arg) |
| 2548 | 1024 (setq generated-autoload-file |
| 1025 (or into-file (expand-file-name autoload-file-name | |
| 1026 (file-name-directory arg)))) | |
| 1232 | 1027 (update-file-autoloads arg)) |
| 1028 (t (error "No such file or directory: %s" arg))) | |
| 2548 | 1029 (when (not into-file) |
| 1232 | 1030 (autoload-featurep-protect-autoloads |
| 1031 (autoload-make-feature-name | |
| 2548 | 1032 (or feature-prefix |
| 1033 (file-name-nondirectory (directory-file-name arg))))) | |
| 1232 | 1034 (if force (set-buffer-modified-p |
| 1035 t (find-file-noselect generated-autoload-file))))) | |
| 2548 | 1036 (when into-file |
| 1232 | 1037 (autoload-featurep-protect-autoloads autoload-feature-name) |
| 1038 (if force (set-buffer-modified-p | |
| 2548 | 1039 t (find-file-noselect into-file)))) |
| 1232 | 1040 (save-some-buffers t) |
| 1041 )) | |
| 1042 | |
| 428 | 1043 ;;;###autoload |
| 2548 | 1044 (defun update-custom-define-files (files-or-dirs feature-prefix |
| 1045 &optional into-file force) | |
| 1046 "Update all the custom-define files associated with FILES-OR-DIRS. | |
| 1047 Works just like `update-file-autoloads'." | |
| 1048 (let* ((autoload-feature-suffix "-custom-defines") | |
| 1049 (autoload-file-name "custom-defines.el") | |
| 1050 (generate-autoload-function #'generate-custom-defines)) | |
| 1051 (update-autoload-files files-or-dirs feature-prefix into-file force))) | |
| 428 | 1052 |
| 1232 | 1053 (defun autoload-featurep-protect-autoloads (sym) |
| 428 | 1054 (save-excursion |
| 1055 (set-buffer (find-file-noselect generated-autoload-file)) | |
| 1056 (goto-char (point-min)) | |
| 2548 | 1057 (cond ((eq (point-min) (point-max)) nil) |
| 1058 ;; if there's some junk in the file but no sections, just | |
| 1059 ;; delete everything. the junk might be stuff inserted by | |
| 1060 ;; an older version of this function. | |
| 1061 ((not (search-forward generate-autoload-section-header nil t)) | |
| 1062 (delete-region (point-min) (point-max))) | |
| 1063 (t | |
| 1064 (goto-char (point-min)) | |
| 1065 (when (looking-at ";;; DO NOT MODIFY THIS FILE") | |
| 1066 (delete-region (point-min) | |
| 1067 (progn | |
| 1068 (search-forward generate-autoload-section-header) | |
| 1069 (match-beginning 0)))) | |
| 1070 ;; Determine and set the coding system for the file if under Mule. | |
| 1071 ;; If there are any extended characters in the input file, use | |
| 1072 ;; `escape-quoted' to make sure that both binary and extended | |
| 1073 ;; characters are output properly and distinguished properly. | |
| 1074 ;; Otherwise, use `raw-text' for maximum portability with non-Mule | |
| 1075 ;; Emacsen. | |
| 1076 (if (or (featurep '(not mule)) ;; Don't scan if no Mule support | |
| 1077 (progn | |
| 1078 (goto-char (point-min)) | |
| 1079 ;; mrb- There must be a better way than skip-chars-forward | |
| 1080 (skip-chars-forward (concat (char-to-string 0) "-" | |
| 1081 (char-to-string 255))) | |
| 1082 (eq (point) (point-max)))) | |
| 1083 (setq buffer-file-coding-system 'raw-text-unix) | |
| 1084 (setq buffer-file-coding-system 'escape-quoted)) | |
| 1085 (goto-char (point-min)) | |
| 1086 (insert ";;; DO NOT MODIFY THIS FILE") | |
| 1087 ;; NOTE: XEmacs prior to 21.5.12 or so had a bug in that it | |
| 1088 ;; recognized only one of the two magic-cookie styles (the -*- kind) | |
| 1089 ;; in find-file, but both of them in load. We go ahead and put both | |
| 1090 ;; in, just to be safe. | |
|
5101
65f5d45edc87
fix auto-autoloads when default coding system is utf-8
Ben Wing <ben@xemacs.org>
parents:
5076
diff
changeset
|
1091 (insert (format " -*- coding: %s -*-\n" buffer-file-coding-system)) |
| 2548 | 1092 (when (eq buffer-file-coding-system 'escape-quoted) |
|
5101
65f5d45edc87
fix auto-autoloads when default coding system is utf-8
Ben Wing <ben@xemacs.org>
parents:
5076
diff
changeset
|
1093 (insert "(or (featurep 'mule) ") |
|
65f5d45edc87
fix auto-autoloads when default coding system is utf-8
Ben Wing <ben@xemacs.org>
parents:
5076
diff
changeset
|
1094 (insert "(error \"Loading this file requires Mule support\"))\n")) |
|
65f5d45edc87
fix auto-autoloads when default coding system is utf-8
Ben Wing <ben@xemacs.org>
parents:
5076
diff
changeset
|
1095 (insert (format ";;;###coding system: %s\n" |
|
65f5d45edc87
fix auto-autoloads when default coding system is utf-8
Ben Wing <ben@xemacs.org>
parents:
5076
diff
changeset
|
1096 buffer-file-coding-system)) |
|
65f5d45edc87
fix auto-autoloads when default coding system is utf-8
Ben Wing <ben@xemacs.org>
parents:
5076
diff
changeset
|
1097 (insert "(if (featurep '" sym ")") |
| 2548 | 1098 (insert " (error \"Feature " sym " already loaded\"))\n") |
| 1099 (goto-char (point-max)) | |
| 1100 (save-excursion | |
| 1101 (forward-line -1) | |
| 1102 (when (looking-at "(provide") | |
| 1103 (delete-region (point) (point-max)))) | |
| 1104 (unless (bolp) (insert "\n")) | |
| 1105 (unless (eq (char-before (1- (point))) ?\^L) | |
| 1106 (insert "\^L\n")) | |
| 1107 (insert "(provide '" sym ")\n"))))) | |
| 428 | 1108 |
| 1232 | 1109 (defun autoload-make-feature-name (&optional prefix) |
| 1110 "Generate the feature name to protect this auto-autoloads file from PREFIX. | |
| 428 | 1111 |
| 1232 | 1112 If PREFIX is nil, it defaults to the value of `autoload-feature-prefix' if |
| 1113 that is non-nil. | |
| 1114 | |
| 1115 The feature name must be globally unique for this version of XEmacs, | |
| 1116 including packages. | |
| 528 | 1117 |
| 1232 | 1118 For backward compatibility, if PREFIX and `autoload-feature-prefix' are both |
| 1119 `nil', PREFIX is computed as the last directory component of | |
| 1120 `generated-autoload-file'. This is likely to result in non-uniqueness, so | |
| 1121 do not use this feature." | |
| 1122 (concat | |
| 1123 (cond (prefix) | |
| 1124 (autoload-feature-prefix) | |
| 1125 ((stringp generated-autoload-file) | |
| 1126 (message "Warning: autoload computing feature prefix. | |
| 1127 You should specify it as an argument to `autoload-make-feature-name'.") | |
| 1128 (file-name-nondirectory | |
| 1129 (directory-file-name | |
| 1130 (file-name-directory generated-autoload-file)))) | |
| 1131 (t (error 'invalid-argument | |
| 1132 "Could not compute a feature name"))) | |
| 2548 | 1133 autoload-feature-suffix)) |
| 1232 | 1134 |
| 1135 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| 1136 ;; Deprecated entry points | |
| 1137 | |
| 1138 ;; A grep of the core and packages shows use of `batch-update-autoloads' | |
| 1139 ;; by XEmacs.rules, pcomplete, eshell, oort-gnus; `batch-update-directory' | |
| 2548 | 1140 ;; by liece. The other two entry points (`batch-update-one-directory', |
| 1141 ;; `batch-force-update-one-directory') were not used at all. | |
| 1142 ;; | |
| 1143 ;; All except the first are now history. liece has been updated. | |
| 1144 ;; XEmacs.rules has been updated. The others will be, eventually. | |
| 528 | 1145 |
| 2548 | 1146 ;; There don't seem to be very many packages that use the first one (the |
| 1147 ;; "all-into-one-file" variety), and do they actually rely on this | |
| 1148 ;; functionality? --ben | |
| 1149 | |
| 1232 | 1150 ;; but XEmacs.rules does, though maybe it doesn't "rely" on it, and |
| 1151 ;; modules do now, and that relies on it. --sjt | |
| 528 | 1152 |
| 1153 ;;;###autoload | |
| 1154 (defun batch-update-autoloads () | |
| 1155 "Update the autoloads for the files or directories on the command line. | |
| 1156 Runs `update-file-autoloads' on files and `update-directory-autoloads' | |
| 1157 on directories. Must be used only with -batch, and kills Emacs on completion. | |
| 1158 Each file will be processed even if an error occurred previously. | |
| 1159 For example, invoke `xemacs -batch -f batch-update-autoloads *.el'. | |
| 1160 The directory to which the auto-autoloads.el file must be the first parameter | |
| 1161 on the command line." | |
| 1162 (unless noninteractive | |
| 1163 (error "batch-update-autoloads is to be used only with -batch")) | |
| 3431 | 1164 (update-autoload-files command-line-args-left autoload-feature-prefix |
| 1165 generated-autoload-file t) | |
| 528 | 1166 (kill-emacs 0)) |
| 442 | 1167 |
| 1232 | 1168 ;; Declare obsolescence |
| 1169 | |
| 1170 (make-obsolete-variable 'autoload-target-directory | |
| 1171 "Don't use this. Bind `generated-autoload-file' to an absolute path.") | |
| 1172 (make-obsolete 'batch-update-autoloads | |
| 1173 'autoload-update-directory-autoloads) | |
| 1174 | |
| 428 | 1175 (provide 'autoload) |
| 1176 | |
| 1177 ;;; autoload.el ends here |
