jacktasia / dumb-jump

an Emacs "jump to definition" package for 50+ languages
GNU General Public License v3.0
1.57k stars 150 forks source link

‘dumb-jump-go’ is an obsolete command (as of 2020-06-26) #365

Open avatar-lavventura opened 4 years ago

avatar-lavventura commented 4 years ago

I was using dumb-jump (https://github.com/jacktasia/dumb-jump) but suddenly it stops working.

I am getting following error:

‘dumb-jump-go’ is an obsolete command (as of 2020-06-26); 
‘dumb-jump-go’ has been obsoleted by the xref interface.

’function’ python  declaration not found.

My setup:

(add-hook 'xref-backend-functions #'dumb-jump-xref-activate)
(global-set-key "\C-x\C-o" 'dumb-jump-go-prefer-external-other-window);
(global-set-key "\C-x\C-k" 'xref-pop-marker-stack);
(global-set-key "\C-x\C-j" 'dumb-jump-go);
(global-set-key "\C-x\C-k" 'dumb-jump-back);
jacktasia commented 4 years ago

It should still be working even if it has been marked as obsolete. The real error here is ’function’ python declaration not found. which just means it could not find any results for whatever you were searching for.

def function():
    pass

function() # <-jumping from here worked for me.
avatar-lavventura commented 4 years ago

@jacktasia it also prevents me to use ‘dumb-jump-back’ and automatically function converted into ‘xref-pop-marker-stack’.

‘dumb-jump-back’ is an obsolete command (as of 2020-06-26); 
‘dumb-jump-back’ has been obsoleted by ‘xref-pop-marker-stack’.

=> For the same function elpy-goto-definition works not sure what's wrong

phikal commented 4 years ago

What do you mean by "prevents"? Does it not jump back? Currently dumb-jump-back is not much more than a wrapper around pop-tag-mark, that in turn is just an alias for xref-pop-marker-stack, which is already bound to M-.. What happens when you press that key?

@jacktasia It might make sense to point that out in the deprecation string.

avatar-lavventura commented 4 years ago

I can jump back using ‘dumb-jump-back’ that is aliased to ‘xref-pop-marker-stack’ and pop-tag-mark works too (as I understand).

But I cannot use ‘dumb-jump-go’ but when I try elpy-goto-definition , which works. So maybe if elpy-mode is on ‘dumb-jump-go’ could be aliased to elpy-goto-definition.

jacktasia commented 4 years ago

@avatar-lavventura Seems like something else is going on here. Can you try turning on debugging and sharing the results from the *Messages* buffer here?

kshartman commented 3 years ago

Its also breaking my edit flow. I will just fork it and remove the offending code. I don't want the xref interface. You should have an option to turn off the warnings and just do what it used to. Why should I be a labrat?

"NOTE: The xref API is still experimental and can change in major, backward-incompatible ways. Everyone is encouraged to try it, and report to us any problems or use cases we hadn't anticipated, by sending an email to emacs-devel, or `M-x report-emacs-bug'."

[EDIT] NVM I see you added the option to control obsolete. TYVM.

phikal commented 3 years ago

Yes, we added an user option (dumb-jump-disable-obsolete-warnings for anyone reading this thread in the future) to silence the legacy warnings. May I ask where you tried to find out how to silence the warnings? Would it have helped if the README mentioned it?

Also, on the Xref interface, the comment you cite was added over 5 years ago, and is negligible for all practical purposes. The interface is used far too widely at this point for any major changes to be made of a whim. I might check with emacs-devel to see if that note could get removed.

kshartman commented 3 years ago

Guilty. I didn't read the doc. My first response is to grab the code and change it when I don't like it. That is way I have always treated emacs since 1985. The whole point is if you don't like it you can change it. That is when I saw the variable. And I still don't like xref. I was forced to try it today because of the obsolete warning. This code is way better for my workflow. I really, really like it and i have it tuned for the work I primarily do now. Sorry for the excess verbiage. I should have read more before commenting. Thanks for doing this code.

[EDIT] I will tell you why I despise the xref interface. Because it creates a buffer instead of a popup menu. I tried

(add-hook 'xref-backend-functions #'dumb-jump-xref-activate)

in the language hooks but it doesn't stop this behavior. So I do this now (for example).

image

Which restores my beloved pop-up menu (if there is more than one choice) and most of the time goes right to it. The add-hook for xref-backend-functions likely does nothing since I am nuking the xref keybindings anyway. If xref did the same popup menu that dumb-jump does I could use it.

Looking at the code for xref it does look like you can set xref-show-definitions-function tp something other than xref--show-defs-buffer. I will investigate.

phikal commented 3 years ago

My first response is to grab the code and change it when I don't like it

I can certainly relate to that.

I will tell you why I despise the xref interface. Because it creates a buffer instead of a popup menu.

As you've said, Xref can be modified to use a different UI. There is a posframe based approach that used a child window to generate a popup (which is cleaner but more experimental than the classical popup approach that uses overlays AFAIK).

There was some discussion around this topic on the mailing list a few months ago: https://lists.gnu.org/archive/html/emacs-devel/2021-01/msg00263.html, in case you are interested.

dgutov commented 3 years ago

@kshartman

Try this:

(setq xref-show-definitions-function #'xref-show-definitions-completing-read)

If you have any third-party completion framework enabled like Ivy or Helm, their UI should be used automatically.

twmr commented 3 years ago

Thx a lot for this information @dgutov. I've been looking for this config since I switched to the xref interface in dumb-jump. I think this should be mentioned in the README.

phikal commented 3 years ago

The only issue I see is that xref-show-definitions-completing-read hasn't been release yet, either as a core package or on ELPA.

dgutov commented 3 years ago

@phikal It's in release 1.1.0 now. :wink:

avatar-lavventura commented 3 years ago

@dgutov Should I close the issue? I assume its solved.

phikal commented 3 years ago

In some sense, the issue was already solved by #381, but your problem might have been something else, as implied in https://github.com/jacktasia/dumb-jump/issues/365#issuecomment-686597233.

digaoddc commented 1 year ago

I configured a command with alt+g+j using xref to avoid this issue.

;; Configure go to definition command with alt+g+j
(use-package xref
:bind ("M-g j" . xref-find-definitions)
:config (setq xref 'helm)
:ensure)
phikal commented 1 year ago

Rodrigo Coutinho @.***> writes:

I configured a command with CTRL+G+J using xref to avoid this issue.

;; Configure go to definition command with alt+g+j
(use-package xref
:bind ("M-g j" . xref-find-definitions)
:config (setq xref 'helm)
:ensure)

I am confused how this is supposed to help. Isn't xref-find-definitions' already bound to "M-."? Also, what variable is xref'?

d99kris commented 1 year ago

I was also facing that error message and an issue of dumb-jump not working on macOS. What solved the problem for me was a blog post suggestion to add this to emacs config:

(setq dumb-jump-force-searcher 'rg)