GNU bug report logs - #20820
25.0.50; [PATCH] Default for reftex-label-regexps is too loose

Previous Next

Package: emacs;

Reported by: Nils Ackermann <nils <at> ackermath.info>

Date: Mon, 15 Jun 2015 19:39:02 UTC

Severity: normal

Tags: patch

Found in version 25.0.50

Fixed in version 25.1

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 20820 in the body.
You can then email your comments to 20820 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#20820; Package emacs. (Mon, 15 Jun 2015 19:39:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nils Ackermann <nils <at> ackermath.info>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 15 Jun 2015 19:39:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nils Ackermann <nils <at> ackermath.info>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.50; [PATCH] Default for reftex-label-regexps is too loose
Date: Mon, 15 Jun 2015 14:02:34 -0500
The following valid latex test file shows the problem:

====
\documentclass{article}
\usepackage{enumitem}

\begin{document}
\section{A}
 [
\section{B}
  \begin{enumerate}[label=a]
  \item 
  \end{enumerate}
\end{document}
====

After loading `reftex', calling `reftex-toc' in the buffer with above
test file results in the following output:

====
TABLE-OF-CONTENTS on /path/to/test.tex
SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help
------------------------------------------------------------------------------
     1 A

====

while the following would be expected:

====
TABLE-OF-CONTENTS on /path/to/test.tex
SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help
------------------------------------------------------------------------------
     1 A
     2 B

====

The default regexp in reftex-label-regexps consumes everything from the
first opening `[' until the `label=' clause, hiding relevant material in
between.

This is a problem because in mathematics texts unbalanced brackets
appear commonly.  The gobbled up text is then not accessible from reftex
anymore.

Proposed fix:

---
 lisp/textmodes/reftex-vars.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el
index 7f050e9..4eb0432 100644
--- a/lisp/textmodes/reftex-vars.el
+++ b/lisp/textmodes/reftex-vars.el
@@ -876,7 +876,7 @@ DOWNCASE    t:   Downcase words before using them."
       "\\\\label{\\(?1:[^}]*\\)}"
       ;; keyvals [..., label = {foo}, ...] forms used by ctable,
       ;; listings, minted, ...
-      "\\[[^]]*\\<label[[:space:]]*=[[:space:]]*{?\\(?1:[^],}]+\\)}?")
+      "\\[[^[]]*\\<label[[:space:]]*=[[:space:]]*{?\\(?1:[^],}]+\\)}?")
     "List of regexps matching \\label definitions.
 The default value matches usual \\label{...} definitions and
 keyval style [..., label = {...}, ...] label definitions.  It is
-- 
1.9.1

In GNU Emacs 25.0.50.1 (x86_64-unknown-linux-gnu)
 of 2015-06-15 on aphrodite
Repository revision: f0f216eaa1ebc84457812f66a5e714721245ef9d
System Description:	Ubuntu 14.04.1 LTS

Configured using:
 `configure --without-x'

Configured features:
JPEG SOUND DBUS NOTIFY ACL GNUTLS ZLIB

Important settings:
  value of $LC_ALL: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Info

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Composing main Info directory...done
Found `--debug-init' in Option Index.  (26 total; use `,' for next)
Found `debug_print' in Command Index.  (26 total; use `,' for next)

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message dired format-spec
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail regexp-opt rfc2047 rfc2045
ietf-drums mm-util help-fns mail-prsvr mail-utils info tool-bar easymenu
term/xterm xterm byte-opt gv bytecomp byte-compile cl-extra seq
cl-loaddefs pcase cl-lib cconv time-date mule-util tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type tabulated-list
newcomment elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow timer select mouse jit-lock font-lock syntax facemenu
font-core frame cl-generic cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind gfilenotify
multi-tty make-network-process emacs)

Memory information:
((conses 16 199619 6741)
 (symbols 48 18902 0)
 (miscs 40 68 248)
 (strings 32 24335 7161)
 (string-bytes 1 682421)
 (vectors 16 9830)
 (vector-slots 8 365902 7860)
 (floats 8 114 255)
 (intervals 56 34479 187)
 (buffers 976 12)
 (heap 1024 42239 918))





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20820; Package emacs. (Tue, 16 Jun 2015 07:28:01 GMT) Full text and rfc822 format available.

Message #8 received at 20820 <at> debbugs.gnu.org (full text, mbox):

From: Tassilo Horn <tsdh <at> gnu.org>
To: Nils Ackermann <nils <at> ackermath.info>
Cc: 20820 <at> debbugs.gnu.org
Subject: Re: bug#20820: 25.0.50;
 [PATCH] Default for reftex-label-regexps is too loose
Date: Tue, 16 Jun 2015 09:27:28 +0200
Nils Ackermann <nils <at> ackermath.info> writes:

Hi Nils,

> The default regexp in reftex-label-regexps consumes everything from
> the first opening `[' until the `label=' clause, hiding relevant
> material in between.
>
> This is a problem because in mathematics texts unbalanced brackets
> appear commonly.  The gobbled up text is then not accessible from
> reftex anymore.

Thanks, I've applied your patch.

Bye,
Tassilo




bug marked as fixed in version 25.1, send any further explanations to 20820 <at> debbugs.gnu.org and Nils Ackermann <nils <at> ackermath.info> Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 16 Jun 2015 16:54:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 15 Jul 2015 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 342 days ago.

Previous Next


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