]> code.delx.au - gnu-emacs/blobdiff - lisp/emacs-lisp/autoload.el
* help-fns.el (help-function-arglist): Don't check advertised-signature-table.
[gnu-emacs] / lisp / emacs-lisp / autoload.el
index 343a2ce8edfad0bdc11bd176746513b364cf1283..fc5b3081a6df03c1d138c329de6646bef83619fd 100644 (file)
@@ -1,7 +1,7 @@
 ;; autoload.el --- maintain autoloads in loaddefs.el
 
 ;; Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2001, 2002, 2003,
-;;   2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;;   2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
 ;; Author: Roland McGrath <roland@gnu.org>
 ;; Keywords: maint
@@ -42,6 +42,18 @@ trailer starting with a FormFeed character.")
 ;;;###autoload
 (put 'generated-autoload-file 'safe-local-variable 'stringp)
 
+(defvar generated-autoload-feature nil
+  "Feature for `generated-autoload-file' to provide.
+If nil, this defaults to `generated-autoload-file', sans extension.")
+;;;###autoload
+(put 'generated-autoload-feature 'safe-local-variable 'symbolp)
+
+(defvar generated-autoload-load-name nil
+  "Load name for `autoload' statements generated from autoload cookies.
+If nil, this defaults to the file name, sans extension.")
+;;;###autoload
+(put 'generated-autoload-load-name 'safe-local-variable 'stringp)
+
 ;; This feels like it should be a defconst, but MH-E sets it to
 ;; ";;;###mh-autoload" for the autoloads that are to go into mh-loaddefs.el.
 (defvar generate-autoload-cookie ";;;###autoload"
@@ -95,11 +107,12 @@ or macro definition or a defcustom)."
                   easy-mmode-define-global-mode define-global-minor-mode
                   define-globalized-minor-mode
                   easy-mmode-define-minor-mode define-minor-mode
-                  defun* defmacro*))
+                  defun* defmacro* define-overloadable-function))
       (let* ((macrop (memq car '(defmacro defmacro*)))
             (name (nth 1 form))
             (args (case car
-                   ((defun defmacro defun* defmacro*) (nth 2 form))
+                   ((defun defmacro defun* defmacro*
+                      define-overloadable-function) (nth 2 form))
                    ((define-skeleton) '(&optional str arg))
                    ((define-generic-mode define-derived-mode
                        define-compilation-mode) nil)
@@ -122,6 +135,14 @@ or macro definition or a defcustom)."
                  (eq (car-safe (car body)) 'interactive))
              (if macrop (list 'quote 'macro) nil))))
 
+     ;; For defclass forms, use `eieio-defclass-autoload'.
+     ((eq car 'defclass)
+      (let ((name (nth 1 form))
+           (superclasses (nth 2 form))
+           (doc (nth 4 form)))
+       (list 'eieio-defclass-autoload (list 'quote name)
+             (list 'quote superclasses) file doc)))
+
      ;; Convert defcustom to less space-consuming data.
      ((eq car 'defcustom)
       (let ((varname (car-safe (cdr-safe form)))
@@ -245,11 +266,17 @@ information contained in FILE."
            ";;\n"
            ";;; Code:\n\n"
            "\f\n"
-           "(provide '" (file-name-sans-extension basename) ")\n"
+           "(provide '"
+           (if (and generated-autoload-feature
+                    (symbolp generated-autoload-feature))
+               (format "%s" generated-autoload-feature)
+             (file-name-sans-extension basename))
+           ")\n"
            ";; Local Variables:\n"
            ";; version-control: never\n"
            ";; no-byte-compile: t\n"
            ";; no-update-autoloads: t\n"
+           ";; coding: utf-8\n"
            ";; End:\n"
            ";;; " basename
            " ends here\n")))
@@ -335,7 +362,7 @@ Return non-nil if and only if FILE adds no autoloads to OUTFILE
 \(or OUTBUF if OUTFILE is nil)."
   (catch 'done
     (let ((autoloads-done '())
-          (load-name (autoload-file-load-name file))
+         load-name
           (print-length nil)
          (print-level nil)
           (print-readably t)           ; This does something in Lucid Emacs.
@@ -353,6 +380,10 @@ Return non-nil if and only if FILE adds no autoloads to OUTFILE
         ;; Obey the no-update-autoloads file local variable.
         (unless no-update-autoloads
           (message "Generating autoloads for %s..." file)
+         (setq load-name
+               (if (stringp generated-autoload-load-name)
+                   generated-autoload-load-name
+                 (autoload-file-load-name file)))
           (save-excursion
             (save-restriction
               (widen)
@@ -474,7 +505,7 @@ Return FILE if there was no autoload cookie in it, else nil."
          (no-autoloads (autoload-generate-file-autoloads file)))
     (if autoload-modified-buffers
         (if save-after (autoload-save-buffers))
-      (if (interactive-p)
+      (if (called-interactively-p 'interactive)
           (message "Autoload section for %s is up to date." file)))
     (if no-autoloads file)))