summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2022-04-11 17:29:36 +0200
committerDaniel Mendler <mail@daniel-mendler.de>2022-04-11 17:30:11 +0200
commitde6bb40ea83a161fa29f43689c0882c8b0605d25 (patch)
treefa2b5ce126f397f6e90f059053e002c1f1a995e7
parent65dd164b2599763016b4e8429578f30ad68488e8 (diff)
Introduce corfu-sort-override-function
See also vertico-sort-override-function
-rw-r--r--corfu.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/corfu.el b/corfu.el
index cb43c90..389f195 100644
--- a/corfu.el
+++ b/corfu.el
@@ -153,6 +153,10 @@ return a string, possibly an icon."
(const :tag "By length and alpha" ,#'corfu-sort-length-alpha)
(function :tag "Custom function")))
+(defcustom corfu-sort-override-function nil
+ "Override sort function which overrides the `display-sort-function'."
+ :type '(choice (const nil) function))
+
(defcustom corfu-auto-prefix 3
"Minimum length of prefix for auto completion.
The completion backend can override this with
@@ -588,7 +592,9 @@ A scroll bar is displayed from LO to LO+BAR."
(defun corfu--sort-function ()
"Return the sorting function."
- (or (corfu--metadata-get 'display-sort-function) corfu-sort-function))
+ (or corfu-sort-override-function
+ (corfu--metadata-get 'display-sort-function)
+ corfu-sort-function))
(defun corfu--recompute-candidates (str pt table pred)
"Recompute candidates from STR, PT, TABLE and PRED."