From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Roland Winkler Newsgroups: gmane.emacs.bugs Subject: bug#50202: bibtex-mode: unescaped dollar sign in file field leads to wrong highlighting Date: Wed, 24 Aug 2022 21:58:25 -0500 Message-ID: <87zgftqbam.fsf@gnu.org> References: <87mtbw4acj.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1046"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 50202@debbugs.gnu.org, Stefan Monnier , Yuu Yin To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 25 04:59:39 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oR35m-000AeD-LF for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 25 Aug 2022 04:59:38 +0200 Original-Received: from localhost ([::1]:56494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oR35k-0006zL-3T for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 24 Aug 2022 22:59:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oR35D-0006zC-L0 for bug-gnu-emacs@gnu.org; Wed, 24 Aug 2022 22:59:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58770) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oR35C-0002vl-HS for bug-gnu-emacs@gnu.org; Wed, 24 Aug 2022 22:59:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oR35C-0001CO-7U for bug-gnu-emacs@gnu.org; Wed, 24 Aug 2022 22:59:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Roland Winkler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 25 Aug 2022 02:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50202 X-GNU-PR-Package: emacs Original-Received: via spool by 50202-submit@debbugs.gnu.org id=B50202.16613963204580 (code B ref 50202); Thu, 25 Aug 2022 02:59:02 +0000 Original-Received: (at 50202) by debbugs.gnu.org; 25 Aug 2022 02:58:40 +0000 Original-Received: from localhost ([127.0.0.1]:48518 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oR34q-0001Bo-EC for submit@debbugs.gnu.org; Wed, 24 Aug 2022 22:58:40 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:48246) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oR34k-0001BV-S6 for 50202@debbugs.gnu.org; Wed, 24 Aug 2022 22:58:38 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:60506) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oR34e-0002tf-Kq; Wed, 24 Aug 2022 22:58:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=k4lV/KKFaKOvk08Y61hray8iNvvbSLWBHoagGopRKto=; b=l1qnNFTiHSHVYlnMNfqw XaLWfnYyWRz8SYaq8QfzzHtCeX/iQBlygkOPi66fokGoRjYF7MjSBZQdGnz1QwCbZPYCzHI2L73fs now34xB8AkgR4iS3M8c4XokQUymPdXNMfNF/SQK1eS7lO1acQPx3QpPBpu1B9wHqOIYZ7icjSMwyk TQB82atdps27ELE9tn+kaNg1PKA3A33k0jVlxS6Wk73G90knkac5Dy3RPkrOmKVDldScpFxm/ifqc 2mbF/AN+7lp4wKFo81eNLmHO/bmTB6Fiz2ZkDqa/VVgYweR8ulm1dDSMKVAXLT80XR4e2gZiMbnSx hiJAzDCMAf4Tyg==; Original-Received: from [2600:1700:5650:f790::42] (port=46540 helo=regnitz) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oR34d-0004Vn-6Y; Wed, 24 Aug 2022 22:58:27 -0400 In-Reply-To: <87mtbw4acj.fsf@gnus.org> (Lars Ingebrigtsen's message of "Mon, 22 Aug 2022 16:33:00 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:240678 Archived-At: On Mon, Aug 22 2022, Lars Ingebrigtsen wrote: > Yuu Yin 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