GNU bug report logs - #50202
bibtex-mode: unescaped dollar sign in file field leads to wrong highlighting

Previous Next

Package: emacs;

Reported by: Yuu Yin <yuuyin <at> protonmail.com>

Date: Wed, 25 Aug 2021 19:16:02 UTC

Severity: normal

Done: Roland Winkler <winkler <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #26 received at 50202 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Roland Winkler <winkler <at> gnu.org>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 50202 <at> debbugs.gnu.org,
 Yuu Yin <yuuyin <at> protonmail.com>
Subject: Re: bug#50202: bibtex-mode: unescaped dollar sign in file field
 leads to wrong highlighting
Date: Fri, 26 Aug 2022 15:00:31 -0400
> For me, the situation is opposite: in my BibTeX files (with quite many
> entries that have accumulated over the years), many entries contain
> LaTeX constructs like $^2$ so that I appreciate proper highlighting.
> But I never encountered the opposite problem when a field should contain
> a single $.

My BibTeX file is in the same boat as yours, but I don't find the
highlighting of those thingies important at all.  The $ signs themselves
are more than enough to clarify visually what is what, since the text
between them is invariably short.

>> The other option is to try and make this choice on a field-by-field
>> basis, which seems like a lot of work for fairly little benefit.
>
> I agree it doesn't make sense to (try to) highlight different fields
> differently.  That's why I suggest that bibtex-mode continues to use
> only one syntax table.  But make it customizable how this syntax table
> treats $: You and the OP can make it a punctuation character (also fine
> with me as default, it doesn't cause harm), while it remains possible to
> keep the current behavior.

Another option is to mark $ as punctuation and then rely instead on
`font-lock-keywords` to highlight something like "\\$[^$\n]+\\$".
So $^2$ would still be highlighted in URLs but "foo$bar" wouldn't.


        Stefan





This bug report was last modified 2 years and 140 days ago.

Previous Next


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