branch: externals/corfu
commit de6bb40ea83a161fa29f43689c0882c8b0605d25
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>

    Introduce corfu-sort-override-function
    
    See also vertico-sort-override-function
---
 corfu.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/corfu.el b/corfu.el
index cb43c90bc2..389f19559e 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."

Reply via email to