anoma / juvix-mode

The Juvix Emacs mode
https://github.com/anoma/juvix
GNU General Public License v3.0
1 stars 1 forks source link

juvix-mode Jump back errors #2

Closed mariari closed 3 weeks ago

mariari commented 2 years ago

It seems if I jump to a definition with Meta point, then you can't jump back, it gives me the message at the start of xref history. I think this may be an issue with the minijuvix-mode itself (currently I'm not having this issue with this in other modes).

janmasrovira commented 2 years ago

What function do you use to jump back? What function do you have bound to Meta point?

mariari commented 2 years ago

jump back or M-, is xref-go-back.

Meta Point, is the default jump to definition, which in this case isminijuvix-goto-definition. Though it seems other languages use a variety of techniques.

In the CL mode I have I see.

(xref-push-marker-stack)

in it.

(defun lispy-goto-symbol (symbol)
  "Go to definition of SYMBOL.
SYMBOL is a string."
  (interactive (list (or (thing-at-point 'symbol t)
                         (lispy--current-function))))
  (lispy--remember)
  (deactivate-mark)
  (xref-push-marker-stack)
  ...)

In Haskell and OCaml I see the following being called

(defun xref-find-definitions (identifier)
  "Find the definition of the identifier at point.
With prefix argument or when there's no identifier at point,
prompt for it.

If sufficient information is available to determine a unique
definition for IDENTIFIER, display it in the selected window.
Otherwise, display the list of the possible definitions in a
buffer where the user can select from the list.

Use \\[xref-go-back] to return back to where you invoked this command."
  (interactive (list (xref--read-identifier "Find definitions of: ")))
  (xref--find-definitions identifier nil))

Probably (xref-push-marker-stack) might be the simplest to implement

janmasrovira commented 3 weeks ago

Fixed by #18