diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2024-04-09 06:38:25 +0200 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2024-04-09 06:38:25 +0200 |
| commit | e7429b93bc61a9b76efdc2590d08af221b102f4c (patch) | |
| tree | 251f9eec4059b71d158f89f55e02c4b604190e03 | |
| parent | 114285b6b0a1f6f15c3203ad8a71e0fb9c74de96 (diff) | |
completion-hilit-commonality supports completion-lazy-hilit
| -rw-r--r-- | corfu.el | 17 |
1 files changed, 7 insertions, 10 deletions
@@ -534,15 +534,7 @@ FRAME is the existing frame." (defun corfu--filter-completions (&rest args) "Compute all completions for ARGS with lazy highlighting." - (defvar completion-lazy-hilit) - (defvar completion-lazy-hilit-fn) - (cl-letf* ((completion-lazy-hilit t) - (completion-lazy-hilit-fn nil) - ((symbol-function #'completion-hilit-commonality) - (lambda (cands prefix &optional base) - (setq completion-lazy-hilit-fn - (lambda (x) (car (completion-hilit-commonality (list x) prefix base)))) - (and cands (nconc cands base))))) + (dlet ((completion-lazy-hilit t) (completion-lazy-hilit-fn nil)) (if (eval-when-compile (>= emacs-major-version 30)) (cons (apply #'completion-all-completions args) completion-lazy-hilit-fn) (cl-letf* ((orig-pcm (symbol-function #'completion-pcm--hilit-commonality)) @@ -562,7 +554,12 @@ FRAME is the existing frame." (condition-case nil (car (completion-pcm--hilit-commonality pattern (list x))) (t x)))) - cands))) + cands)) + ((symbol-function #'completion-hilit-commonality) + (lambda (cands prefix &optional base) + (setq completion-lazy-hilit-fn + (lambda (x) (car (completion-hilit-commonality (list x) prefix base)))) + (and cands (nconc cands base))))) (cons (apply #'completion-all-completions args) completion-lazy-hilit-fn))))) (defsubst corfu--length-string< (x y) |
