]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix handling of % when searching in .tex or .dtx files
authorArash Esbati <arash@gnu.org>
Wed, 14 Dec 2022 20:17:30 +0000 (21:17 +0100)
committerArash Esbati <arash@gnu.org>
Wed, 14 Dec 2022 20:17:30 +0000 (21:17 +0100)
* lisp/textmodes/reftex.el (reftex-compile-variables): Consider %
when building the regexp for searching only in .dtx files.
(AUCTeX bug#59638)

lisp/textmodes/reftex.el

index f815419ea44e7937708a81947520e0888b83872b..126b3777f55236969b57df7b0289718078ff576c 100644 (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 "\\|")
                             "\\)"))