Subject: 28; shorthands-font-lock-shorthands assumes shorthand uses same separator

From: Jonas Bernoulli <[email-masked]>
Date: Wed, 22 Nov 2023 23:18:18 +0100

Hello,

`shorthands-font-lock-shorthands' assumes that the shorthand uses the
same separator as the real symbol name, e.g., "s-" instead of "long-".
This causes an additional character to be highlighted when an
alternative separator is used, e.g., when using "s/" instead of "long-".

`shorthands--mismatch-from-end' returns the length of the common suffix,
of the shorthand and the long name.

  (shorthands--mismatch-from-end "s-tail" "long-tail") => 5

  "s-" is highlighted in this case.

Since `shorthands-font-lock-shorthands' also wants to highlight the
separator, "-" in this case, it corrects this off-by-one, but when
different separators are in use, this causes an additional character
to be highlighted

  (shorthands--mismatch-from-end "s/tail" "long-tail") => 4

  "s/t" is highlighted in this case.

Could we add support for using an alternative separator in shorthands?

IMO it is okay to use another separator for *shorthand* prefixes.  They
won't show up in M-x completion candidates, for example.  Shorthands are
confined to the file where they are being used, and I think authors
should be free to use whatever prefix they fancy.

     Cheers,
     Jonas