1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 18:40:39 -08:00

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.
This commit is contained in:
João Távora 2023-11-30 06:00:38 -06:00
parent 5e4a0a29fa
commit c2aaa8f15a
2 changed files with 24 additions and 0 deletions

View file

@ -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