branch: externals/corfu commit 79a2a612ae8b89f55bc962b429f1b740d5ff89cc Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
Improve orderless support Precompile the regular expressions in order to handle local overrides of orderless-matching-styles etc. --- corfu.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/corfu.el b/corfu.el index f7ec8e7..9a746dc 100644 --- a/corfu.el +++ b/corfu.el @@ -316,6 +316,7 @@ Set to nil in order to disable confirmation." ;; bug#47711: Deferred highlighting for `completion-all-completions' ;; XXX There is one complication: `completion--twq-all' already adds `completions-common-part'. (declare-function orderless-highlight-matches "ext:orderless") +(declare-function orderless-pattern-compiler "ext:orderless") (require 'orderless nil 'noerror) (defun corfu--all-completions (&rest args) "Compute all completions for ARGS with deferred highlighting." @@ -339,7 +340,8 @@ Set to nil in order to disable confirmation." cands)) ((symbol-function #'orderless-highlight-matches) (lambda (pattern cands) - (setq hl (lambda (x) (orderless-highlight-matches pattern x))) + (let ((regexps (orderless-pattern-compiler pattern))) + (setq hl (lambda (x) (orderless-highlight-matches regexps x)))) cands))) (cons (apply #'completion-all-completions args) hl)))