From 6647b7fc3dfdbc4b23740b3aea6c284576a82723 Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Thu, 4 Nov 2021 20:33:18 +0100 Subject: Minor optimization --- corfu.el | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/corfu.el b/corfu.el index 7bf8214..c731f41 100644 --- a/corfu.el +++ b/corfu.el @@ -556,11 +556,10 @@ completion began less than that number of seconds ago." (defun corfu--match-symbol-p (pattern sym) "Return non-nil if SYM is matching an element of the PATTERN list." (and (symbolp sym) - (seq-some (lambda (x) - (if (symbolp x) - (eq sym x) - (string-match-p x (symbol-name sym)))) - pattern))) + (cl-loop for x in pattern + thereis (if (symbolp x) + (eq sym x) + (string-match-p x (symbol-name sym)))))) (defun corfu-quit () "Quit Corfu completion." @@ -954,8 +953,8 @@ completion began less than that number of seconds ago." (cancel-timer corfu--auto-timer) (setq corfu--auto-timer nil)) (when (and (not completion-in-region-mode) - (display-graphic-p) - (corfu--match-symbol-p corfu-auto-commands this-command)) + (corfu--match-symbol-p corfu-auto-commands this-command) + (display-graphic-p)) (setq corfu--auto-timer (run-with-idle-timer corfu-auto-delay nil #'corfu--auto-complete (current-buffer))))) -- cgit v1.0