summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/loaddefs-gen.el
diff options
context:
space:
mode:
authorJoão Távora <joaotavora@gmail.com>2023-11-29 20:09:57 -0600
committerJoão Távora <joaotavora@gmail.com>2024-02-03 08:40:03 -0600
commitc52d17d91ade6c789d8672dbd1301ba86ba4d7d1 (patch)
treec8a1ee4606c1e6484bf5de31c4a8885d1acb29be /lisp/emacs-lisp/loaddefs-gen.el
parent0f715f9c154a47de57a2f24f19b4a402604e6dc0 (diff)
downloademacs-c52d17d91ade6c789d8672dbd1301ba86ba4d7d1.tar.gz
emacs-c52d17d91ade6c789d8672dbd1301ba86ba4d7d1.tar.bz2
emacs-c52d17d91ade6c789d8672dbd1301ba86ba4d7d1.zip
Also teach loaddefs-gen.el about shorthands (bug#63480)
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--parse-file): Make aware of read-symbol-shorthands.
Diffstat (limited to 'lisp/emacs-lisp/loaddefs-gen.el')
-rw-r--r--lisp/emacs-lisp/loaddefs-gen.el15
1 files changed, 14 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el
index 5f152d3b509..bf5cd24f161 100644
--- a/lisp/emacs-lisp/loaddefs-gen.el
+++ b/lisp/emacs-lisp/loaddefs-gen.el
@@ -378,6 +378,7 @@ don't include."
(let ((defs nil)
(load-name (loaddefs-generate--file-load-name file main-outfile))
(compute-prefixes t)
+ read-symbol-shorthands
local-outfile inhibit-autoloads)
(with-temp-buffer
(insert-file-contents file)
@@ -399,7 +400,19 @@ don't include."
(setq inhibit-autoloads (read (current-buffer)))))
(save-excursion
(when (re-search-forward "autoload-compute-prefixes: *" nil t)
- (setq compute-prefixes (read (current-buffer))))))
+ (setq compute-prefixes (read (current-buffer)))))
+ (save-excursion
+ ;; since we're "open-coding" we have to repeat more
+ ;; complicated logic in `hack-local-variables'.
+ (when (re-search-forward "read-symbol-shorthands: *" nil t)
+ (let* ((commentless (replace-regexp-in-string
+ "\n\\s-*;+" ""
+ (buffer-substring (point) (point-max))))
+ (unsorted-shorthands (car (read-from-string commentless))))
+ (setq read-symbol-shorthands
+ (sort unsorted-shorthands
+ (lambda (sh1 sh2)
+ (> (length (car sh1)) (length (car sh2))))))))))
;; We always return the package version (even for pre-dumped
;; files).