[PATCH 2/2] emacs: add support for defining custom sort order for saved searches
Jani Nikula
jani at nikula.org
Fri Feb 7 03:25:53 PST 2014
Add a new customization option notmuch-saved-searches-oldest-first to
define custom sort order for saved searches. Do this as a separate
option from notmuch-saved-searches to dodge backwards compatibility
issues.
NOTE:
If the name of a tag matches the name of a saved search with a custom
sort order, then the search for that tag using the all tags section of
notmuch-hello will use the custom sort order too.
If you change any sort orders, you must refresh notmuch-hello for the
changes to take effect.
Only searches initiated from notmuch-hello will be affected.
---
emacs/notmuch-hello.el | 6 +++++-
emacs/notmuch-lib.el | 9 +++++++++
2 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 1c30b47..530b3ac 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -463,7 +463,11 @@ Such a list can be computed with `notmuch-hello-query-counts'."
(widget-create 'push-button
:notify #'notmuch-hello-widget-search
:notmuch-search-terms query
- :notmuch-search-oldest-first notmuch-search-oldest-first
+ :notmuch-search-oldest-first
+ (let ((m (assoc
+ name
+ notmuch-saved-searches-oldest-first)))
+ (if m (cdr m) notmuch-search-oldest-first))
name)
(setq column-indent
(1+ (max 0 (- column-width (length name)))))))
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index fa35fa9..16d9a52 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -113,6 +113,15 @@ Note that the recommended way of achieving the same is using
:type '(alist :key-type string :value-type string)
:group 'notmuch-hello)
+(defcustom notmuch-saved-searches-oldest-first nil
+ "List of saved searches with custom sort order.
+
+For each saved search name appearing in the list, use t for
+oldest-first, nil for newest-first. Saved searches not present in
+this list will use `notmuch-search-oldest-first' sort order."
+ :type '(alist :key-type string :value-type boolean)
+ :group 'notmuch-hello)
+
(defcustom notmuch-archive-tags '("-inbox")
"List of tag changes to apply to a message or a thread when it is archived.
--
1.7.2.5
More information about the notmuch
mailing list