From 814c5b5c0c7ca6d148dba78326666619f79548ee Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Wed, 7 Jul 2021 01:24:31 +0300 Subject: [PATCH] selectrum: improve company advice - try `basic` and `partial-completion` completion styles before `orderless`, since `company-mode` is usually used in in-buffer completions where these often give much more relevant results than orderless, which can still be accessed by `&`. --- modules/completion/selectrum/TODO.org | 1 - modules/completion/selectrum/autoload/selectrum.el | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 0c2a00bf1..6f77f5831 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -119,7 +119,6 @@ The clicking links exported grep buffers used to open in a new window, but now *** TODO Open upstream Embark issue for ~bookmark~ and ~file~ ~bookmark~ or ~file~ export buffers open the links in the same window rather than the other one. This can be reproduces on emacs -Q. -** TODO ~company~ completions get ordered really weirdly This is due to orderless adding a bunch of other matches. * PROJ Review non-blocking Issues diff --git a/modules/completion/selectrum/autoload/selectrum.el b/modules/completion/selectrum/autoload/selectrum.el index 55e97f630..56cb5f1a9 100644 --- a/modules/completion/selectrum/autoload/selectrum.el +++ b/modules/completion/selectrum/autoload/selectrum.el @@ -2,10 +2,11 @@ ;;;###autoload (defadvice! +selectrum--company-capf--candidates-a (fn &rest args) - "Function to help company to highlight all candidates with just -one face." + "Highlight company matches correctly, and try default completion styles before +orderless." :around 'company-capf--candidates - (let ((orderless-match-faces [completions-common-part])) + (let ((orderless-match-faces [completions-common-part]) + (completion-styles '(basic partial-completion orderless))) (apply fn args))) ;;;###autoload