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

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

[elpa] externals/activities c31498588e 36/50: improve custom activities-


From: ELPA Syncer
Subject: [elpa] externals/activities c31498588e 36/50: improve custom activities-sort-function -> activities-sort-by
Date: Wed, 25 Dec 2024 03:57:20 -0500 (EST)

branch: externals/activities
commit c31498588ecbae222bf4ff14868c09c1692bfa9e
Author: J.D. Smith <jdtsmith@gmail.com>
Commit: JD Smith <93749+jdtsmith@users.noreply.github.com>

    improve custom activities-sort-function -> activities-sort-by
---
 activities.el | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/activities.el b/activities.el
index 7d07def195..43ddf09cf6 100644
--- a/activities.el
+++ b/activities.el
@@ -332,15 +332,17 @@ Kills buffers that have only been shown in that activity's
 frame/tab."
   :type 'boolean)
 
-(defcustom activities-sort-function #'activities-sort-by-active-age
-  "A function to use to sort by when prompting for activities.
-If nil, no sorting will be applied.  The function should take two
-arguments, both activity names (strings).  It should return
-non-nil if the first activity should sort before the second.  By
+(defcustom activities-sort-by #'activities-sort-by-active-age
+  "How to sort activities during selection.
+Function used to sort by when prompting for activities.  By
 default, a function is used which sorts active activities first,
-and then by age since modification."
-  :type '(choice (const :tag "No sorting" nil)
-                (function :tag "A specific function")))
+and then by age since modification.  If nil, no sorting will be
+applied.  A custom predicate function may also be set.  It should
+take two arguments, both activity names (strings), and return
+non-nil if the first activity should sort before the second."
+  :type `(choice (const :tag "No sorting" nil)
+                (const :tag "Active state and age" 
,#'activities-sort-by-active-age)
+                (function :tag "Custom predicate")))
 
 (defcustom activities-annotation-colors '("blue" "red" 0.65)
   "Colors to use for annotating activity age.
@@ -983,8 +985,8 @@ which see, with DEFAULT."
        (table (lambda (str pred action)
                (if (eq action 'metadata)
                    `(metadata (annotation-function . ,annotation-function)
-                              ,@(when activities-sort-function
-                                  `(,(cons 'display-sort-function 
activities-sort-function))))
+                              ,@(when activities-sort-by
+                                  `(,(cons 'display-sort-function 
activities-sort-by))))
                  (complete-with-action action names str pred))))
        (prompt (format-prompt prompt default))
        (name (completing-read prompt table nil t nil 
'activities-completing-read-history default)))



reply via email to

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