Commit b18cecf8 authored by Arash Esbati's avatar Arash Esbati Committed by Tassilo Horn

Improve matching of key-val labels (bug#34629)

* lisp/textmodes/reftex-vars.el (reftex-label-regexps): Improve
regexp for key-val labels in order to skip over content in braces.
parent d07f3aae
Pipeline #869 passed with stage
in 53 minutes and 4 seconds
......@@ -891,11 +891,29 @@ DOWNCASE t: Downcase words before using them."
;; so this list mustn't get any more items.
(defconst reftex-label-regexps '("\\\\label{\\([^}]*\\)}"))
(defcustom reftex-label-regexps
'(;; Normal \\label{foo} labels
`(;; Normal \\label{foo} labels
;; keyvals [..., label = {foo}, ...] forms used by ctable,
;; listings, minted, ...
;; Make sure we search only for optional arguments of
;; environments and don't match any other [
;; Match the opening [ and the following chars
;; Allow nested levels of chars enclosed in braces
;; Match the label key
;; Match the label value; braces around the value are
;; optional.
"{?\\(?1:[^] ,}\r\n\t%]+\\)}?"
;; We are done. Such 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
......@@ -905,7 +923,7 @@ 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
:version "25.1"
:version "27.1"
:set (lambda (symbol value)
(set symbol value)
(when (fboundp 'reftex-compile-variables)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment