(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)
(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
(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))
(or existing-buffer
(kill-buffer (current-buffer))))))))
(generate-file-autoloads file))))
- (and (interactive-p)
+ (and save-after
(buffer-modified-p)
(save-buffer))