[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bugfix/shorthand-fixes ff48f1401d2 5/6: Also teach loaddefs-gen.el about
From: |
João Távora |
Subject: |
bugfix/shorthand-fixes ff48f1401d2 5/6: Also teach loaddefs-gen.el about shorthands (bug#63480) |
Date: |
Thu, 30 Nov 2023 09:05:50 -0500 (EST) |
branch: bugfix/shorthand-fixes
commit ff48f1401d2637a7c3c3820f5c09f411aeca4cc0
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 04bea4723a2..dccdbea9240 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).
- branch bugfix/shorthand-fixes created (now 7e99ed2f539), João Távora, 2023/11/30
- bugfix/shorthand-fixes 3c6719f55c1 1/6: Make sure read-symbol-shorthands is permanently local, João Távora, 2023/11/30
- bugfix/shorthand-fixes d1e8e9d4054 3/6: Consider read-symbol-shorthands in check-declare.el (bug#67523), João Távora, 2023/11/30
- bugfix/shorthand-fixes 7e99ed2f539 6/6: Fix prefix discovery for files with read-symbol-shorthands (bug#67325), João Távora, 2023/11/30
- bugfix/shorthand-fixes ff48f1401d2 5/6: Also teach loaddefs-gen.el about shorthands (bug#63480),
João Távora <=
- bugfix/shorthand-fixes 48f5bd5d744 4/6: Improve shorthands-font-lock-shorthands (bug#67390), João Távora, 2023/11/30
- bugfix/shorthand-fixes e184e15285b 2/6: Process read-symbol-shorthands from longest to shortest (bug#67390), João Távora, 2023/11/30