[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vertico 21ac5a946b 4/4: Introduce vertico-sort-override
From: |
ELPA Syncer |
Subject: |
[elpa] externals/vertico 21ac5a946b 4/4: Introduce vertico-sort-override-function |
Date: |
Mon, 11 Apr 2022 11:58:00 -0400 (EDT) |
branch: externals/vertico
commit 21ac5a946b4f09797ee98fc65babcb48b4240e0c
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Introduce vertico-sort-override-function
---
README.org | 3 ++-
vertico.el | 8 +++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/README.org b/README.org
index 0c73f7ae1f..6bab3671fe 100644
--- a/README.org
+++ b/README.org
@@ -329,7 +329,8 @@ calling convention of a mode, i.e., it takes a single
argument, which is either
Furthermore you can tune buffer-local settings per command or category.
#+begin_src emacs-lisp
- ;; Change the default sorting function
+ ;; Change the default sorting function.
+ ;; See `vertico-sort-function' and `vertico-sort-override-function'.
(setq vertico-multiform-commands
'((describe-symbol (vertico-sort-function . vertico-sort-alpha))))
diff --git a/vertico.el b/vertico.el
index 307f2e9de5..6746500b80 100644
--- a/vertico.el
+++ b/vertico.el
@@ -90,6 +90,10 @@ See `resize-mini-windows' for documentation."
(const :tag "Alphabetically" ,#'vertico-sort-alpha)
(function :tag "Custom function")))
+(defcustom vertico-sort-override-function nil
+ "Override sort function which overrides the `display-sort-function'."
+ :type '(choice (const nil) function))
+
(defgroup vertico-faces nil
"Faces used by Vertico."
:group 'vertico
@@ -303,7 +307,9 @@ The function is configured by BY, BSIZE, BINDEX, BPRED and
PRED."
(defun vertico--sort-function ()
"Return the sorting function."
- (or (vertico--metadata-get 'display-sort-function) vertico-sort-function))
+ (or vertico-sort-override-function
+ (vertico--metadata-get 'display-sort-function)
+ vertico-sort-function))
(defun vertico--filter-files (files)
"Filter FILES by `completion-ignored-extensions'."