From 673c388a6c1b7111da88e56377ba39bf03631fe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Arlund=20N=C3=B8rgaard?= Date: Mon, 6 Dec 2021 12:57:07 +0100 Subject: [PATCH] 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. --- modes/consult/evil-collection-consult.el | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/modes/consult/evil-collection-consult.el b/modes/consult/evil-collection-consult.el index 4e0a961..1ad5926 100644 --- a/modes/consult/evil-collection-consult.el +++ b/modes/consult/evil-collection-consult.el @@ -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 ()