Open wanghaiqiangk opened 1 year ago
Using your config in $ emacs -Q
, I can't reproduce the problem. I'm on Arch Linux and Emacs 28.2.
I also have this issue. And find it can be solved by:
modified citre.el
@@ -422,7 +422,7 @@ The returned value is a valid return value for
"The Citre backend for xref."
'citre)
-(cl-defmethod xref-backend-identifier-at-point ((_backend (eql 'citre)))
+(cl-defmethod xref-backend-identifier-at-point ((_backend (eql citre)))
"Define method for xref to get symbol at point."
(when-let ((symbol (symbol-at-point)))
;; The symbol name doesn't matter for us. We record the buffer in the text
@@ -432,7 +432,7 @@ The returned value is a valid return value for
'xref-symbol-buffer (current-buffer))))
(cl-defmethod xref-backend-identifier-completion-table
- ((_backend (eql 'citre)))
+ ((_backend (eql citre)))
"Return a function for xref to find all completions of a prefix."
(lambda (str pred action)
;; We need this since Xref calls this function in minibuffer.
@@ -441,7 +441,7 @@ The returned value is a valid return value for
(citre-get-backend-and-id-list))))
(complete-with-action action (cdr result) str pred))))
-(cl-defmethod xref-backend-definitions ((_backend (eql 'citre)) symbol)
+(cl-defmethod xref-backend-definitions ((_backend (eql citre)) symbol)
"Method for xref to find definitions of SYMBOL."
(if-let ((buf (citre-get-property 'xref-symbol-buffer symbol)))
;; If true, the symbol is grabbed from a buffer, not identifier
@@ -451,7 +451,7 @@ The returned value is a valid return value for
(let ((defs (citre-get-definitions-of-id symbol)))
(citre-xref--make-collection defs))))
-(cl-defmethod xref-backend-references ((_backend (eql 'citre)) symbol)
+(cl-defmethod xref-backend-references ((_backend (eql citre)) symbol)
"Method for xref to find references of SYMBOL."
(if-let ((buf (citre-get-property 'xref-symbol-buffer symbol)))
(with-current-buffer buf
I don't know why sometime (eql 'citre)
also works.
I don't know why sometime
(eql 'citre)
also works.
This may be a wrong behavior in Emacs 27, see https://emacs-china.org/t/topic/6620/7. Are you using Emacs 27?
I was following the elisp xref backend when implementing citre xref backend. See xref-backend-definitions
in elisp-mode.el
:
(cl-defmethod xref-backend-definitions ((_backend (eql 'elisp)) identifier) ...
Does it look different in Emacs 27?
When invoking
xref-find-definitions
which is bound toM-.
at a symbol, the echo area saysno applicable method: xref-backend-definitions, citre, <symbol-name-here>
.This happens after I updated citre from a relative old release to the latest version.
The backtrace after enabling
debug-on-entry
is shown below:Besides, the
xref-backend-functions
variable has the value of(citre-xref-backend t)
. Manual calls tocitre-jump
work fine.Any idea what's the problem here?
Citre config
Update Found that it's the 84bf573 refactor: pluggable backend design caused the problem.