home

My NixOS systems configurations.
Log | Files | Refs | LICENSE

commit 7523124614f609f800ef8b74d6bb38fe0d8468dc
parent 810a4d889ee1566f0dc25478a5d1e04ac710b19b
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Mon, 10 Jun 2024 12:18:11 +0200

tools/emacs: add some consult functions

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Diffstat:
Mtools/emacs/config/config-completion.el | 23++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/tools/emacs/config/config-completion.el b/tools/emacs/config/config-completion.el @@ -21,7 +21,28 @@ (use-package consult-xref :config (setq xref-show-xrefs-function #'consult-xref - xref-show-definitions-function #'consult-xref)) + xref-show-definitions-function #'consult-xref) + (defvar consult--xref-history nil + "History for the `consult-recent-xref' results.") + + (defun consult-recent-xref (&optional markers) + "Jump to a marker in MARKERS list (defaults to `xref--history'. + +The command supports preview of the currently selected marker position. +The symbol at point is added to the future history." + (interactive) + (consult--read + (consult--global-mark-candidates + (or markers (flatten-list xref--history))) + :prompt "Go to Xref: " + :annotate (consult--line-prefix) + :category 'consult-location + :sort nil + :require-match t + :lookup #'consult--lookup-location + :history '(:input consult--xref-history) + :add-history (thing-at-point 'symbol) + :state (consult--jump-state)))) ;; https://github.com/oantolin/embark/blob/master/embark-consult.el (use-package embark