[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#22077: Possible bug in `reftex-what-index-tag'
From: |
Arash Esbati |
Subject: |
bug#22077: Possible bug in `reftex-what-index-tag' |
Date: |
Wed, 02 Dec 2015 22:33:53 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 |
Hi all,
please consider the following example:
--8<---------------cut here---------------start------------->8---
\documentclass{article}
\usepackage{index}
\newindex{aut}{adx}{and}{Name Index}
\begin{document}
`C-c C-m index RET aut RET' enters `\index[aut]' in buffer
and exits with `(wrong-type-argument integer-or-marker-p nil)'.
\end{document}
--8<---------------cut here---------------end--------------->8---
Debugger says:
--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
reftex-what-index-tag()
TeX-arg-index(nil)
TeX-parse-argument(nil TeX-arg-index)
TeX-parse-arguments(([TeX-arg-index-tag] TeX-arg-index))
TeX-parse-macro("index" ([TeX-arg-index-tag] TeX-arg-index))
TeX-insert-macro("index")
call-interactively(TeX-insert-macro nil nil)
command-execute(TeX-insert-macro)
--8<---------------cut here---------------end--------------->8---
If I get this correctly, the problem is in `(match-end 1)' part of
`reftex-what-index-tag' defined in `reftex-auc.el':
--8<---------------cut here---------------start------------->8---
(defun reftex-what-index-tag ()
;; Look backward to find out what index the macro at point belongs to
(let ((macro (save-excursion
(and (re-search-backward "\\\\[a-zA-Z*]+" nil t)
(match-string 0))))
tag entry)
(when (and macro
(setq entry (assoc macro reftex-index-macro-alist)))
(setq tag (nth 1 entry))
(cond
((stringp tag) tag)
((integerp tag)
(save-excursion
(goto-char (match-end 1))
(or (reftex-nth-arg tag (nth 6 entry)) "idx")))
(t "idx")))))
--8<---------------cut here---------------end--------------->8---
I think it should be `(match-end 0)' since the last search had no
parenthesized expression in regexp. In short:
--8<---------------cut here---------------start------------->8---
diff --git a/lisp/textmodes/reftex-auc.el b/lisp/textmodes/reftex-auc.el
index bbad065..151be59 100644
--- a/lisp/textmodes/reftex-auc.el
+++ b/lisp/textmodes/reftex-auc.el
@@ -137,7 +137,7 @@ reftex-what-index-tag
((stringp tag) tag)
((integerp tag)
(save-excursion
- (goto-char (match-end 1))
+ (goto-char (match-end 0))
(or (reftex-nth-arg tag (nth 6 entry)) "idx")))
(t "idx")))))
--8<---------------cut here---------------end--------------->8---
Any comments? I could make a proper patch for this.
Best, Arash
- bug#22077: Possible bug in `reftex-what-index-tag',
Arash Esbati <=