[PATCH 2/2] emacs: add support for defining custom sort order for saved searches
Jani Nikula
jani at nikula.org
Tue Oct 2 13:18:03 PDT 2012
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.
NOTES:
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 532f06d..e410357 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -433,7 +433,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 69867ad..e1cd7d2 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -82,6 +82,15 @@
: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