GNU bug report logs - #38797
27.0.50; Feature request: provide the opposite of xref-pop-marker-stack

Previous Next

Package: emacs;

Reported by: yyoncho <yyoncho <at> gmail.com>

Date: Sun, 29 Dec 2019 18:12:02 UTC

Severity: wishlist

Tags: patch

Found in version 27.0.50

Done: Dmitry Gutov <dgutov <at> yandex.ru>

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 38797 in the body.
You can then email your comments to 38797 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#38797; Package emacs. (Sun, 29 Dec 2019 18:12:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to yyoncho <yyoncho <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 29 Dec 2019 18:12:02 GMT) Full text and rfc822 format available.

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

From: yyoncho <yyoncho <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50;
 Feature request: provide the opposite of xref-pop-marker-stack
Date: Sun, 29 Dec 2019 20:11:02 +0200
[Message part 1 (text/plain, inline)]
ATM there xref-pop-marker-stack which is equivalent to going backwards
but there is no operation for going forward.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38797; Package emacs. (Thu, 23 Jan 2020 14:14:02 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: yyoncho <yyoncho <at> gmail.com>, 38797 <at> debbugs.gnu.org
Subject: Re: bug#38797: 27.0.50; Feature request: provide the opposite of
 xref-pop-marker-stack
Date: Thu, 23 Jan 2020 17:13:38 +0300
Hi Ivan,

On 29.12.2019 21:11, yyoncho wrote:
> ATM there xref-pop-marker-stack which is equivalent to going backwards
> but there is no operation for going forward.

Do you want to try writing the patch?

Having written one third-party package for this purpose, and now using 
another (history), I personally have a whole set of requirements for 
this feature to be able to use it (e.g. making the rings window-local 
and having a visualization when moving back and forth).

I'm not sure how important those are for an average user, though. So... 
would you like to submit something you would be happy with personally?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38797; Package emacs. (Wed, 20 Oct 2021 19:13:02 GMT) Full text and rfc822 format available.

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

From: Mattias Engdegård <mattiase <at> acm.org>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: yyoncho <yyoncho <at> gmail.com>, 38797 <at> debbugs.gnu.org
Subject: bug#38797: 27.0.50; Feature request: provide the opposite of
 xref-pop-marker-stack
Date: Wed, 20 Oct 2021 21:12:32 +0200
[Message part 1 (text/plain, inline)]
As usual my message was lost. Here's the patch at least.

[0001-Add-xref-forward-history-bug-38797.patch (application/octet-stream, attachment)]

Added tag(s) patch. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 21 Oct 2021 00:39:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38797; Package emacs. (Sun, 24 Oct 2021 01:41:02 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Mattias Engdegård <mattiase <at> acm.org>
Cc: yyoncho <yyoncho <at> gmail.com>, 38797 <at> debbugs.gnu.org
Subject: Re: bug#38797: 27.0.50; Feature request: provide the opposite of
 xref-pop-marker-stack
Date: Sun, 24 Oct 2021 04:40:09 +0300
On 20.10.2021 22:12, Mattias Engdegård wrote:
> As usual my message was lost. Here's the patch at least.

Thanks, Mattias.

Some comments on the latest version of the patch:

- The removal of

  (defvaralias 'find-tag-marker-ring 'xref--marker-ring)

and the subsequent initialization of the aliased variable to a new ring 
will likely break any real code code which is still depending on that 
variable. Because now it is nil by default, and not a ring. Not sure 
what's the best solution, perhaps it's just time to remove it.

- The call

  (make-obsolete-variable 'xref-marker-ring-length nil "29.1")

is similarly pointless because the variable definition has been deleted. 
Declaring it obsolete does not help the fact that it is unbound now.

It could be made into an alias for the newly introduced 
tags-location-ring-length, I suppose.

Or we hold off on removing it, declare it obsolete (with some 
explanation), but keep using its alias in etags.el. That would mean 
dropping all changes in the etags.el part of the patch. But probably 
adding some 'with-suppressed-warinings' wrappers in there.

- Regarding the names of the commands, some alternatives:

* xref-rewind-history? It's a play on "fast forward". A bit cryptic, 
perhaps.
* xref-go-back and xref-go-forward? xref--history is fine the name of 
the variable, but the purpose of the commands seems obvious enough even 
without "history" in them.

No pressure. Just in case you like any of these better.

- The slots in the docstring of xref--history (should we call it 
xref--location-history?) could be called (BACK-STACK . FORWARD-STACK).

- xref-set-marker-ring-length's fate is changed accordingly to what we 
choose to do with xref-marker-ring-length.

- The FIXME about proposed xref--back-history-empty-p doesn't make much 
sense if the introduced function name is going to be private (we don't 
need private functions that aren't used in the package itself). 
xref-back-history-empty-p and xref-forward-history-empty-p could work. 
But we can keep xref-marker-stack-empty-p around, pending feature 
requests. Maybe add a boolean optional FORWARD argument. Or rename it to 
xref-history-empty-p, for instance (with the optional FORWARD argument).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38797; Package emacs. (Sun, 24 Oct 2021 07:58:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: Mattias Engdegård <mattiase <at> acm.org>,
 yyoncho <yyoncho <at> gmail.com>, 38797 <at> debbugs.gnu.org
Subject: Re: bug#38797: 27.0.50; Feature request: provide the opposite of
 xref-pop-marker-stack
Date: Sun, 24 Oct 2021 10:54:04 +0300
> - Regarding the names of the commands, some alternatives:
>
> * xref-rewind-history? It's a play on "fast forward". A bit cryptic,
>   perhaps.
> * xref-go-back and xref-go-forward? xref--history is fine the name of the
>   variable, but the purpose of the commands seems obvious enough even
>   without "history" in them.

Two different naming conventions are in use already:

  Info-history-back
  Info-history-forward

  help-go-back
  help-go-forward

Choosing any of those would be fine.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38797; Package emacs. (Sun, 24 Oct 2021 12:40:02 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Juri Linkov <juri <at> linkov.net>
Cc: Mattias Engdegård <mattiase <at> acm.org>,
 yyoncho <yyoncho <at> gmail.com>, 38797 <at> debbugs.gnu.org
Subject: Re: bug#38797: 27.0.50; Feature request: provide the opposite of
 xref-pop-marker-stack
Date: Sun, 24 Oct 2021 15:39:51 +0300
On 24.10.2021 10:54, Juri Linkov wrote:
>> - Regarding the names of the commands, some alternatives:
>>
>> * xref-rewind-history? It's a play on "fast forward". A bit cryptic,
>>    perhaps.
>> * xref-go-back and xref-go-forward? xref--history is fine the name of the
>>    variable, but the purpose of the commands seems obvious enough even
>>    without "history" in them.
> Two different naming conventions are in use already:
> 
>    Info-history-back
>    Info-history-forward
> 
>    help-go-back
>    help-go-forward
> 
> Choosing any of those would be fine.

That reminds me of a potential feature: saving the history of searches 
and going back/forward between them, in the manner of help-go-back and 
help-go-forward (maybe even with same keybindings).

From that perspective, we could choose the names in advance. Either

  xref-go-back/forward and xref-history-back/forward

or, I suppose

  xref-back-history/forward-history and xref-searches-back/forward

...something like that.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38797; Package emacs. (Sun, 24 Oct 2021 13:25:02 GMT) Full text and rfc822 format available.

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

From: Mattias Engdegård <mattiase <at> acm.org>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: yyoncho <yyoncho <at> gmail.com>, 38797 <at> debbugs.gnu.org
Subject: Re: bug#38797: 27.0.50; Feature request: provide the opposite of
 xref-pop-marker-stack
Date: Sun, 24 Oct 2021 15:24:31 +0200
[Message part 1 (text/plain, inline)]
24 okt. 2021 kl. 03.40 skrev Dmitry Gutov <dgutov <at> yandex.ru>:

> - The removal of
> 
>  (defvaralias 'find-tag-marker-ring 'xref--marker-ring)
> 
> and the subsequent initialization of the aliased variable to a new ring will likely break any real code code which is still depending on that variable. Because now it is nil by default, and not a ring. Not sure what's the best solution, perhaps it's just time to remove it.

Right; I've resurrected find-tag-marker-ring as a zombie variable. Code manipulating it will have no effect but at least won't crash, which is probably a good trade-off.

>  (make-obsolete-variable 'xref-marker-ring-length nil "29.1")
> 
> is similarly pointless because the variable definition has been deleted. Declaring it obsolete does not help the fact that it is unbound now.

Correct -- resurrected as a zombie variable here too.

> * xref-go-back and xref-go-forward?

Good suggestions and now used. (I've still not added xref-go-back as an alias but that should probably be done.)

> - The slots in the docstring of xref--history (should we call it xref--location-history?) could be called (BACK-STACK . FORWARD-STACK).

Yes, done.

> - xref-set-marker-ring-length's fate is changed accordingly to what we choose to do with xref-marker-ring-length.

We could make it set the pointless xref-marker-ring-length but I didn't bother. I doubt anyone is using that function.

> - The FIXME about proposed xref--back-history-empty-p doesn't make much sense if the introduced function name is going to be private

Sorry, that wasn't the intention. I've added xref-back-history-empty-p for use in the new menu entry.
(I'll let someone else add it to the context menu because that seemed much more complicated.)

Revised patch attached.

[0001-Add-xref-forward-history-bug-38797.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38797; Package emacs. (Sun, 24 Oct 2021 19:19:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: Mattias Engdegård <mattiase <at> acm.org>,
 yyoncho <yyoncho <at> gmail.com>, 38797 <at> debbugs.gnu.org
Subject: Re: bug#38797: 27.0.50; Feature request: provide the opposite of
 xref-pop-marker-stack
Date: Sun, 24 Oct 2021 22:10:27 +0300
> That reminds me of a potential feature: saving the history of searches and
> going back/forward between them, in the manner of help-go-back and
> help-go-forward (maybe even with same keybindings).
>
> From that perspective, we could choose the names in advance. Either
>
>   xref-go-back/forward and xref-history-back/forward
>
> or, I suppose
>
>   xref-back-history/forward-history and xref-searches-back/forward
>
> ...something like that.

I never had such a problem thanks to the customization
that creates a new buffer for every search:

  (add-hook 'xref--xref-buffer-mode-hook 'rename-uniquely)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38797; Package emacs. (Sun, 24 Oct 2021 23:23:02 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Juri Linkov <juri <at> linkov.net>
Cc: Mattias Engdegård <mattiase <at> acm.org>,
 yyoncho <yyoncho <at> gmail.com>, 38797 <at> debbugs.gnu.org
Subject: Re: bug#38797: 27.0.50; Feature request: provide the opposite of
 xref-pop-marker-stack
Date: Mon, 25 Oct 2021 02:22:06 +0300
On 24.10.2021 22:10, Juri Linkov wrote:
>> That reminds me of a potential feature: saving the history of searches and
>> going back/forward between them, in the manner of help-go-back and
>> help-go-forward (maybe even with same keybindings).
>>
>>  From that perspective, we could choose the names in advance. Either
>>
>>    xref-go-back/forward and xref-history-back/forward
>>
>> or, I suppose
>>
>>    xref-back-history/forward-history and xref-searches-back/forward
>>
>> ...something like that.
> 
> I never had such a problem thanks to the customization
> that creates a new buffer for every search:
> 
>    (add-hook 'xref--xref-buffer-mode-hook 'rename-uniquely)

It's a nice intermediate solution, but it would also be nice to be able 
to quickly iterate across previous searches. No?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38797; Package emacs. (Mon, 25 Oct 2021 02:14:02 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Mattias Engdegård <mattiase <at> acm.org>
Cc: yyoncho <yyoncho <at> gmail.com>, 38797 <at> debbugs.gnu.org
Subject: Re: bug#38797: 27.0.50; Feature request: provide the opposite of
 xref-pop-marker-stack
Date: Mon, 25 Oct 2021 05:13:43 +0300
On 24.10.2021 16:24, Mattias Engdegård wrote:
> Revised patch attached.

LGTM, please install.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38797; Package emacs. (Mon, 25 Oct 2021 07:56:01 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: Mattias Engdegård <mattiase <at> acm.org>,
 yyoncho <yyoncho <at> gmail.com>, 38797 <at> debbugs.gnu.org
Subject: Re: bug#38797: 27.0.50; Feature request: provide the opposite of
 xref-pop-marker-stack
Date: Mon, 25 Oct 2021 10:44:01 +0300
>>> That reminds me of a potential feature: saving the history of searches and
>>> going back/forward between them, in the manner of help-go-back and
>>> help-go-forward (maybe even with same keybindings).
>>>
>>>  From that perspective, we could choose the names in advance. Either
>>>
>>>    xref-go-back/forward and xref-history-back/forward
>>>
>>> or, I suppose
>>>
>>>    xref-back-history/forward-history and xref-searches-back/forward
>>>
>>> ...something like that.
>> I never had such a problem thanks to the customization
>> that creates a new buffer for every search:
>>    (add-hook 'xref--xref-buffer-mode-hook 'rename-uniquely)
>
> It's a nice intermediate solution, but it would also be nice to be able to
> quickly iterate across previous searches. No?

This means adding another layer of complexity.  Remember a mess
of deciding how to switch next-error navigations from different searches?
Switching multiple xref searches will have the same level of confusion.

BTW, shouldn't xref-go-back/forward support next-error-function?  ;-)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38797; Package emacs. (Mon, 25 Oct 2021 15:19:01 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Juri Linkov <juri <at> linkov.net>
Cc: Mattias Engdegård <mattiase <at> acm.org>,
 yyoncho <yyoncho <at> gmail.com>, 38797 <at> debbugs.gnu.org
Subject: Re: bug#38797: 27.0.50; Feature request: provide the opposite of
 xref-pop-marker-stack
Date: Mon, 25 Oct 2021 18:18:09 +0300
On 25.10.2021 10:44, Juri Linkov wrote:

>> It's a nice intermediate solution, but it would also be nice to be able to
>> quickly iterate across previous searches. No?
> 
> This means adding another layer of complexity.  Remember a mess
> of deciding how to switch next-error navigations from different searches?
> Switching multiple xref searches will have the same level of confusion.

Unless we do want to be able to switch next-error navigation sources 
this way?

Alternatively, we could uniquify the Xref buffers in a more predictable 
way (e.g. by using the caller command and the input string, somehow), 
and then have commands xref-searches-back and xref-searches-format 
switch between the resulting buffers.

> BTW, shouldn't xref-go-back/forward support next-error-function?  ;-)

What kind of support? Not sure I understand, sorry.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38797; Package emacs. (Mon, 25 Oct 2021 15:51:01 GMT) Full text and rfc822 format available.

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

From: Mattias Engdegård <mattiase <at> acm.org>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: Juri Linkov <juri <at> linkov.net>, yyoncho <yyoncho <at> gmail.com>,
 38797 <at> debbugs.gnu.org
Subject: Re: bug#38797: 27.0.50; Feature request: provide the opposite of
 xref-pop-marker-stack
Date: Mon, 25 Oct 2021 17:49:52 +0200
25 okt. 2021 kl. 04.13 skrev Dmitry Gutov <dgutov <at> yandex.ru>:

> LGTM, please install.

Thank you Dmitry, now pushed to master.

Juri, would you help out with adding (or not) `xref-go-forward` to the context menu? I wasn't sure if we had agreed on good names for this and the go-back entries. The current "Back Definition" is a bit nonsensical in English.

I favour (lightly) "Go Back" / "Go Forward" because they make sense in context with the other Xref operations in that separator-delimited group of entries in the menu, and because it's a wording often used for these operations elsewhere such as in web browsers and IDEs (though often it's just "Back" and "Forward").

"Xref {Back,Forward}" or "{Back,Forward} Xref" would also do and displays the link to Xref up front, but the English is decidedly less natural.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38797; Package emacs. (Mon, 25 Oct 2021 17:09:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Mattias Engdegård <mattiase <at> acm.org>
Cc: 38797 <at> debbugs.gnu.org, yyoncho <yyoncho <at> gmail.com>,
 Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#38797: 27.0.50; Feature request: provide the opposite of
 xref-pop-marker-stack
Date: Mon, 25 Oct 2021 20:05:33 +0300
>> LGTM, please install.
>
> Thank you Dmitry, now pushed to master.

I took a look at your change, and noticed an asymmetry
between the names xref-pop-marker-stack and xref-go-forward.
Shouldn't the name xref-pop-marker-stack be obsoleted,
and replaced with a new name xref-go-back?  (I see now
that you added FIXME for this.)

Another question is that in the menu bar currently the order is
"Forward" and "Back".  But more natural order would be
"Back" and "Forward".

> Juri, would you help out with adding (or not) `xref-go-forward` to the
> context menu? I wasn't sure if we had agreed on good names for this and the
> go-back entries. The current "Back Definition" is a bit nonsensical in
> English.

I completely agree that the current title is inappropriate.

> I favour (lightly) "Go Back" / "Go Forward" because they make sense in
> context with the other Xref operations in that separator-delimited group of
> entries in the menu, and because it's a wording often used for these
> operations elsewhere such as in web browsers and IDEs (though often it's
> just "Back" and "Forward").
>
> "Xref {Back,Forward}" or "{Back,Forward} Xref" would also do and displays
> the link to Xref up front, but the English is decidedly less natural.

With such a test case:

0. emacs -Q
1. click mouse-3 on any word in *scratch*, and select from the context menu
   "Find Definition".  It should fail with the error
   "No definitions found for: This".  This is correct.
2. now click mouse-3 at the end of *scratch*, not on a word.

The menu contains the item "Back Definition".  (BTW, why if the search failed?)

This menu item is too ambiguous.  Renaming it to "Go Back" or "Go Forward"
doesn't make the menu item clearer.  Only adding a word "Xref" somewhere
will disambiguate it.  Maybe then "Go Back in Xref" or "Go Back with Xref"?
We need more opinions.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38797; Package emacs. (Mon, 25 Oct 2021 17:09:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: Mattias Engdegård <mattiase <at> acm.org>,
 yyoncho <yyoncho <at> gmail.com>, 38797 <at> debbugs.gnu.org
Subject: Re: bug#38797: 27.0.50; Feature request: provide the opposite of
 xref-pop-marker-stack
Date: Mon, 25 Oct 2021 20:07:52 +0300
>>> It's a nice intermediate solution, but it would also be nice to be able to
>>> quickly iterate across previous searches. No?
>> This means adding another layer of complexity.  Remember a mess
>> of deciding how to switch next-error navigations from different searches?
>> Switching multiple xref searches will have the same level of confusion.
>
> Unless we do want to be able to switch next-error navigation sources this
> way?

Maybe.

> Alternatively, we could uniquify the Xref buffers in a more predictable way
> (e.g. by using the caller command and the input string, somehow), and then
> have commands xref-searches-back and xref-searches-format switch between
> the resulting buffers.
>
>> BTW, shouldn't xref-go-back/forward support next-error-function?  ;-)
>
> What kind of support? Not sure I understand, sorry.

Using unique Xref buffers will allow switching to a unique
Xref buffer and typing 'M-x next-error-select-buffer'.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38797; Package emacs. (Mon, 25 Oct 2021 18:55:02 GMT) Full text and rfc822 format available.

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

From: Mattias Engdegård <mattiase <at> acm.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 38797 <at> debbugs.gnu.org, yyoncho <yyoncho <at> gmail.com>,
 Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#38797: 27.0.50; Feature request: provide the opposite of
 xref-pop-marker-stack
Date: Mon, 25 Oct 2021 20:53:59 +0200
25 okt. 2021 kl. 19.05 skrev Juri Linkov <juri <at> linkov.net>:

> I took a look at your change, and noticed an asymmetry
> between the names xref-pop-marker-stack and xref-go-forward.
> Shouldn't the name xref-pop-marker-stack be obsoleted,
> and replaced with a new name xref-go-back?

Yes, this was the intention. I have now done that; thanks for reminding me!

> Another question is that in the menu bar currently the order is
> "Forward" and "Back".  But more natural order would be
> "Back" and "Forward".

Oh, I didn't realise they had to be given in reverse order. Fixed, thank you.

> The menu contains the item "Back Definition".  (BTW, why if the search failed?)

That appears to be a known imperfection in Xref -- I agree it shouldn't be added if the search failed.

> This menu item is too ambiguous.  Renaming it to "Go Back" or "Go Forward"
> doesn't make the menu item clearer.  Only adding a word "Xref" somewhere
> will disambiguate it.  Maybe then "Go Back in Xref" or "Go Back with Xref"?

Maybe, but if we embrace the idea that there really only should be a single back button in the application (which is what other IDEs typically have), then there is no ambiguity. Until then we may need to add "Xref" somehow, but where is the confusion, exactly?

> We need more opinions.

Only if they are well-reasoned!






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38797; Package emacs. (Mon, 25 Oct 2021 19:39:01 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Juri Linkov <juri <at> linkov.net>, Mattias Engdegård
 <mattiase <at> acm.org>
Cc: yyoncho <yyoncho <at> gmail.com>, 38797 <at> debbugs.gnu.org
Subject: Re: bug#38797: 27.0.50; Feature request: provide the opposite of
 xref-pop-marker-stack
Date: Mon, 25 Oct 2021 22:38:20 +0300
On 25.10.2021 20:05, Juri Linkov wrote:

>> I favour (lightly) "Go Back" / "Go Forward" because they make sense in
>> context with the other Xref operations in that separator-delimited group of
>> entries in the menu, and because it's a wording often used for these
>> operations elsewhere such as in web browsers and IDEs (though often it's
>> just "Back" and "Forward").
>>
>> "Xref {Back,Forward}" or "{Back,Forward} Xref" would also do and displays
>> the link to Xref up front, but the English is decidedly less natural.
> 
> With such a test case:
> 
> 0. emacs -Q

Seems like step 0.5 is missing: enable context-menu-mode.

> 1. click mouse-3 on any word in *scratch*, and select from the context menu
>     "Find Definition".  It should fail with the error
>     "No definitions found for: This".  This is correct.
> 2. now click mouse-3 at the end of *scratch*, not on a word.
> 
> The menu contains the item "Back Definition".  (BTW, why if the search failed?)
> 
> This menu item is too ambiguous.  Renaming it to "Go Back" or "Go Forward"
> doesn't make the menu item clearer.  Only adding a word "Xref" somewhere
> will disambiguate it.  Maybe then "Go Back in Xref" or "Go Back with Xref"?
> We need more opinions.

Go Back and Go Forward look okay to me.

Not sure whether adding "Xref " would be an improvement: the Xref 
locations stack is an intended replacement for find-tag-marker-ring, 
which is supposedly used by all kinds of code.

So the location to which we "Go Back" might as well have been tagged by 
a command which otherwise has to relation to Xref




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38797; Package emacs. (Mon, 25 Oct 2021 21:30:02 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Mattias Engdegård <mattiase <at> acm.org>
Cc: Juri Linkov <juri <at> linkov.net>, 38797 <at> debbugs.gnu.org,
 yyoncho <yyoncho <at> gmail.com>, Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#38797: 27.0.50;
 Feature request: provide the opposite of xref-pop-marker-stack
Date: Mon, 25 Oct 2021 17:29:01 -0400
Causes xref-elisp-test-find-defs-defvar-el to fail; ref eg
https://hydra.nixos.org/build/156713513




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38797; Package emacs. (Tue, 26 Oct 2021 08:07:02 GMT) Full text and rfc822 format available.

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

From: Mattias Engdegård <mattiase <at> acm.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Juri Linkov <juri <at> linkov.net>, 38797 <at> debbugs.gnu.org,
 yyoncho <yyoncho <at> gmail.com>, Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#38797: 27.0.50; Feature request: provide the opposite of
 xref-pop-marker-stack
Date: Tue, 26 Oct 2021 10:06:43 +0200
25 okt. 2021 kl. 23.29 skrev Glenn Morris <rgm <at> gnu.org>:

> Causes xref-elisp-test-find-defs-defvar-el to fail

Fixed, thank you!





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38797; Package emacs. (Mon, 08 Nov 2021 18:29:01 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Mattias Engdegård <mattiase <at> acm.org>
Cc: 38797 <at> debbugs.gnu.org, yyoncho <yyoncho <at> gmail.com>,
 Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#38797: 27.0.50; Feature request: provide the opposite of
 xref-pop-marker-stack
Date: Mon, 08 Nov 2021 20:23:06 +0200
[Message part 1 (text/plain, inline)]
> I favour (lightly) "Go Back" / "Go Forward" because they make sense in
> context with the other Xref operations in that separator-delimited group of
> entries in the menu, and because it's a wording often used for these
> operations elsewhere such as in web browsers and IDEs (though often it's
> just "Back" and "Forward").

There are more votes for "Go Back" / "Go Forward", so I'll push
two patches - one for emacs-28 (not to be merged to master), and
another for master:

[go-back-emacs-28.patch (text/x-diff, inline)]
diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el
index 3e1a915e32..4997c2746f 100644
--- a/lisp/progmodes/prog-mode.el
+++ b/lisp/progmodes/prog-mode.el
@@ -51,7 +51,7 @@ prog-context-menu
 
   (unless (xref-marker-stack-empty-p)
     (define-key-after menu [xref-pop]
-      '(menu-item "Back Definition" xref-pop-marker-stack
+      '(menu-item "Go Back" xref-pop-marker-stack
                   :help "Back to the position of the last search")
       'prog-separator))
 
[go-back-master.patch (text/x-diff, inline)]
diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el
index db350a5f70..30b6edf0d9 100644
--- a/lisp/progmodes/prog-mode.el
+++ b/lisp/progmodes/prog-mode.el
@@ -49,9 +49,15 @@ prog-context-menu
   (define-key-after menu [prog-separator] menu-bar-separator
     'middle-separator)
 
+  (unless (xref-forward-history-empty-p)
+    (define-key-after menu [xref-forward]
+      '(menu-item "Go Forward" xref-go-forward
+                  :help "Forward to the position gone Back from")
+      'prog-separator))
+
   (unless (xref-marker-stack-empty-p)
     (define-key-after menu [xref-pop]
-      '(menu-item "Back Definition" xref-go-back
+      '(menu-item "Go Back" xref-go-back
                   :help "Back to the position of the last search")
       'prog-separator))
 

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38797; Package emacs. (Tue, 09 Nov 2021 08:31:01 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Mattias Engdegård <mattiase <at> acm.org>
Cc: 38797 <at> debbugs.gnu.org, yyoncho <yyoncho <at> gmail.com>,
 Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#38797: 27.0.50; Feature request: provide the opposite of
 xref-pop-marker-stack
Date: Tue, 09 Nov 2021 10:30:23 +0200
>> I favour (lightly) "Go Back" / "Go Forward" because they make sense in
>> context with the other Xref operations in that separator-delimited group of
>> entries in the menu, and because it's a wording often used for these
>> operations elsewhere such as in web browsers and IDEs (though often it's
>> just "Back" and "Forward").
>
> There are more votes for "Go Back" / "Go Forward", so I'll push
> two patches - one for emacs-28 (not to be merged to master), and
> another for master:

Now pushed both.  Is this feature request is ready for closing?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38797; Package emacs. (Tue, 09 Nov 2021 13:09:01 GMT) Full text and rfc822 format available.

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

From: Mattias Engdegård <mattiase <at> acm.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 38797 <at> debbugs.gnu.org, yyoncho <yyoncho <at> gmail.com>,
 Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#38797: 27.0.50; Feature request: provide the opposite of
 xref-pop-marker-stack
Date: Tue, 9 Nov 2021 14:08:37 +0100
9 nov. 2021 kl. 09.30 skrev Juri Linkov <juri <at> linkov.net>:

> Now pushed both.  Is this feature request is ready for closing?

Thank you and yes, as far as I'm concerned. An unbounded number of improvements that can be made but we don't need to keep the bug open for that, do we?






Reply sent to Dmitry Gutov <dgutov <at> yandex.ru>:
You have taken responsibility. (Tue, 09 Nov 2021 13:11:02 GMT) Full text and rfc822 format available.

Notification sent to yyoncho <yyoncho <at> gmail.com>:
bug acknowledged by developer. (Tue, 09 Nov 2021 13:11:02 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Mattias Engdegård <mattiase <at> acm.org>,
 Juri Linkov <juri <at> linkov.net>
Cc: 38797-done <at> debbugs.gnu.org, yyoncho <yyoncho <at> gmail.com>
Subject: Re: bug#38797: 27.0.50; Feature request: provide the opposite of
 xref-pop-marker-stack
Date: Tue, 9 Nov 2021 16:09:44 +0300
On 09.11.2021 16:08, Mattias Engdegård wrote:
> 9 nov. 2021 kl. 09.30 skrev Juri Linkov<juri <at> linkov.net>:
> 
>> Now pushed both.  Is this feature request is ready for closing?
> Thank you and yes, as far as I'm concerned. An unbounded number of improvements that can be made but we don't need to keep the bug open for that, do we?
> 
> 

Looks good to me as well. Thank you both.

Closing the bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 08 Dec 2021 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 187 days ago.

Previous Next


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