-
Notifications
You must be signed in to change notification settings - Fork 27
Useful commands
colawithsauce edited this page Jan 19, 2024
·
5 revisions
- Emacs has built-in xref support for Elisp,
- You may not want to use tags file for Elisp.
Below is a command that tries citre-jump
first, and when fail, falllback to xref. This is great for similar situations.
(defun citre-jump+ ()
(interactive)
(condition-case _
(citre-jump)
(error (let* ((xref-prompt-for-identifier nil))
(call-interactively #'xref-find-definitions)))))
For those who are using Citre
with other tools (imenu, grep...):
(defun my--push-point-to-xref-marker-stack (&rest r)
(xref-push-marker-stack (point-marker)))
(dolist (func '(find-function
counsel-imenu
helm-imenu
projectile-grep
helm-grep-ag
counsel-rg
lsp-ivy-workspace-symbol
citre-jump))
(advice-add func :before 'my--push-point-to-xref-marker-stack))
You can jump back with any of them using M-,
.
Or for those who are using citre with evil-mode:
(evil-add-command-properties #'citre-jump :jump t)
Now you can jump back with C-o
.