[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master c52d17d91ad 5/8: Also teach loaddefs-gen.el about shorthands (bug
From: |
João Távora |
Subject: |
master c52d17d91ad 5/8: Also teach loaddefs-gen.el about shorthands (bug#63480) |
Date: |
Sat, 3 Feb 2024 09:44:07 -0500 (EST) |
branch: master
commit c52d17d91ade6c789d8672dbd1301ba86ba4d7d1
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>
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.
---
lisp/emacs-lisp/loaddefs-gen.el | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
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).
- master updated (25bf8d3cdc6 -> f266622cdb3), João Távora, 2024/02/03
- master c2aaa8f15aa 2/8: Process read-symbol-shorthands from longest to shortest (bug#67390), João Távora, 2024/02/03
- master 17c3610c561 3/8: Consider read-symbol-shorthands in check-declare.el (bug#67523), João Távora, 2024/02/03
- master 817140a852e 6/8: Fix prefix discovery for files with read-symbol-shorthands (bug#67325), João Távora, 2024/02/03
- master 9a51fbb69fc 7/8: ; Also consider shorthands in check-declare-scan (bug#67523), João Távora, 2024/02/03
- master 5e4a0a29fa3 1/8: Make sure read-symbol-shorthands is permanently local, João Távora, 2024/02/03
- master 0f715f9c154 4/8: Improve shorthands-font-lock-shorthands (bug#67390), João Távora, 2024/02/03
- master c52d17d91ad 5/8: Also teach loaddefs-gen.el about shorthands (bug#63480),
João Távora <=
- master f266622cdb3 8/8: ; Optimize shorthand insertion in loaddefs-generate--parse-file, João Távora, 2024/02/03