emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/denote 10b9b984e4 07/32: Add denote--completion-table-n


From: ELPA Syncer
Subject: [elpa] externals/denote 10b9b984e4 07/32: Add denote--completion-table-no-sort
Date: Sat, 20 Jan 2024 00:57:41 -0500 (EST)

branch: externals/denote
commit 10b9b984e4ad50433cd295d24741f6bce904dcec
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Add denote--completion-table-no-sort
    
    We might need it for something I have in the works. The idea is to
    define a completion table which instructs the completion user
    interface to not do any sorting of its own, while also defining a
    completion category.
---
 denote.el | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/denote.el b/denote.el
index 680df2206f..7f9d0a1166 100644
--- a/denote.el
+++ b/denote.el
@@ -591,6 +591,15 @@ things accordingly.")
         `(metadata (category . ,category))
       (complete-with-action action candidates string pred))))
 
+(defun denote--completion-table-no-sort (category candidates)
+  "Pass appropriate metadata CATEGORY to completion CANDIDATES.
+Like `denote--completion-table' but also disable sorting."
+  (lambda (string pred action)
+    (if (eq action 'metadata)
+        `(metadata (category . ,category)
+                   (display-sort-function . ,#'identity))
+      (complete-with-action action candidates string pred))))
+
 (defun denote--default-directory-is-silo-p ()
   "Return path to silo if `default-directory' is a silo."
   (when-let ((dir-locals (dir-locals-find-file default-directory))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]