GNU bug report logs - #65631
Xref updates stack in case of error

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Wed, 30 Aug 2023 16:48:02 UTC

Severity: normal

Tags: patch

Fixed in version 30.1

Done: Dmitry Gutov <dmitry <at> gutov.dev>

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 65631 in the body.
You can then email your comments to 65631 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 dmitry <at> gutov.dev, bug-gnu-emacs <at> gnu.org:
bug#65631; Package emacs. (Wed, 30 Aug 2023 16:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> linkov.net>:
New bug report received and forwarded. Copy sent to dmitry <at> gutov.dev, bug-gnu-emacs <at> gnu.org. (Wed, 30 Aug 2023 16:48:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: bug-gnu-emacs <at> gnu.org
Subject: Xref updates stack in case of error
Date: Wed, 30 Aug 2023 19:44:13 +0300
X-Debbugs-CC: Dmitry Gutov <dmitry <at> gutov.dev>

0. emacs -Q
1. move point to any word
2. type 'M-.' (xref-find-definitions)
3. an error is displayed correctly "No definitions found for: This"

But the problem is that an unrecognized word is added to the xref stack.
So the context menu shows "Go Back", and 'M-,' (xref-go-back) goes back
to that word.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65631; Package emacs. (Wed, 30 Aug 2023 17:02:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 65631 <at> debbugs.gnu.org, dmitry <at> gutov.dev
Subject: Re: bug#65631: Xref updates stack in case of error
Date: Wed, 30 Aug 2023 20:01:02 +0300
> Cc: dmitry gutov <dmitry <at> gutov.dev>
> From: Juri Linkov <juri <at> linkov.net>
> Date: Wed, 30 Aug 2023 19:44:13 +0300
> 
> X-Debbugs-CC: Dmitry Gutov <dmitry <at> gutov.dev>
> 
> 0. emacs -Q
> 1. move point to any word
> 2. type 'M-.' (xref-find-definitions)
> 3. an error is displayed correctly "No definitions found for: This"
> 
> But the problem is that an unrecognized word is added to the xref stack.
> So the context menu shows "Go Back", and 'M-,' (xref-go-back) goes back
> to that word.

FWIW, I'm not sure this is necessarily a bug.  It looks like a bug in
your case, because you deliberately tricked Xref into using a word
that is definitely not a program symbol.  But that is not the case in
a more reasonable situation, where point is on a symbol, but for some
reason the symbol's definition is not found, e.g., because the TAGS
table needs to be regenerated.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65631; Package emacs. (Wed, 30 Aug 2023 17:18:01 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 65631 <at> debbugs.gnu.org, dmitry <at> gutov.dev
Subject: Re: bug#65631: Xref updates stack in case of error
Date: Wed, 30 Aug 2023 20:16:07 +0300
>> 1. move point to any word
>> 2. type 'M-.' (xref-find-definitions)
>> 3. an error is displayed correctly "No definitions found for: This"
>>
>> But the problem is that an unrecognized word is added to the xref stack.
>> So the context menu shows "Go Back", and 'M-,' (xref-go-back) goes back
>> to that word.
>
> FWIW, I'm not sure this is necessarily a bug.  It looks like a bug in
> your case, because you deliberately tricked Xref into using a word
> that is definitely not a program symbol.  But that is not the case in
> a more reasonable situation, where point is on a symbol, but for some
> reason the symbol's definition is not found, e.g., because the TAGS
> table needs to be regenerated.

In case of error, point doesn't move.  So there is no need to go back.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65631; Package emacs. (Thu, 31 Aug 2023 00:52:02 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Juri Linkov <juri <at> linkov.net>, Eli Zaretskii <eliz <at> gnu.org>
Cc: 65631 <at> debbugs.gnu.org
Subject: Re: bug#65631: Xref updates stack in case of error
Date: Thu, 31 Aug 2023 03:50:53 +0300
[Message part 1 (text/plain, inline)]
Hi!

On 30/08/2023 20:16, Juri Linkov wrote:
>>> 1. move point to any word
>>> 2. type 'M-.' (xref-find-definitions)
>>> 3. an error is displayed correctly "No definitions found for: This"
>>>
>>> But the problem is that an unrecognized word is added to the xref stack.
>>> So the context menu shows "Go Back", and 'M-,' (xref-go-back) goes back
>>> to that word.
>> FWIW, I'm not sure this is necessarily a bug.  It looks like a bug in
>> your case, because you deliberately tricked Xref into using a word
>> that is definitely not a program symbol.  But that is not the case in
>> a more reasonable situation, where point is on a symbol, but for some
>> reason the symbol's definition is not found, e.g., because the TAGS
>> table needs to be regenerated.
> In case of error, point doesn't move.  So there is no need to go back.

At this point, I was kind of feeling that this is a known-but-tolerated 
behavior (that some might already be relying on, also known as "spacebar 
heater" effect), but if it's still annoying, let's see about a fix.

How's the attached patch?
[xref--push-markers.diff (text/x-patch, attachment)]

Added tag(s) patch. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 31 Aug 2023 11:22:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65631; Package emacs. (Thu, 31 Aug 2023 16:44:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 65631 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#65631: Xref updates stack in case of error
Date: Thu, 31 Aug 2023 19:33:07 +0300
>>>> 1. move point to any word
>>>> 2. type 'M-.' (xref-find-definitions)
>>>> 3. an error is displayed correctly "No definitions found for: This"
>>>>
>>>> But the problem is that an unrecognized word is added to the xref stack.
>>>> So the context menu shows "Go Back", and 'M-,' (xref-go-back) goes back
>>>> to that word.
>>> FWIW, I'm not sure this is necessarily a bug.  It looks like a bug in
>>> your case, because you deliberately tricked Xref into using a word
>>> that is definitely not a program symbol.  But that is not the case in
>>> a more reasonable situation, where point is on a symbol, but for some
>>> reason the symbol's definition is not found, e.g., because the TAGS
>>> table needs to be regenerated.
>> In case of error, point doesn't move.  So there is no need to go back.
>
> At this point, I was kind of feeling that this is a known-but-tolerated
> behavior (that some might already be relying on, also known as "spacebar
> heater" effect), but if it's still annoying, let's see about a fix.

It's not annoying, just surprises with the requirement to type extra ‘M-,’.

> How's the attached patch?

Thanks.  I expected a smaller change, but if this is still reliable,
then why not.  At least, it works in cases that I tested.




Reply sent to Dmitry Gutov <dmitry <at> gutov.dev>:
You have taken responsibility. (Fri, 01 Sep 2023 01:40:02 GMT) Full text and rfc822 format available.

Notification sent to Juri Linkov <juri <at> linkov.net>:
bug acknowledged by developer. (Fri, 01 Sep 2023 01:40:02 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Juri Linkov <juri <at> linkov.net>
Cc: 65631-done <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#65631: Xref updates stack in case of error
Date: Fri, 1 Sep 2023 04:39:34 +0300
Version: 30.1

On 31/08/2023 19:33, Juri Linkov wrote:
>>>>> 1. move point to any word
>>>>> 2. type 'M-.' (xref-find-definitions)
>>>>> 3. an error is displayed correctly "No definitions found for: This"
>>>>>
>>>>> But the problem is that an unrecognized word is added to the xref stack.
>>>>> So the context menu shows "Go Back", and 'M-,' (xref-go-back) goes back
>>>>> to that word.
>>>> FWIW, I'm not sure this is necessarily a bug.  It looks like a bug in
>>>> your case, because you deliberately tricked Xref into using a word
>>>> that is definitely not a program symbol.  But that is not the case in
>>>> a more reasonable situation, where point is on a symbol, but for some
>>>> reason the symbol's definition is not found, e.g., because the TAGS
>>>> table needs to be regenerated.
>>> In case of error, point doesn't move.  So there is no need to go back.
>>
>> At this point, I was kind of feeling that this is a known-but-tolerated
>> behavior (that some might already be relying on, also known as "spacebar
>> heater" effect), but if it's still annoying, let's see about a fix.
> 
> It's not annoying, just surprises with the requirement to type extra ‘M-,’.
> 
>> How's the attached patch?
> 
> Thanks.  I expected a smaller change, but if this is still reliable,
> then why not.  At least, it works in cases that I tested.

I was looking for a smaller change, too. Thanks for testing.

Pushed to master in 17188e07ab9, closing.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65631; Package emacs. (Fri, 01 Sep 2023 13:26:02 GMT) Full text and rfc822 format available.

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

From: Mattias Engdegård <mattias.engdegard <at> gmail.com>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 65631 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 Juri Linkov <juri <at> linkov.net>
Subject: bug#65631: Xref updates stack in case of error
Date: Fri, 1 Sep 2023 15:25:30 +0200
17188e07ab9 appears to break etags-tests on master.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65631; Package emacs. (Sat, 02 Sep 2023 02:01:02 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Mattias Engdegård <mattias.engdegard <at> gmail.com>
Cc: 65631 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#65631: Xref updates stack in case of error
Date: Sat, 2 Sep 2023 05:00:27 +0300
On 01/09/2023 16:25, Mattias Engdegård wrote:
> 17188e07ab9 appears to break etags-tests on master.

Thanks for reporting, should be fixed in f735eb9628.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 30 Sep 2023 11:24:13 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 223 days ago.

Previous Next


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