emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#32089: closed (RefTeX: Regexp for parsing labels i


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#32089: closed (RefTeX: Regexp for parsing labels in optional arguments)
Date: Tue, 30 Apr 2019 22:03:02 +0000

Your message dated Wed, 01 May 2019 00:01:18 +0200
with message-id <address@hidden>
and subject line Re: bug#32089: RefTeX: Regexp for parsing labels in optional 
arguments
has caused the debbugs.gnu.org bug report #32089,
regarding RefTeX: Regexp for parsing labels in optional arguments
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
32089: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=32089
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: RefTeX: Regexp for parsing labels in optional arguments Date: Sat, 07 Jul 2018 23:11:26 +0200 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1
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



--- End Message ---
--- Begin Message --- Subject: Re: bug#32089: RefTeX: Regexp for parsing labels in optional arguments Date: Wed, 01 May 2019 00:01:18 +0200 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50
> 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.

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


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]