From: Jani Nikula <jani@nikula.org>
To: notmuch@notmuchmail.org, cworth@cworth.org
Subject: [PATCH 2/2] emacs: add support for defining custom sort order for saved searches
Date: Fri, 7 Feb 2014 12:25:53 +0100 [thread overview]
Message-ID: <061c4bf44c9bd08ab69ca6dfcae9037101ff69a8.1391771337.git.jani@nikula.org> (raw)
In-Reply-To: <1391727088-22172-1-git-send-email-cworth@cworth.org>
In-Reply-To: <cover.1391771337.git.jani@nikula.org>
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
next prev parent reply other threads:[~2014-02-07 11:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1391727088-22172-1-git-send-email-cworth@cworth.org>
2014-02-07 11:25 ` [PATCH 0/2] emacs: per saved search sort order Jani Nikula
2014-02-07 11:25 ` [PATCH 1/2] emacs: store sort order in the widgets in notmuch-hello Jani Nikula
2014-02-07 11:25 ` Jani Nikula [this message]
2014-02-08 2:29 ` [PATCH] emacs: notmuch-hello: Add variable to control order or saved-search results Keith Packard
2012-10-02 20:18 [PATCH 0/2] emacs: per saved search sort order Jani Nikula
2012-10-02 20:18 ` [PATCH 2/2] emacs: add support for defining custom sort order for saved searches Jani Nikula
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=061c4bf44c9bd08ab69ca6dfcae9037101ff69a8.1391771337.git.jani@nikula.org \
--to=jani@nikula.org \
--cc=cworth@cworth.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).