bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#50202: bibtex-mode: unescaped dollar sign in file field leads to wro


From: Stefan Monnier
Subject: bug#50202: bibtex-mode: unescaped dollar sign in file field leads to wrong highlighting
Date: Fri, 26 Aug 2022 15:00:31 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

> 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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]