Closed jiacai2050 closed 3 years ago
If you think this is necessary, I can give citre-mode
a map, but I think I wouldn't put any keybinding in it. You'll have to customize it yourself.
The point is, citre-mode
is for capf/xref/imenu integration, and citre-peek/jump
is separate from citre-mode
. You don't have to enable citre-mode
to use them. So conceptually they shouldn't appear in citre-mode-map
.
If all you want is "If there's a tags file, use citre-jump
, otherwise use xref", you can try citre-jump+
command in the wiki.
So, what's your choice?
Hi,I try citre-jump+
, it works fine, but have one issue for jump elisp functions, it will prompt symbols of all elisp functions instead of go to definition of current symbol, do you have any ideas to fix this?
This didn't happen to me. Does it happen in vanilla Emacs? I suspect your configuration causes this problem.
I can reproduce this with emacs -Q
, which emacs version are you using? mine is
Ah, yes, you are right.
Try this:
(call-interactively #'xref-find-definitions)|xref-push-marker-stack
|
is the cursor. Call eval-last-sexp
(C-x C-e
) here, and it behaves like you described. But directly type M-x xref-find-definitions
on the symbol doesn't.
I think it has something to do with the "interactive spec", but I've never managed to understand it. Do you have any idea?
(defun citre-jump+ ()
(interactive)
(condition-case _
(citre-jump)
(error (let* ((xref-prompt-for-identifier nil))
(call-interactively #'xref-find-definitions)))))
After dig into this, I find when xref-prompt-for-identifier is nil, prompt will be gone. Although root cause is still unclear, but it works.
I think about this issue again, it makes no harm to provide a (empty) keymap, and users can customize what they like. Please think again whether provide it or not.
I find when xref-prompt-for-identifier is nil, prompt will be gone.
Thanks! This is good enough.
it makes no harm to provide a (empty) keymap, and users can customize what they like.
Yes. I'll do it.
I've put your citre-peek+
in the wiki, and added a citre-mode-map
.
Currently, I hack
minor-mode-map-alist
to do this, it would be great if this package provide it out of box.