From unknown Sat Jun 14 00:05:56 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#32089 <32089@debbugs.gnu.org> To: bug#32089 <32089@debbugs.gnu.org> Subject: Status: RefTeX: Regexp for parsing labels in optional arguments Reply-To: bug#32089 <32089@debbugs.gnu.org> Date: Sat, 14 Jun 2025 07:05:56 +0000 retitle 32089 RefTeX: Regexp for parsing labels in optional arguments reassign 32089 auctex submitter 32089 Arash Esbati severity 32089 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 07 17:24:10 2018 Received: (at submit) by debbugs.gnu.org; 7 Jul 2018 21:24:10 +0000 Received: from localhost ([127.0.0.1]:50479 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fbugc-0004vi-51 for submit@debbugs.gnu.org; Sat, 07 Jul 2018 17:24:10 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46422) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fbuV0-0004ce-9F for submit@debbugs.gnu.org; Sat, 07 Jul 2018 17:12:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fbuUu-0000qK-FN for submit@debbugs.gnu.org; Sat, 07 Jul 2018 17:12:05 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:58489) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fbuUu-0000qB-B2 for submit@debbugs.gnu.org; Sat, 07 Jul 2018 17:12:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37393) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fbuUt-0005XN-5d for bug-auctex@gnu.org; Sat, 07 Jul 2018 17:12:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fbuUp-0000nr-UL for bug-auctex@gnu.org; Sat, 07 Jul 2018 17:12:03 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:41840) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fbuUp-0000mN-NC for bug-auctex@gnu.org; Sat, 07 Jul 2018 17:11:59 -0400 Received: by mail-wr1-x441.google.com with SMTP id j5-v6so687898wrr.8 for ; Sat, 07 Jul 2018 14:11:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:user-agent:mime-version; bh=rJik22Bd4sQbiNR/jLw5EE1ZYICnEgkhhktmPuBh4aY=; b=VLaqYPdzZVVXUdY7xrxsr8cutpPibkFDyHni+1J24b+Fy6P9OnbI/ldx8uCzvqNeO+ YwGZbPvo3lvbT2Uzxht3gtlGF9pGwISnApLKVYRNH4ziqHBNgfgqnWv7ddux2cwPKnRT vtfJnICm5D0RvWJP4pI1fY1uvdSvKJfrsyRs0XNl6kitXZaNjZX8eX8bP+/5hvw7E/2O sa/fEIaei4SFC2d96dDiA4sTOIwtPLsjdKBytt42Sl09CntE8Cm24bxCwi2d4UcOgIa3 bW1U/0Uc0QSjmPJ0NV1BvmxMlWtoL37IrI1dIwLGWk2O3LvVvEDg32Sy/nev18pw1Cdf hb1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version; bh=rJik22Bd4sQbiNR/jLw5EE1ZYICnEgkhhktmPuBh4aY=; b=S/OMFMCLNQhbe6d/DzVIVcoLenrvkjKinYgOYZ3Bx3Gk+d0zJ1f/UotxGDu+cu85wA WfRJtfgmS6aGVRyA5ZePlZFDhZ+79a90dREfV/l08hRnxNBOuHP9LrOGdE6SMvf+vEh8 REW1O6mUBsaJS4hNVfXVdrY5ldN1VuZQGTjsAe6eYU7clnoocvHexb/kKOHfdE/O9r5t 248uQo6U5Oyy22sWty5SX48vaKWRCW+OFutEfTfYFDz5COJOO0WeuuAwCJ0zy8ulPxdc Yrw5kEVEgHuxYQ7Lq2977osDoz9VrO/OtNs3bc3oBwxFc0na9Hc4Ho1oFQuWi3GLPUOh 5vww== X-Gm-Message-State: APt69E1bcAkAuqpnHWTjQ7Rk4Wm8scHKb4mfNl1ZkMzOQQolEaNI+111 AbCfjWqjKThMtKEkKU9M9uW+Wuwm X-Google-Smtp-Source: AAOMgpfN5LmrN3zfcDJYsz0a3Dsxe+IGoTRzzJk6t1dsunWChqOeJelBdez5ED6pMKaxcTS0lEkUCw== X-Received: by 2002:adf:a9b3:: with SMTP id b48-v6mr10501691wrd.48.1530997917072; Sat, 07 Jul 2018 14:11:57 -0700 (PDT) Received: from MUTANT (p5B326E19.dip0.t-ipconnect.de. [91.50.110.25]) by smtp.gmail.com with ESMTPSA id r2-v6sm19589013wmb.39.2018.07.07.14.11.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 Jul 2018 14:11:56 -0700 (PDT) From: Arash Esbati To: auctex-bugs Subject: RefTeX: Regexp for parsing labels in optional arguments Date: Sat, 07 Jul 2018 23:11:26 +0200 Message-ID: <86va9qg39d.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sat, 07 Jul 2018 17:24:09 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Hi all, please consider the following example: --8<---------------cut here---------------start------------->8--- \documentclass{article} \usepackage{listings} \begin{document} \begin{lstlisting}[ caption={Some caption}, label=lst:1] Some code \end{lstlisting} \begin{lstlisting}[ caption={Some caption}, label=lst:2 ] Some code \end{lstlisting} \begin{lstlisting}[ caption = {Some caption}, label = lst:3 ] Some code \end{lstlisting} \ref{lst:1}, \ref{lst:2 }, \ref{lst:3 } \ref{lst:1}, \ref{lst:2}, \ref{lst:3} \end{document} --8<---------------cut here---------------end--------------->8--- With RefTeX active, it fails to parse the labels defined in optional arguments correctly (see the first set of \ref commands). It is due to the regex defined in `reftex-label-regexps' in `reftex-vars.el' which expects one of ],} directly after the label. With the following patch, it parses the labels correctly: --8<---------------cut here---------------start------------->8--- diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el index 11dbb8d..66d800d 100644 --- a/lisp/textmodes/reftex-vars.el +++ b/lisp/textmodes/reftex-vars.el @@ -895,7 +895,7 @@ DOWNCASE t: Downcase words before using them." "\\\\label{\\(?1:[^}]*\\)}" ;; keyvals [..., label = {foo}, ...] forms used by ctable, ;; listings, minted, ... - "\\[[^][]\\{0,2000\\}\\8--- Any suggestion if I'm missing a character? My next step would be to add the same regexp to `LaTeX-auto-label-regexp-list' in order to make AUCTeX also capable of this feature. Any comments welcome. Best, Arash From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 30 18:02:20 2019 Received: (at 32089-close) by debbugs.gnu.org; 30 Apr 2019 22:02:20 +0000 Received: from localhost ([127.0.0.1]:42685 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hLapP-0005gI-Qh for submit@debbugs.gnu.org; Tue, 30 Apr 2019 18:02:20 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56831) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hLapN-0005g5-BD for 32089-close@debbugs.gnu.org; Tue, 30 Apr 2019 18:02:18 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:56060) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLapH-00013q-VV for 32089-close@debbugs.gnu.org; Tue, 30 Apr 2019 18:02:12 -0400 Received: from p4fe3ed71.dip0.t-ipconnect.de ([79.227.237.113]:52048 helo=MUTANT) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1hLapH-0003BG-B2 for 32089-close@debbugs.gnu.org; Tue, 30 Apr 2019 18:02:11 -0400 From: Arash Esbati To: 32089-close@debbugs.gnu.org Subject: Re: bug#32089: RefTeX: Regexp for parsing labels in optional arguments References: <86va9qg39d.fsf@gmail.com> Date: Wed, 01 May 2019 00:01:18 +0200 In-Reply-To: <86va9qg39d.fsf@gmail.com> (Arash Esbati's message of "Sat, 07 Jul 2018 23:11:26 +0200") Message-ID: <86v9yvkv9t.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 32089-close X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > It is due to the regex defined in `reftex-label-regexps' in > `reftex-vars.el' which expects one of ],} directly after the label. > With the following patch, it parses the labels correctly: > > --8<---------------cut here---------------start------------->8--- > diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el > index 11dbb8d..66d800d 100644 > --- a/lisp/textmodes/reftex-vars.el > +++ b/lisp/textmodes/reftex-vars.el > @@ -895,7 +895,7 @@ DOWNCASE t: Downcase words before using them." > "\\\\label{\\(?1:[^}]*\\)}" > ;; keyvals [..., label = {foo}, ...] forms used by ctable, > ;; listings, minted, ... > - "\\[[^][]\\{0,2000\\}\\ + "\\[[^][]\\{0,2000\\}\\ "List of regexps matching \\label definitions. > The default value matches usual \\label{...} definitions and > keyval style [..., label = {...}, ...] label definitions. It is > --8<---------------cut here---------------end--------------->8--- > > Any suggestion if I'm missing a character? My next step would be to add > the same regexp to `LaTeX-auto-label-regexp-list' in order to make > AUCTeX also capable of this feature. Any comments welcome. Following up myself, I'm closing this one as it is fixed in Emacs: http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=b18cecf89bbb9d2d057f86e8fa1a1f1417d887b6 http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=eed512814c45cd5859a1814bf07ad18ea3fa3b1a Best, Arash From unknown Sat Jun 14 00:05:56 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 29 May 2019 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator