consult: remove unnecessary use of advice

Since the advice is only added for the duration of a function call we
can simply let-bind the overridden function instead.
This commit is contained in:
Sebastian Arlund Nørgaard 2021-12-06 12:57:07 +01:00
parent 96ef16b3a0
commit 673c388a6c
1 changed files with 3 additions and 7 deletions

View File

@ -92,13 +92,9 @@ as defined in `evil-collection-consult--evil-mark-ring'."
(defun evil-collection-consult-mark ()
"Jump to an evil marker in the current buffer."
(interactive)
(unwind-protect
(progn
(advice-add #'consult--mark-candidates :override
#'evil-collection-consult--mark-candidates)
(consult-mark (evil-collection-consult--evil-mark-ring)))
(advice-remove #'consult--mark-candidates
#'evil-collection-consult--mark-candidates)))
(cl-letf (((symbol-function 'consult--mark-candidates)
#'evil-collection-consult--mark-candidates))
(consult-mark (evil-collection-consult--evil-mark-ring))))
;;;###autoload
(defun evil-collection-consult-setup ()