No applicable method + wrong type argument
xecho3 opened this issue · 9 comments
Hello, I am very interested in using dumb-jump, but cannot get it to work on my Emacs 26.3 (emacsforosx.com)
I installed using `package-install' and placed the basic configuration s-exp in my emacs config with no other modifications:
(add-hook 'xref-backend-functions #'dumb-jump-xref-activate)
In emacs-lisp buffers, I get the standard xref prompt "Find definitions of: ", and this works normally.
In other modes (tested with text-mode, lisp-mode scheme, lua, python), I get an error displayed in the minibuffer: "No applicable method: xref-backend-identifier-completion-table, dumb-jump"
In addition, when there is no text at the point and xref is invoked, I get the error: "Wrong type argument: number-or-marker-p, nil" (this only happens when the dumb-jump setup is initialized, and goes away if I run (remove-hook 'xref-backend-functions #'dumb-jump-xref-activate))
I have no other xref related modifications or packages in my emacs config, and I'm using the default keybinds and function call `xref-find-definitions'.
Any thoughts? Thanks in advance.
I believe this problem is fixed with the PR #374, which has not been merged yet.
It seems so yes, but that only addresses the secondary problem I mentioned (thanks for linking, didn't see that pull request). The main problem that I am having is, as mentioned: "No applicable method: xref-backend-identifier-completion-table, dumb-jump" with a vanilla setup as described in the main repo page / readme.md
I'm not sure if the macOS Emacs is different, but a regular M-. works for me. I can reproduce your error message, if the point is not currently on a symbol or if I press C-u M-..
The way to fix it is to simply implement the method, which was already suggested in #374.
I should clarify, since I mentioned two errors: "Wrong type argument [...]" and "No applicable method [...]". These two occur in different use instances, and the first one is addressed by #374. The second one is the main problem I'm having, that I don't believe is fixed by #374.
In particular, the main error occurs when I am not in an emacs-lisp-mode buffer and press M-.
over a symbol. For instance, if I have the line local maxOutput = max(spec)
in lua-mode, and press M-.
with the cursor after "max" (i.e. "max|Output" where "|" is the cursor), I get the minibuffer error: "No applicable method: xref-backend-identifier-completion-table, dumb-jump"
If I run toggle-debug-on-error and repeat this same process, I get the full output:
Debugger entered--Lisp error: (cl-no-applicable-method xref-backend-identifier-completion-table dumb-jump)
signal(cl-no-applicable-method (xref-backend-identifier-completion-table dumb-jump))
cl-no-applicable-method(#s(cl--generic :name xref-backend-identifier-completion-table :dispatches ((0 #s(cl--generic-generalizer :name cl--generic-eql-generalizer :priority 100 :tagcode-function #f(compiled-function (name &rest _) #<bytecode 0x400d086d>) :specializers-function #f(compiled-function (tag &rest _) #<bytecode 0x400d088d>)) #s(cl--generic-generalizer :name cl--generic-t-generalizer :priority 0 :tagcode-function #f(compiled-function (name &rest _) #<bytecode 0x400cf905>) :specializers-function #f(compiled-function (tag &rest _) #<bytecode 0x400cf919>)))) :method-table (#s(cl--generic-method :specializers ((eql etags)) :qualifiers nil :uses-cnm nil :function #f(compiled-function (backend) #<bytecode 0x4182c11d>)) #s(cl--generic-method :specializers ((eql elisp)) :qualifiers nil :uses-cnm nil :function #f(compiled-function (backend) #<bytecode 0x40c4f5f3>))) :options nil) dumb-jump)
apply(cl-no-applicable-method #s(cl--generic :name xref-backend-identifier-completion-table :dispatches ((0 #s(cl--generic-generalizer :name cl--generic-eql-generalizer :priority 100 :tagcode-function #f(compiled-function (name &rest _) #<bytecode 0x400d086d>) :specializers-function #f(compiled-function (tag &rest _) #<bytecode 0x400d088d>)) #s(cl--generic-generalizer :name cl--generic-t-generalizer :priority 0 :tagcode-function #f(compiled-function (name &rest _) #<bytecode 0x400cf905>) :specializers-function #f(compiled-function (tag &rest _) #<bytecode 0x400cf919>)))) :method-table (#s(cl--generic-method :specializers ((eql etags)) :qualifiers nil :uses-cnm nil :function #f(compiled-function (backend) #<bytecode 0x4182c11d>)) #s(cl--generic-method :specializers ((eql elisp)) :qualifiers nil :uses-cnm nil :function #f(compiled-function (backend) #<bytecode 0x40c4f5f3>))) :options nil) dumb-jump)
#f(compiled-function (&rest args) #<bytecode 0x4be962e5>)(dumb-jump)
apply(#f(compiled-function (&rest args) #<bytecode 0x4be962e5>) dumb-jump nil)
xref-backend-identifier-completion-table(dumb-jump)
xref--read-identifier("Find definitions of: ")
byte-code("\300\301!C\207" [xref--read-identifier "Find definitions of: "] 2)
call-interactively(xref-find-definitions nil nil)
command-execute(xref-find-definitions)
In particular, the main error occurs when I am not in an emacs-lisp-mode buffer and press M-. over a symbol. For instance, if I have the line local maxOutput = max(spec) in lua-mode, and press M-. with the cursor after "max" (i.e. "max|Output" where "|" is the cursor), I get the minibuffer error: "No applicable method: xref-backend-identifier-completion-table, dumb-jump"
But in that care, your cursor is not on a symbol, but over the "(", right? #374 should solve both, because it avoids arithmetic using a nil object, and implements an empty xref-backend-identifier-completion-table
, because we currently don't have a better implementation.
Cursor after "max" (i.e. "max|Output" where "|" is the cursor).
That is to say, right in the middle of a symbol, I get the error I described, regardless of which symbol I try to look up.
Oh, sorry, I thought you were talking about the max(spec)
. But I still think that implementing xref-backend-identifier-completion-table
should fix it. Could you try evaluating
(cl-defmethod xref-backend-identifier-completion-table ((_backend (eql dumb-jump)))
nil))
and try again?
Ah, that did work! Thanks for the help!