reddit / emacs

`xref-go-back` doesn't go to the first invocation position.

pr09eek · 2022-12-11 14:53
I'm using eglot which uses the built-in function `xref-find-definition` for find definition functionality. When I have to jump back to the previous position I can use `xref-go-back` but when I use it for the first time it doesn't record the first position where `xref-find-definition` was used and I have to use `pop-global-mark`. Am I using it wrong or is there any bug that I am unaware of?
eli-zaretskii · 2022-12-11 18:13
What is `xref-go-back`? I see no such function in Emacs.
pr09eek · 2022-12-11 18:32
I'm using emacs 28.1 I think in previous versions of emacs it was `xref-pop-marker-stack`
a_kurth · 2022-12-11 18:37
emacs 28.2 help: >xref-go-back is an interactive native-compiled Lisp function in ‘xref.el’. It is bound to M-,. Go back to the previous position in xref history. To undo, use C-M-,.
eli-zaretskii · 2022-12-12 15:49
I think this is Emacs 29, because there was no `xref-go-back` in Emacs 28. Or maybe you are using an updated `xref` from ELPA, not the one that shipped with Emacs 28.
eli-zaretskii · 2022-12-12 15:49
If this is what you see with `M-,`, report a bug with all the details, preferably with a recipe starting from `emacs -Q`. It works for me, FWIW.
pr09eek · 2022-12-12 15:58
It works, but when I use `M-,` for the first time it says `At the start of xref history`
eli-zaretskii · 2022-12-13 16:49
Which means you didn't yet use `M-.`, and the stack of saved positions is empty.
pr09eek · 2022-12-13 17:40
That's what the bug is - the first time I use `M-.` emacs doesn't save the position.
eli-zaretskii · 2022-12-14 13:21
Then please report this as a bug with the recipe to reproduce it. It "works for me".