From 8a5275afa57160f7b7a9d71af2342c06e0c0d652 Mon Sep 17 00:00:00 2001 From: dickmao Date: Fri, 12 May 2023 21:44:47 -0400 Subject: [PATCH] propagate shorthands to autoloads --- lisp/emacs-lisp/generate-lisp-file.el | 7 +++++-- lisp/emacs-lisp/loaddefs-gen.el | 15 ++++++++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lisp/emacs-lisp/generate-lisp-file.el b/lisp/emacs-lisp/generate-lisp-file.el index c6148003a5e..6d1e5292871 100644 --- a/lisp/emacs-lisp/generate-lisp-file.el +++ b/lisp/emacs-lisp/generate-lisp-file.el @@ -63,7 +63,8 @@ generate-lisp-file-heading (cl-defun generate-lisp-file-trailer (file &key version inhibit-provide (coding 'utf-8-emacs-unix) autoloads - compile provide inhibit-native-compile) + compile provide inhibit-native-compile + shorthands) "Insert a standard trailer for FILE. By default, this trailer inhibits version control, byte compilation, updating autoloads, and uses a `utf-8-emacs-unix' @@ -81,7 +82,7 @@ generate-lisp-file-trailer If `standard-output' is bound to a buffer, insert in that buffer. If no, insert at point in the current buffer. -If INHITBIT-NATIVE-COMPILE is non-nil, add a cookie to inhibit +If INHIBIT-NATIVE-COMPILE is non-nil, add a cookie to inhibit native compilation. (By default, a file will be native-compiled if it's also byte-compiled)." (with-current-buffer (if (bufferp standard-output) @@ -110,6 +111,8 @@ generate-lisp-file-trailer (if (eq coding t) 'utf-8-emacs-unix coding)))) + (when shorthands + (insert (format ";; read-symbol-shorthands: %S\n" shorthands))) (insert ";; End:\n\n" ";;; " (file-name-nondirectory file) " ends here\n"))) diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el index 8fafb458438..f437a952606 100644 --- a/lisp/emacs-lisp/loaddefs-gen.el +++ b/lisp/emacs-lisp/loaddefs-gen.el @@ -494,7 +494,7 @@ loaddefs-generate--compute-prefixes (push name prefs))))) (loaddefs-generate--make-prefixes prefs load-name))) -(defun loaddefs-generate--rubric (file &optional type feature compile) +(defun loaddefs-generate--rubric (file &optional type feature compile shorthands) "Return a string giving the appropriate autoload rubric for FILE. TYPE (default \"autoloads\") is a string stating the type of information contained in FILE. TYPE \"package\" acts like the default, @@ -520,7 +520,8 @@ loaddefs-generate--rubric file :provide (and (stringp feature) feature) :compile compile :inhibit-native-compile t - :inhibit-provide (not feature)) + :inhibit-provide (not feature) + :shorthands shorthands) (buffer-string)))) ;;;###autoload @@ -565,7 +566,7 @@ loaddefs-generate t files-re)) (if (consp dir) dir (list dir))))) (updating (and (file-exists-p output-file) (not generate-full))) - (defs nil)) + defs shorthands) ;; Allow the excluded files to be relative. (setq excluded-files @@ -594,7 +595,11 @@ loaddefs-generate (when (or package-data (not excluded)) (setq defs (nconc (loaddefs-generate--parse-file file output-file package-data) - defs)))))) + defs) + shorthands (nconc (with-temp-buffer + (save-excursion (insert-file-contents file)) + (hack-read-symbol-shorthands)) + shorthands)))))) (progress-reporter-done progress)) ;; First group per output file. @@ -606,7 +611,7 @@ loaddefs-generate (if (and updating (file-exists-p loaddefs-file)) (insert-file-contents loaddefs-file) (insert (loaddefs-generate--rubric - loaddefs-file nil t include-package-version)) + loaddefs-file nil t include-package-version shorthands)) (search-backward "\f") (when extra-data (insert extra-data) -- 2.38.1