[PATCH 5/6] emacs: notmuch-search-orders

William Casarin jb55 at jb55.com
Mon Sep 25 22:35:46 PDT 2017


Create a notmuch-sort-orders alist to be shared between
notmuch-search-sort-orders and notmuch-change-search-order
---
 emacs/notmuch-lib.el | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index ee7b67d3..16725863 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -92,6 +92,14 @@ $PATH)."
   :type 'string
   :group 'notmuch-external)
 
+(setq notmuch-sort-orders
+  '(("Oldest-first" . oldest-first)
+    ("Newest-first" . newest-first)
+    ("Subject-ascending" . subject-ascending)
+    ("Subject-descending" . subject-descending)
+    ("From-ascending" . from-ascending)
+    ("From-descending" . from-descending)))
+
 (defcustom notmuch-search-sort-order 'oldest-first
   "Show the oldest mail first when searching.
 
@@ -99,13 +107,10 @@ This variable defines the default sort order for displaying
 search results. Note that any filtered searches created by
 `notmuch-search-filter' retain the search order of the parent
 search."
-  :type '(choice :tag " Sort Order"
-		 (const :tag "Oldest-first" oldest-first)
-		 (const :tag "Newest-first" newest-first)
-		 (const :tag "Subject-ascending" subject-ascending)
-		 (const :tag "Subject-descending" subject-descending)
-		 (const :tag "From-ascending" from-ascending)
-		 (const :tag "From-descending" from-descending))
+  :type (append '(choice :tag " Sort Order")
+		(mapcar (lambda (pair)
+			  `(const :tag ,(car pair) ,(cdr pair)))
+			notmuch-sort-orders))
   :group 'notmuch-search)
 
 (defcustom notmuch-poll-script nil
-- 
2.13.2



More information about the notmuch mailing list