From: Arash Esbati Date: Wed, 14 Dec 2022 20:17:30 +0000 (+0100) Subject: Fix handling of % when searching in .tex or .dtx files X-Git-Tag: emacs-29.0.90~1171 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=622838b957e240d700585050e9ddbd036e690513;p=emacs.git 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) --- diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el index f815419ea44..126b3777f55 100644 --- a/lisp/textmodes/reftex.el +++ b/lisp/textmodes/reftex.el @@ -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 "\\|") "\\)"))