diff options
author | João Távora <joaotavora@gmail.com> | 2023-11-29 16:48:34 -0600 |
---|---|---|
committer | João Távora <joaotavora@gmail.com> | 2024-02-03 08:40:03 -0600 |
commit | 0f715f9c154a47de57a2f24f19b4a402604e6dc0 (patch) | |
tree | 598f6a7a5a16e5f20d928713645b4b407faded23 /lisp/emacs-lisp/comp-run.el | |
parent | 17c3610c56155dd5b1efd5b7e8d6a58112f43a59 (diff) | |
download | emacs-0f715f9c154a47de57a2f24f19b4a402604e6dc0.tar.gz emacs-0f715f9c154a47de57a2f24f19b4a402604e6dc0.tar.bz2 emacs-0f715f9c154a47de57a2f24f19b4a402604e6dc0.zip |
Improve shorthands-font-lock-shorthands (bug#67390)
Add font locking to the shorthand prefix of a given printed symbol
name by checking if any of the shorthand prefixes in
read-symbol-shorthands are a prefix for that print name. Although
this does more string comparisons, it didn't prove to be any slower
than the existing approach, and is more correct.
This version is more accurate when highlighting files with many
overlapping shorthands. Given:
;; Local Variables:
;; read-symbol-shorthands: (("bc-" . "breadcrumb-")
;; ("aw-" . "ace-window-")
;; ("zorglub/" . "ace-window-")
;; ("he//" . "hyperdrive-entry--")
;; ("h//" . "hyperdrive--")
;; ("he/" . "hyperdrive-entry-")
;; ("h/" . "hyperdrive-"))
;; End:
The following are correct highlights on print names
'(zorglub/blerh ; hilits "zorglub/" reads to 'ace-window-blerh'
he/foo ; hilits "he/" reads to 'hyperdrive-entry-foo'
he//bar ; hilits "he//" reads to 'hyperdrive-entry--bar'
h/coiso ; hilits "h/" reads to 'hyperdrive-coiso'
h//thingy ; hilits "h//" reads to 'hyperdrive--thingy'
bc-yo ; hilits "bc-" reads to 'breadcrumb-yo'
aw-thingy ; hilits "aw-" reads to 'ace-window-thingy'
)
Co-authored-by: Jonas Bernoulli <jonas@bernoul.li>
Co-authored-by: Joseph Turner <joseph@ushin.org>
* lisp/emacs-lisp/shorthands.el (shorthands-font-lock-shorthands):
Diffstat (limited to 'lisp/emacs-lisp/comp-run.el')
0 files changed, 0 insertions, 0 deletions