summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorJoão Távora <joaotavora@gmail.com>2023-11-30 06:00:38 -0600
committerJoão Távora <joaotavora@gmail.com>2024-02-03 08:40:03 -0600
commitc2aaa8f15aa8fb3415a6c9f421f539ee34b7f52c (patch)
tree6781e8418876b56b3159c495100c8d98e24b7d96 /lisp
parent5e4a0a29fa3562ce9b2b8e497c6e71e6bc169082 (diff)
downloademacs-c2aaa8f15aa8fb3415a6c9f421f539ee34b7f52c.tar.gz
emacs-c2aaa8f15aa8fb3415a6c9f421f539ee34b7f52c.tar.bz2
emacs-c2aaa8f15aa8fb3415a6c9f421f539ee34b7f52c.zip
Process read-symbol-shorthands from longest to shortest (bug#67390)
This ensures that overlapping shorthands are handled correctly and consistently even if specified out-of-order by the user. * doc/lispref/symbols.texi (Shorthands): Describe shorthand sort order. * lisp/files.el (hack-local-variables--find-variables): Specially handle read-symbol-shorthands.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/files.el7
1 files changed, 7 insertions, 0 deletions
diff --git a/lisp/files.el b/lisp/files.el
index fd9088206d7..172237ceb82 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -4191,6 +4191,13 @@ major-mode."
;; to use 'thisbuf's name in the
;; warning message.
(or (buffer-file-name thisbuf) ""))))))
+ ((eq var 'read-symbol-shorthands)
+ ;; Sort automatically by shorthand length
+ ;; descending
+ (setq val (sort val
+ (lambda (sh1 sh2) (> (length (car sh1))
+ (length (car sh2))))))
+ (push (cons 'read-symbol-shorthands val) result))
((and (eq var 'mode) handle-mode))
(t
(ignore-errors