diff options
Diffstat (limited to 'lisp/emacs-lisp/autoload.el')
-rw-r--r-- | lisp/emacs-lisp/autoload.el | 71 |
1 files changed, 42 insertions, 29 deletions
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el index a0ca0440fbb..e4290baee94 100644 --- a/lisp/emacs-lisp/autoload.el +++ b/lisp/emacs-lisp/autoload.el @@ -182,13 +182,13 @@ expression, in which case we want to handle forms differently." (let* ((macrop (memq car '(defmacro cl-defmacro defmacro*))) (name (nth 1 form)) (args (pcase car - ((or `defun `defmacro - `defun* `defmacro* `cl-defun `cl-defmacro - `define-overloadable-function) + ((or 'defun 'defmacro + 'defun* 'defmacro* 'cl-defun 'cl-defmacro + 'define-overloadable-function) (nth 2 form)) - (`define-skeleton '(&optional str arg)) - ((or `define-generic-mode `define-derived-mode - `define-compilation-mode) + ('define-skeleton '(&optional str arg)) + ((or 'define-generic-mode 'define-derived-mode + 'define-compilation-mode) nil) (_ t))) (body (nthcdr (or (function-get car 'doc-string-elt) 3) form)) @@ -324,6 +324,7 @@ put the output in." (setcdr p nil) (princ "\n(" outbuf) (let ((print-escape-newlines t) + (print-escape-control-characters t) (print-quoted t) (print-escape-nonascii t)) (dolist (elt form) @@ -348,6 +349,7 @@ put the output in." outbuf)) (terpri outbuf))) (let ((print-escape-newlines t) + (print-escape-control-characters t) (print-quoted t) (print-escape-nonascii t)) (print form outbuf))))))) @@ -605,7 +607,8 @@ Don't try to split prefixes that are already longer than that.") nil)))) prefixes))) `(if (fboundp 'register-definition-prefixes) - (register-definition-prefixes ,file ',(delq nil strings))))))) + (register-definition-prefixes ,file ',(sort (delq nil strings) + 'string<))))))) (defun autoload--setup-output (otherbuf outbuf absfile load-name) (let ((outbuf @@ -657,6 +660,21 @@ Don't try to split prefixes that are already longer than that.") (defvar autoload-builtin-package-versions nil) +(defvar autoload-ignored-definitions + '("define-obsolete-function-alias" + "define-obsolete-variable-alias" + "define-category" "define-key" + "defgroup" "defface" "defadvice" + "def-edebug-spec" + ;; Hmm... this is getting ugly: + "define-widget" + "define-erc-module" + "define-erc-response-handler" + "defun-rcirc-command") + "List of strings naming definitions to ignore for prefixes. +More specifically those definitions will not be considered for the +`register-definition-prefixes' call.") + ;; When called from `generate-file-autoloads' we should ignore ;; `generated-autoload-file' altogether. When called from ;; `update-file-autoloads' we don't know `outbuf'. And when called from @@ -755,17 +773,8 @@ FILE's modification time." (looking-at "(\\(def[^ ]+\\) ['(]*\\([^' ()\"\n]+\\)[\n \t]") (not (member (match-string 1) - '("define-obsolete-function-alias" - "define-obsolete-variable-alias" - "define-category" "define-key" - "defgroup" "defface" "defadvice" - "def-edebug-spec" - ;; Hmm... this is getting ugly: - "define-widget" - "define-erc-module" - "define-erc-response-handler" - "defun-rcirc-command")))) - (push (match-string 2) defs)) + autoload-ignored-definitions))) + (push (match-string-no-properties 2) defs)) (forward-sexp 1) (forward-line 1))))))) @@ -810,7 +819,8 @@ FILE's modification time." (marker-buffer other-output-start) "actual autoloads are elsewhere" load-name relfile (if autoload-timestamps - (nth 5 (file-attributes absfile)) + (file-attribute-modification-time + (file-attributes absfile)) autoload--non-timestamp)) (insert ";;; Generated autoloads from " relfile "\n"))) (insert generate-autoload-section-trailer))))))) @@ -846,7 +856,8 @@ FILE's modification time." ;; `emacs-internal' instead. nil nil 'emacs-mule-unix) (if autoload-timestamps - (nth 5 (file-attributes relfile)) + (file-attribute-modification-time + (file-attributes relfile)) autoload--non-timestamp))) (insert ";;; Generated autoloads from " relfile "\n"))) (insert generate-autoload-section-trailer)))) @@ -859,7 +870,7 @@ FILE's modification time." ;; If the entries were added to some other buffer, then the file ;; doesn't add entries to OUTFILE. otherbuf)) - (nth 5 (file-attributes absfile)))) + (file-attribute-modification-time (file-attributes absfile)))) (error ;; Probably unbalanced parens in forward-sexp. In that case, the ;; condition is scan-error, and the signal data includes point @@ -940,7 +951,8 @@ removes any prior now out-of-date autoload entries." (existing-buffer (if buffer-file-name buf)) (output-file (autoload-generated-file)) (output-time (if (file-exists-p output-file) - (nth 5 (file-attributes output-file)))) + (file-attribute-modification-time + (file-attributes output-file)))) (found nil)) (with-current-buffer (autoload-find-generated-file) ;; This is to make generated-autoload-file have Unix EOLs, so @@ -962,7 +974,8 @@ removes any prior now out-of-date autoload entries." ;; Check if it is up to date. (let ((begin (match-beginning 0)) (last-time (nth 4 form)) - (file-time (nth 5 (file-attributes file)))) + (file-time (file-attribute-modification-time + (file-attributes file)))) (if (and (or (null existing-buffer) (not (buffer-modified-p existing-buffer))) (cond @@ -1055,7 +1068,8 @@ write its autoloads into the specified file instead." generated-autoload-file)) (output-time (if (file-exists-p generated-autoload-file) - (nth 5 (file-attributes generated-autoload-file))))) + (file-attribute-modification-time + (file-attributes generated-autoload-file))))) (with-current-buffer (autoload-find-generated-file) (save-excursion @@ -1076,7 +1090,8 @@ write its autoloads into the specified file instead." (if (member last-time (list t autoload--non-timestamp)) (setq last-time output-time)) (dolist (file file) - (let ((file-time (nth 5 (file-attributes file)))) + (let ((file-time (file-attribute-modification-time + (file-attributes file)))) (when (and file-time (not (time-less-p last-time file-time))) ;; file unchanged @@ -1095,7 +1110,8 @@ write its autoloads into the specified file instead." t autoload--non-timestamp)) output-time oldtime)) - (nth 5 (file-attributes file)))) + (file-attribute-modification-time + (file-attributes file)))) ;; File hasn't changed. nil) (t @@ -1143,9 +1159,6 @@ write its autoloads into the specified file instead." ;; file-local autoload-generated-file settings. (autoload-save-buffers)))) -(define-obsolete-function-alias 'update-autoloads-from-directories - 'update-directory-autoloads "22.1") - ;;;###autoload (defun batch-update-autoloads () "Update loaddefs.el autoloads in batch mode. |