Fix handling of % when searching in .tex or .dtx files

* lisp/textmodes/reftex.el (reftex-compile-variables): Consider %
when building the regexp for searching only in .dtx files.
(AUCTeX bug#59638)
This commit is contained in:
Arash Esbati 2022-12-14 21:17:30 +01:00
parent 3b226b6024
commit 622838b957

View file

@ -1004,10 +1004,13 @@ This enforces rescanning the buffer on next use."
reftex-section-levels))
;; Calculate the regular expressions
(let* (
; (wbol "\\(\\`\\|[\n\r]\\)[ \t]*")
(wbol "\\(^\\)%?[ \t]*") ; Need to keep the empty group because
; match numbers are hard coded
(let* (;; (wbol "\\(\\`\\|[\n\r]\\)[ \t]*")
;; Need to keep the empty group because match numbers are
;; hard coded
(wbol (concat "\\(^\\)"
(when (string-suffix-p ".dtx" (buffer-file-name) t)
"%")
"[ \t]*"))
(label-re (concat "\\(?:"
(mapconcat #'identity reftex-label-regexps "\\|")
"\\)"))