From: Arash Esbati <arash@gnu.org>
To: Tassilo Horn <tsdh@gnu.org>
Cc: auctex-devel <auctex-devel@gnu.org>, 34629@debbugs.gnu.org
Subject: bug#34629: 27.0.50; Wrong parsing of key-val labels
Date: Fri, 08 Mar 2019 22:12:23 +0100 [thread overview]
Message-ID: <867ed9hxzc.fsf__17754.1532366135$1552079655$gmane$org@gnu.org> (raw)
In-Reply-To: <87fts9ta61.fsf@gnu.org> (Tassilo Horn's message of "Wed, 27 Feb 2019 18:26:30 +0100")
[-- Attachment #1: Type: text/plain, Size: 720 bytes --]
Tassilo Horn <tsdh@gnu.org> writes:
> Arash Esbati <arash@gnu.org> writes:
>
>> The is due to the second regexp in `reftex-label-regexps'. Please
>> find attached a patch fixing this issue. Any comments welcome.
>
> Pushed to emacs master. Thanks a lot!
Hi Tassilo,
many thanks for installing the patch. Unfortunately, my last patch
wasn't good enough since I forgot that the ctable package provides a
macro and not an environment. The patch attached fixes this issue.
This patch hardcodes the search to the environments/macro provided by
the packages "listings", "breqn" and "ctable". I think this change is
acceptable; any other envs/macros can be added easily by the user and/or
AUCTeX styles.
Best, Arash
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Improve-matching-of-key-val-labels-yet-more-bug-3462.patch --]
[-- Type: text/x-patch, Size: 3255 bytes --]
From 557490e4bd37b794133fca128710f2918d4d005f Mon Sep 17 00:00:00 2001
From: Arash Esbati <arash@gnu.org>
Date: Fri, 8 Mar 2019 22:01:01 +0100
Subject: [PATCH] ; Improve matching of key-val labels yet more (bug#34629)
* lisp/textmodes/reftex-vars.el (reftex-label-regexps): Match
explicitly for key-val labels in optional arguments of
environments provided by "listings" and "breqn" packages and the
macro "\ctable" from the package of the same name.
Update docstring.
---
lisp/textmodes/reftex-vars.el | 33 ++++++++++++++++++++++++++-------
1 file changed, 26 insertions(+), 7 deletions(-)
diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el
index eb1dfc50a3..88ad4478b0 100644
--- a/lisp/textmodes/reftex-vars.el
+++ b/lisp/textmodes/reftex-vars.el
@@ -894,11 +894,25 @@ reftex-derive-label-parameters
`(;; Normal \\label{foo} labels
"\\\\label{\\(?1:[^}]*\\)}"
;; keyvals [..., label = {foo}, ...] forms used by ctable,
- ;; listings, minted, ...
+ ;; listings, breqn, ...
,(concat
;; Make sure we search only for optional arguments of
- ;; environments and don't match any other [
- "\\\\begin[[:space:]]*{\\(?:[^}]+\\)}[[:space:]]*"
+ ;; environments/macros and don't match any other [. ctable
+ ;; provides a macro called \ctable, listings/breqn have
+ ;; environments. Start with a backslash and a group for names
+ "\\\\\\(?:"
+ ;; begin, optional spaces and opening brace
+ "begin[[:space:]]*{"
+ ;; Build a regexp for env names
+ (regexp-opt '("lstlisting" "dmath" "dseries" "dgroup" "darray"))
+ ;; closing brace, optional spaces
+ "}[[:space:]]*"
+ ;; Now for macros
+ "\\|"
+ ;; Build a regexp for macro names; currently only \ctable
+ (regexp-opt '("ctable"))
+ ;; Close the group for names
+ "\\)"
;; Match the opening [ and the following chars
"\\[[^][]*"
;; Allow nested levels of chars enclosed in braces
@@ -912,13 +926,18 @@ reftex-derive-label-parameters
;; Match the label value; braces around the value are
;; optional.
"{?\\(?1:[^] ,}\r\n\t%]+\\)}?"
- ;; We are done. Such search until the next closing bracket
+ ;; We are done. Just search until the next closing bracket
"[^]]*\\]"))
"List of regexps matching \\label definitions.
The default value matches usual \\label{...} definitions and
-keyval style [..., label = {...}, ...] label definitions. It is
-assumed that the regexp group 1 matches the label text, so you
-have to define it using \\(?1:...\\) when adding new regexps.
+keyval style [..., label = {...}, ...] label definitions. The
+regexp for keyval style explicitly looks for environments
+provided by the packages \"listings\" (\"lstlisting\"),
+\"breqn\" (\"dmath\", \"dseries\", \"dgroup\", \"darray\") and
+the macro \"\\ctable\" provided by the package of the same name.
+
+It is assumed that the regexp group 1 matches the label text, so
+you have to define it using \\(?1:...\\) when adding new regexps.
When changed from Lisp, make sure to call
`reftex-compile-variables' afterwards to make the change
--
2.21.0
next prev parent reply other threads:[~2019-03-08 21:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-23 13:17 27.0.50; Wrong parsing of key-val labels Arash Esbati
2019-02-27 17:26 ` bug#34629: " Tassilo Horn
[not found] ` <87fts9ta61.fsf@gnu.org>
2019-03-08 21:12 ` Arash Esbati [this message]
[not found] ` <867ed9hxzc.fsf@gnu.org>
2019-03-09 6:50 ` Tassilo Horn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='867ed9hxzc.fsf__17754.1532366135$1552079655$gmane$org@gnu.org' \
--to=arash@gnu.org \
--cc=34629@debbugs.gnu.org \
--cc=auctex-devel@gnu.org \
--cc=tsdh@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).