GNU bug report logs - #22077
Possible bug in `reftex-what-index-tag'

Previous Next

Package: auctex;

Reported by: Arash Esbati <esbati <at> gmx.de>

Date: Wed, 2 Dec 2015 21:38:02 UTC

Severity: normal

Done: Tassilo Horn <tsdh <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 22077 in the body.
You can then email your comments to 22077 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-auctex <at> gnu.org:
bug#22077; Package auctex. (Wed, 02 Dec 2015 21:38:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Arash Esbati <esbati <at> gmx.de>:
New bug report received and forwarded. Copy sent to bug-auctex <at> gnu.org. (Wed, 02 Dec 2015 21:38:02 GMT) Full text and rfc822 format available.

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

From: Arash Esbati <esbati <at> gmx.de>
To: bug-auctex <at> gnu.org
Subject: Possible bug in `reftex-what-index-tag'
Date: Wed, 02 Dec 2015 22:33:53 +0100
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





Information forwarded to bug-auctex <at> gnu.org:
bug#22077; Package auctex. (Wed, 02 Dec 2015 22:50:02 GMT) Full text and rfc822 format available.

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

From: Mosè Giordano <mose <at> gnu.org>
To: bug-auctex <bug-auctex <at> gnu.org>
Cc: 22077 <at> debbugs.gnu.org
Subject: Re: bug#22077: Possible bug in `reftex-what-index-tag'
Date: Wed, 2 Dec 2015 23:48:06 +0100
Hi Arash,

2015-12-02 22:33 GMT+01:00 Arash Esbati <esbati <at> gmx.de>:
> 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.

Yes, you're right, `goto-char' is called with nil argument.  And yes,
a proper patch would be useful, even if it's a one-liner change.  BTW,
you signed the copyright paper only for AUCTeX, should you want to
provide more substantial contributions for RefTeX you have to sign the
copyright paper for Emacs as well.

Bye,
Mosè




Information forwarded to bug-auctex <at> gnu.org:
bug#22077; Package auctex. (Wed, 02 Dec 2015 22:50:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-auctex <at> gnu.org:
bug#22077; Package auctex. (Fri, 04 Dec 2015 20:16:02 GMT) Full text and rfc822 format available.

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

From: Tassilo Horn <tsdh <at> gnu.org>
To: Mosè Giordano <mose <at> gnu.org>
Cc: 22077 <at> debbugs.gnu.org
Subject: Re: bug#22077: Possible bug in `reftex-what-index-tag'
Date: Fri, 04 Dec 2015 21:14:53 +0100
Mosè Giordano <mose <at> gnu.org> writes:

>> 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.
>
> Yes, you're right, `goto-char' is called with nil argument.  And yes,
> a proper patch would be useful, even if it's a one-liner change.

I've just committed this trivial patch under Arash's name.

> BTW, you signed the copyright paper only for AUCTeX, should you want
> to provide more substantial contributions for RefTeX you have to sign
> the copyright paper for Emacs as well.

Yes, that would be good anyway.

Bye,
Tassilo




Reply sent to Tassilo Horn <tsdh <at> gnu.org>:
You have taken responsibility. (Fri, 04 Dec 2015 20:16:02 GMT) Full text and rfc822 format available.

Notification sent to Arash Esbati <esbati <at> gmx.de>:
bug acknowledged by developer. (Fri, 04 Dec 2015 20:16:03 GMT) Full text and rfc822 format available.

Message #19 received at 22077-done <at> debbugs.gnu.org (full text, mbox):

From: Tassilo Horn <tsdh <at> gnu.org>
To: Mosè Giordano <mose <at> gnu.org>
Cc: 22077-done <at> debbugs.gnu.org
Subject: Re: bug#22077: Possible bug in `reftex-what-index-tag'
Date: Fri, 04 Dec 2015 21:15:19 +0100
Ups, forgotten to close...

Bye,
Tassilo




Information forwarded to bug-auctex <at> gnu.org:
bug#22077; Package auctex. (Fri, 04 Dec 2015 21:56:01 GMT) Full text and rfc822 format available.

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

From: Arash Esbati <esbati <at> gmx.de>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: 22077 <at> debbugs.gnu.org, Mosè Giordano <mose <at> gnu.org>
Subject: Re: bug#22077: Possible bug in `reftex-what-index-tag'
Date: Fri, 04 Dec 2015 22:54:19 +0100
Tassilo Horn <tsdh <at> gnu.org> writes:

> Mosè Giordano <mose <at> gnu.org> writes:
>
>>> 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.
>>
>> Yes, you're right, `goto-char' is called with nil argument.  And yes,
>> a proper patch would be useful, even if it's a one-liner change.

Mosè, many thanks for double-checking and the thumbs up.

> I've just committed this trivial patch under Arash's name.

Tassilo, many thanks for applying the one-liner.  I was about to prepare
a patch.

>> BTW, you signed the copyright paper only for AUCTeX, should you want
>> to provide more substantial contributions for RefTeX you have to sign
>> the copyright paper for Emacs as well.
>
> Yes, that would be good anyway.

Actually, I'm trying hard to avoid RefTeX realms ;-) (The code is not
easy to understand)  I will sign the copyright paper for Emacs as well.

Thanks, Arash




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 02 Jan 2016 12:24:03 GMT) Full text and rfc822 format available.

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

Previous Next


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