GNU bug report logs - #32089
RefTeX: Regexp for parsing labels in optional arguments

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: auctex; Reported by: Arash Esbati <arash.esbati@HIDDEN>; dated Sat, 7 Jul 2018 21:25:02 UTC; Maintainer for auctex is bug-auctex@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 7 Jul 2018 21:24:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 07 17:24:10 2018
Received: from localhost ([127.0.0.1]:50479 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fbugc-0004vi-51
	for submit <at> 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 <arash.esbati@HIDDEN>) id 1fbuV0-0004ce-9F
 for submit <at> 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 <arash.esbati@HIDDEN>) id 1fbuUu-0000qK-FN
 for submit <at> 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 <arash.esbati@HIDDEN>)
 id 1fbuUu-0000qB-B2
 for submit <at> 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 <arash.esbati@HIDDEN>) id 1fbuUt-0005XN-5d
 for bug-auctex@HIDDEN; Sat, 07 Jul 2018 17:12:04 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <arash.esbati@HIDDEN>) id 1fbuUp-0000nr-UL
 for bug-auctex@HIDDEN; 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 <arash.esbati@HIDDEN>)
 id 1fbuUp-0000mN-NC
 for bug-auctex@HIDDEN; Sat, 07 Jul 2018 17:11:59 -0400
Received: by mail-wr1-x441.google.com with SMTP id j5-v6so687898wrr.8
 for <bug-auctex@HIDDEN>; 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 <bug-auctex@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 07 Jul 2018 14:11:56 -0700 (PDT)
From: Arash Esbati <arash.esbati@HIDDEN>
To: auctex-bugs <bug-auctex@HIDDEN>
Subject: RefTeX: Regexp for parsing labels in optional arguments
Date: Sat, 07 Jul 2018 23:11:26 +0200
Message-ID: <86va9qg39d.fsf@HIDDEN>
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 <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
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\\}\\<label[[:space:]]*=[[:space:]]*{?\\(?1:[^],}]+\\)}?")
+      "\\[[^][]\\{0,2000\\}\\<label[[:space:]]*=[[:space:]]*{?\\(?1:[^], \t\n\r%}]+\\)}?")
     "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.

Best, Arash




Acknowledgement sent to Arash Esbati <arash.esbati@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-auctex@HIDDEN. Full text available.
Report forwarded to bug-auctex@HIDDEN:
bug#32089; Package auctex. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 7 Jul 2018 21:30:02 UTC

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