Dumb-jump not passing control to next item in xref-backend-functions
karthink opened this issue · 2 comments
I have my xref-backend-functions
set up as follows:
(dumb-jump-xref-activate buffer-local-xref-activate)
Where buffer-local-xref-activate
is a backend I wrote that simply finds the first occurrence in the current buffer of the symbol at point. (It's an even-dumber-jump.)
When I call xref-find-definitions
on a symbol, I get "No definitions found for: mySymbol". However when I swap the order and set xref-backend-functions
to
(buffer-local-xref-activate dumb-jump-xref-activate)
It correctly moves to the first occurrence of mySymbol in the buffer. This leads me to believe that dumb-jump
is not failing gracefully, i.e. not returning nil
so that the next function in xref-backend-functions
can be run. I tried to verify the return value using edebug but it doesn't work as dumb-jump's searching code is wrapped in a cl-defmethod
instead of a defun
.
EDIT: I have verified using edebug that when dumb-jump-xref-activate
is placed first in xref-backend-functions
and dumb-jump fails to find any results, the next backend function is never called.
Aside: The reason dumb-jump is failing in the first place is because the symbol I'm searching for is the name of an org-babel code block in an org-mode buffer, which dumb-jump does not support (best I can tell).
The condition for Dumb Jump's Xref backend to be used isn't that it will find a symbol, but that it could find one: https://github.com/jacktasia/dumb-jump/blob/master/dumb-jump.el#L3078
This is a limitation of Xref, at least for now, that it stop searching after it has found one backend, even if it returns no results. This has been discussed on the mailing list before, and the best idea that I played with it to write a backend that combines two existing backends into one.