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

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

[elpa] externals/mct 2d9d3d991f: Update sample sorting code


From: ELPA Syncer
Subject: [elpa] externals/mct 2d9d3d991f: Update sample sorting code
Date: Mon, 7 Feb 2022 04:57:35 -0500 (EST)

branch: externals/mct
commit 2d9d3d991f5978dfdf323b3d9f61b7b0babbf1bf
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Update sample sorting code
---
 README.org | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/README.org b/README.org
index 3c4b201e5e..67f09994ae 100644
--- a/README.org
+++ b/README.org
@@ -1095,8 +1095,8 @@ accepts a custom function.  Consider any of the following 
examples:
 (defun my-sort-by-alpha-length (elems)
   "Sort ELEMS first alphabetically, then by length."
   (sort elems (lambda (c1 c2)
-                (and (string-version-lessp c1 c2)
-                     (< (length c1) (length c2))))))
+                (or (string-version-lessp c1 c2)
+                    (< (length c1) (length c2)))))))
 
 (defun my-sort-by-history (elems)
   "Sort ELEMS by minibuffer history.
@@ -1109,11 +1109,13 @@ Use `mct-sort-sort-by-alpha-length' if no history is 
available."
 (defun my-sort-multi-category (elems)
   "Sort ELEMS per completion category."
   (pcase (mct--completion-category)
-    ('nil (my-sort-by-alpha-length elems))
+    ('nil elems) ; no sorting
+    ('kill-ring elems)
+    ('project-file (my-sort-by-alpha-length elems))
     (_ (my-sort-by-history elems))))
 
 ;; Specify the sorting function.
-(setq completions-sort #'my-sort-by-history)
+(setq completions-sort #'my-sort-multi-category)
 #+end_src
 
 [[#h:1f42c4e6-53c1-4e8a-81ef-deab70822fa4][Known completion categories]].



reply via email to

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