-;;; autoload.el --- maintain autoloads in loaddefs.el
+;; autoload.el --- maintain autoloads in loaddefs.el
-;; Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2001
+;; Copyright (C) 1991,92,93,94,95,96,97, 2001,02,03,04
;; Free Software Foundation, Inc.
;; Author: Roland McGrath <roland@gnu.org>
(require 'lisp-mode) ;for `doc-string-elt' properties.
(require 'help-fns) ;for help-add-fundoc-usage.
+(eval-when-compile (require 'cl))
(defvar generated-autoload-file "loaddefs.el"
"*File \\[update-file-autoloads] puts autoloads into.
(let ((car (car-safe form)) expand)
(cond
;; For complex cases, try again on the macro-expansion.
- ((and (memq car '(easy-mmode-define-global-mode
+ ((and (memq car '(easy-mmode-define-global-mode define-global-minor-mode
easy-mmode-define-minor-mode define-minor-mode))
(setq expand (let ((load-file-name file)) (macroexpand form)))
(eq (car expand) 'progn)
;; For special function-like operators, use the `autoload' function.
((memq car '(defun define-skeleton defmacro define-derived-mode
+ define-compilation-mode
define-generic-mode easy-mmode-define-minor-mode
easy-mmode-define-global-mode
define-minor-mode defun* defmacro*))
(let* ((macrop (memq car '(defmacro defmacro*)))
(name (nth 1 form))
- (args (if (memq car '(defun defmacro defun* defmacro*))
- (nth 2 form) t))
+ (args (case car
+ ((defun defmacro defun* defmacro*) (nth 2 form))
+ ((define-skeleton) '(&optional str arg))
+ ((define-generic-mode define-derived-mode
+ define-compilation-mode) nil)
+ (t)))
(body (nthcdr (get car 'doc-string-elt) form))
(doc (if (stringp (car body)) (pop body))))
(when (listp args)
(defun autoload-trim-file-name (file)
- ;; Returns a relative pathname of FILE
+ ;; Returns a relative file path for FILE
;; starting from the directory that loaddefs.el is in.
;; That is normally a directory in load-path,
;; which means Emacs will be able to find FILE when it looks.
output-end)
;; If the autoload section we create here uses an absolute
- ;; pathname for FILE in its header, and then Emacs is installed
+ ;; file name for FILE in its header, and then Emacs is installed
;; under a different path on another system,
;; `update-autoloads-here' won't be able to find the files to be
;; autoloaded. So, if FILE is in the same directory or a
(setq autoload form))
(let ((autoload-print-form-outbuf outbuf))
(autoload-print-form autoload)))
-
+
;; Copy the rest of the line to the output.
(princ (buffer-substring
(progn
(message "Generating autoloads for %s...done" file)))
\f
;;;###autoload
-(defun update-file-autoloads (file)
+(defun update-file-autoloads (file &optional save-after)
"Update the autoloads for FILE in `generated-autoload-file'
\(which FILE might bind in its local variables).
-Return FILE if there was no autoload cookie in it."
- (interactive "fUpdate autoloads for file: ")
+If SAVE-AFTER is non-nil (which is always, when called interactively),
+save the buffer too.
+
+Return FILE if there was no autoload cookie in it, else nil."
+ (interactive "fUpdate autoloads for file: \np")
(let ((load-name (let ((name (file-name-nondirectory file)))
(if (string-match "\\.elc?\\(\\.\\|$\\)" name)
(substring name 0 (match-beginning 0))
(if (and (or (null existing-buffer)
(not (buffer-modified-p existing-buffer)))
(listp last-time) (= (length last-time) 2)
- (not (autoload-before-p last-time file-time)))
+ (not (time-less-p last-time file-time)))
(progn
(if (interactive-p)
(message "\
(or existing-buffer
(kill-buffer (current-buffer))))))))
(generate-file-autoloads file))))
- (and (interactive-p)
+ (and save-after
(buffer-modified-p)
(save-buffer))
(if no-autoloads file))))
-(defun autoload-before-p (time1 time2)
- (or (< (car time1) (car time2))
- (and (= (car time1) (car time2))
- (< (nth 1 time1) (nth 1 time2)))))
-
(defun autoload-remove-section (begin)
(goto-char begin)
(search-forward generate-autoload-section-trailer)
(delete-region begin (point)))
;;;###autoload
-(defun update-autoloads-from-directories (&rest dirs)
+(defun update-directory-autoloads (&rest dirs)
"\
Update loaddefs.el with all the current autoloads from DIRS, and no old ones.
-This uses `update-file-autoloads' (which see) do its work."
+This uses `update-file-autoloads' (which see) do its work.
+In an interactive call, you must give one argument, the name
+of a single directory. In a call from Lisp, you can supply multiple
+directories as separate arguments, but this usage is discouraged.
+
+The function does NOT recursively descend into subdirectories of the
+directory or directories specified."
(interactive "DUpdate autoloads from directory: ")
(let* ((files-re (let ((tmp nil))
(dolist (suf load-suffixes
(dolist (file file)
(let ((file-time (nth 5 (file-attributes file))))
(when (and file-time
- (not (autoload-before-p last-time
- file-time)))
+ (not (time-less-p last-time file-time)))
;; file unchanged
(push file no-autoloads)
(setq files (delete file files)))))))
;;;###autoload
(defun batch-update-autoloads ()
"Update loaddefs.el autoloads in batch mode.
-Calls `update-autoloads-from-directories' on the command line arguments."
- (apply 'update-autoloads-from-directories command-line-args-left)
+Calls `update-directory-autoloads' on the command line arguments."
+ (apply 'update-directory-autoloads command-line-args-left)
(setq command-line-args-left nil))
(provide 'autoload)
+;;; arch-tag: 00244766-98f4-4767-bf42-8a22103441c6
;;; autoload.el ends here