emacs/lisp/emacs-lisp
João Távora 0f715f9c15 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):
2024-02-03 08:40:03 -06:00
..
advice.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
avl-tree.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
backquote.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
backtrace.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
benchmark.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
bindat.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
byte-opt.el ; Clarify two comments in byte-optimize-letX 2024-01-02 04:08:43 +01:00
byte-run.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
bytecomp.el bytecomp.el: Rewrite the way we print dynamic docstrings 2024-02-02 13:07:53 -05:00
cconv.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
chart.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
check-declare.el Consider read-symbol-shorthands in check-declare.el (bug#67523) 2024-02-03 08:40:03 -06:00
checkdoc.el Use special-mode in checkdoc status buffer 2024-01-05 22:58:39 +01:00
cl-extra.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
cl-generic.el * lisp/emacs-lisp/cl-generic.el (cl--generic-compiler): Clarify the test 2024-01-25 14:24:43 -05:00
cl-indent.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
cl-lib.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
cl-macs.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
cl-preloaded.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
cl-print.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
cl-seq.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
comp-common.el ; Add 2024 to copyright years 2024-01-02 10:30:05 +08:00
comp-cstr.el ; Fix typos in symbol names 2024-01-21 15:28:06 +01:00
comp-run.el ; Add 2024 to copyright years 2024-01-02 10:30:05 +08:00
comp.el ; Spelling fixes 2024-01-30 17:23:25 -08:00
copyright.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
crm.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
cursor-sensor.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
debug-early.el (backtrace-on-redisplay-error): Use handler-bind 2024-01-04 16:37:01 -05:00
debug.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
derived.el derived.el: Delete old code (bug#68625) 2024-01-29 19:04:59 -05:00
disass.el Eliminate lazy bytecode loading 2024-01-31 17:12:25 +01:00
easy-mmode.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
easymenu.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
edebug.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
eieio-base.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
eieio-core.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
eieio-custom.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
eieio-datadebug.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
eieio-opt.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
eieio-speedbar.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
eieio.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
eldoc.el Eldoc: play nice with mode-line-format-right-align (bug#68547) 2024-01-20 06:00:21 -06:00
elint.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
elp.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
ert-font-lock.el ; Add 2024 to copyright years 2024-01-02 10:30:05 +08:00
ert-x.el Complete change of ert-remote-temporary-file-directory 2024-01-06 18:15:23 +01:00
ert.el ert.el: Use handler-bind to record backtraces 2024-01-04 16:33:25 -05:00
ewoc.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
faceup.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
find-func.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
float-sup.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
generate-lisp-file.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
generator.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
generic.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
gv.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
helper.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
hierarchy.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
icons.el Fix documentation of icon-elements 2024-01-14 17:03:16 +02:00
inline.el * lisp/emacs-lisp/inline.el (inline-const-val): Improve docstring 2024-01-30 13:14:32 -05:00
let-alist.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
lisp-mnt.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
lisp-mode.el Increase emacs-lisp-docstring-fill-column to 72 2024-02-02 13:33:35 +01:00
lisp.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
loaddefs-gen.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
macroexp.el (macroexp--with-extended-form-stack): Use plain let 2024-01-04 16:35:53 -05:00
map-ynp.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
map.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
memory-report.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
multisession.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
nadvice.el Set the 'name' prop in 'define-advice' 2024-01-13 11:43:01 +02:00
oclosure.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
package-vc.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
package-x.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
package.el Handle package versions that are not version strings 2024-01-10 15:59:56 +02:00
pcase.el * lisp/emacs-lisp/pcase.el (Commentary:): Add paper reference 2024-01-24 08:21:26 -05:00
pp.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
radix-tree.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
range.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
re-builder.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
regexp-opt.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
regi.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
ring.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
rmc.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
rx.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
seq.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
shadow.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
shortdoc.el Don't pretend that hash-table-size is useful 2024-01-13 20:50:39 +01:00
shorthands.el Improve shorthands-font-lock-shorthands (bug#67390) 2024-02-03 08:40:03 -06:00
smie.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
subr-x.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
syntax.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
tabulated-list.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
tcover-ses.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
testcover.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
text-property-search.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
thunk.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
timer-list.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
timer.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
tq.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
trace.el trace.el: Make it usable in batch mode as well 2024-01-19 15:02:50 -05:00
unsafep.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
vtable.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
warnings.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00