GNU bug report logs - #67390
28; shorthands-font-lock-shorthands assumes shorthand uses same separator

Previous Next

Package: emacs;

Reported by: Jonas Bernoulli <jonas <at> bernoul.li>

Date: Wed, 22 Nov 2023 22:19:01 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Jonas Bernoulli <jonas <at> bernoul.li>
To: 67390 <at> debbugs.gnu.org
Cc: Joseph Turner <joseph <at> ushin.org>, Adam Porter <adam <at> alphapapa.net>, João Távora <joaotavora <at> gmail.com>
Subject: bug#67390: 28; shorthands-font-lock-shorthands assumes shorthand uses same separator
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




This bug report was last modified 1 year and 24 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.