GNU bug report logs - #59638
13.0.9; reftex-toc counts incorrectly if section is commented out

Previous Next

Package: auctex;

Reported by: Uwe Brauer <oub <at> mat.ucm.es>

Date: Sun, 27 Nov 2022 17:27:02 UTC

Severity: normal

Found in version 13.0.9

Done: Arash Esbati <arash <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Arash Esbati <arash <at> gnu.org>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, 59638 <at> debbugs.gnu.org
Subject: bug#59638: 13.0.9; reftex-toc counts incorrectly if section is commented out
Date: Mon, 28 Nov 2022 09:13:13 +0100
Hi Tassilo,

Tassilo Horn <tsdh <at> gnu.org> writes:

> I'd call it a feature.  I mean, when you have commented out sections,
> you'll most probably intend to uncomment them again.  Otherwise, you
> could just delete them, no?

This feature was introduced with commit 1e8bb313ea in reftex.el.  The
change was good to make RefTeX recognize sectioning macros in .dtx file,
but I'd consider the behavior in regular .tex files as wrong.  What do
you think about this change:

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el
index e72576cdc7..c72dd5fa07 100644
--- a/lisp/textmodes/reftex.el
+++ b/lisp/textmodes/reftex.el
@@ -1005,9 +1005,13 @@ reftex-compile-variables

     ;; Calculate the regular expressions
     (let* (
-;          (wbol "\\(\\`\\|[\n\r]\\)[ \t]*")
-           (wbol "\\(^\\)%?[ \t]*") ; Need to keep the empty group because
-                                    ; match numbers are hard coded
+           ;; (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 "\\|")
                             "\\)"))
--8<---------------cut here---------------end--------------->8---

@Uwe: Meanwhile, you can try to comment out your sections like this:

%% \section{foo}

and you should get a correct TOC.

Best, Arash




This bug report was last modified 2 years and 155 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.