GNU bug report logs -
#50202
bibtex-mode: unescaped dollar sign in file field leads to wrong highlighting
Previous Next
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 #11 received at 50202 <at> debbugs.gnu.org (full text, mbox):
On Mon, Aug 22 2022, Lars Ingebrigtsen wrote:
> Yuu Yin <yuuyin <at> protonmail.com> writes:
>
>> - bibtex-mode enabled,
>> - and a BibTeX entry which has as value for file field a path that
>> has dollar sign ~
>> /path/to/file $ name.ext~
>>
>> bibtex-mode doesn't recognizes that the dollar sign is verbatim for
>> the file field, leading to wrong highlighting.
>
> This behaviour is still present in Emacs 29. Perhaps Roland has some
> comments; added to the CCs.
A field "file" is, I believe, not part of standard BibTeX. So the above
is somewhat pushing the limits of BibTeX mode.
From a more practical perspective, I need to say that the above problem
reaches the limits of my knowledge of how font-lock works in general and
how it deals with the (La)TeX delimiter "$" in particular. Occassionally,
unpaired "$" give me strange results in LaTeX documents, though I have
no recipe to illustrate this.
I believe the above problem would require that BibTeX mode first parses
the BibTeX entries. Then it uses different syntax tables for normal
fields and the file field. I do not know how feasable this is, in
particular with larger BibTeX files.
I added Stefan to the CCs. Long time ago, he helped me with font-lock
for BibTeX mode. Maybe he has some comments.
Personally, I use a completely different strategy for associating file
names with BibTeX entries: the BibTeX autokey machinery generates the
nondirectory part of the filename that I associate with an entry. And
find-dired locates the file, whereever it resides under a certain
directory. So there is no file field at all that would require
maintenance.
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.