branch: externals/vertico commit f60480cfc7f2c5be2e408808c90a886b8e4f68be Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
vertico-quick: Minor simplifications --- extensions/vertico-quick.el | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/extensions/vertico-quick.el b/extensions/vertico-quick.el index 2f07539..2d61588 100644 --- a/extensions/vertico-quick.el +++ b/extensions/vertico-quick.el @@ -94,21 +94,20 @@ (defun vertico-quick-jump () "Jump to candidate using quick keys." (interactive) - (let ((vertico-quick--index 0) - (vertico-quick--list) - (key)) - (unwind-protect - (progn - (advice-add #'vertico--format-candidate :around #'vertico-quick--format-candidate) - (vertico--exhibit) - (setq key (read-key)) - (when (seq-position vertico-quick2 key) - (let ((vertico-quick--first key) - (vertico-quick--index 0) - (vertico-quick--list)) - (vertico--exhibit)) - (setq key (+ (lsh key 16) (read-key))))) - (advice-remove #'vertico--format-candidate #'vertico-quick--format-candidate)) + (cl-letf* ((vertico-quick--index 0) + (vertico-quick--list nil) + (key nil) + (orig-format (symbol-function #'vertico--format-candidate)) + ((symbol-function #'vertico--format-candidate) + (apply-partially #'vertico-quick--format-candidate orig-format))) + (vertico--exhibit) + (setq key (read-key)) + (when (seq-position vertico-quick2 key) + (let ((vertico-quick--first key) + (vertico-quick--index 0) + (vertico-quick--list)) + (vertico--exhibit)) + (setq key (+ (lsh key 16) (read-key)))) (if-let (idx (alist-get key vertico-quick--list)) (setq vertico--index idx) (message "Invalid key")