]> code.delx.au - gnu-emacs/blobdiff - lisp/emacs-lisp/autoload.el
Add a provide statement.
[gnu-emacs] / lisp / emacs-lisp / autoload.el
index 8c228475e4284769392194671927fdce9c3ea354..196786e91796397990546fd1b0dd83adcd5f259a 100644 (file)
@@ -1,6 +1,6 @@
 ;; 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>
@@ -34,6 +34,7 @@
 
 (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.
@@ -85,13 +86,18 @@ or macro definition or a defcustom)."
 
      ;; 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)
@@ -354,11 +360,14 @@ are used."
     (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))
@@ -403,7 +412,7 @@ Return FILE if there was no autoload cookie in it."
                       (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 "\
@@ -458,17 +467,12 @@ Autoload section for %s is up to date."
                           (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)
@@ -523,8 +527,7 @@ directory or directories specified."
                     (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)))))))
@@ -563,4 +566,5 @@ Calls `update-directory-autoloads' on the command line arguments."
 
 (provide 'autoload)
 
+;;; arch-tag: 00244766-98f4-4767-bf42-8a22103441c6
 ;;; autoload.el ends here