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 #23 received at 50202 <at> debbugs.gnu.org (full text, mbox):

From: Roland Winkler <winkler <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
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 10:52:55 -0500
On Thu, Aug 25 2022, Stefan Monnier wrote:
> The downside of treating $ as punctuation is that $^2$ won't be
> highlighted specially, but the upside is that "foo$bar" won't be
> mishighlighted in a url.
>
> To me the highlighting of math formulas is sufficiently secondary that
> I'd err on the safe side (i.e. avoid mishighlighting).

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 $.

> 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.

Roland




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

Previous Next


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