unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Mark Walters <markwalters1009@gmail.com>
To: Austin Clements <amdragon@MIT.EDU>
Cc: notmuch@notmuchmail.org
Subject: Re: [PATCH 5/5] emacs: Add a sort-order option to saved-searches
Date: Sun, 06 Apr 2014 06:32:35 +0100	[thread overview]
Message-ID: <87sipruioc.fsf@qmul.ac.uk> (raw)
In-Reply-To: <20140406013029.GG15472@mit.edu>


Hi

On Sun, 06 Apr 2014, Austin Clements <amdragon@MIT.EDU> wrote:
> Quoth Mark Walters on Apr 05 at 10:24 pm:
>> This adds a sort-order option to saved-searches, stores it in the
>> saved-search buttons (widgets), and uses the stored value when the
>> button is pressed.
>> 
>> Storing the sort-order in the widget was suggested by Jani in
>> id:4c3876274126985683e888641b29cf18142a5eb8.1391771337.git.jani@nikula.org.
>> ---
>>  emacs/notmuch-hello.el |   11 ++++++++++-
>>  emacs/notmuch-lib.el   |    7 ++++++-
>>  2 files changed, 16 insertions(+), 2 deletions(-)
>> 
>> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
>> index aa40e6f..6a28372 100644
>> --- a/emacs/notmuch-hello.el
>> +++ b/emacs/notmuch-hello.el
>> @@ -364,7 +364,8 @@ (defun notmuch-hello-reflect (list ncols)
>>  (defun notmuch-hello-widget-search (widget &rest ignore)
>>    (notmuch-search (widget-get widget
>>  			      :notmuch-search-terms)
>> -		  notmuch-search-oldest-first))
>> +		  (widget-get widget
>> +			      :notmuch-search-oldest-first)))
>>  
>>  (defun notmuch-saved-search-count (search)
>>    (car (process-lines notmuch-command "count" search)))
>> @@ -496,12 +497,20 @@ (defun notmuch-hello-insert-buttons (searches)
>>  		  (widget-insert (make-string column-indent ? )))
>>  	      (let* ((name (plist-get elem :name))
>>  		     (query (plist-get elem :query))
>> +		     (oldest-first (cond
>> +				    ((eq (plist-get elem :sort-order) 'newest-first)
>> +				     nil)
>> +				    ((eq (plist-get elem :sort-order) 'oldest-first)
>> +				     t)
>> +				    (t
>> +				     notmuch-search-oldest-first)))
>
> (case (plist-get elem :sort-order)
>   (newest-first nil)
>   (oldest-first t)
>   (otherwise notmuch-search-oldest-first))

This is much better.

>
>>  		     (msg-count (plist-get elem :count)))
>>  		(widget-insert (format "%8s "
>>  				       (notmuch-hello-nice-number msg-count)))
>>  		(widget-create 'push-button
>>  			       :notify #'notmuch-hello-widget-search
>>  			       :notmuch-search-terms query
>> +			       :notmuch-search-oldest-first 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 8a12f91..8aa8cfc 100644
>> --- a/emacs/notmuch-lib.el
>> +++ b/emacs/notmuch-lib.el
>> @@ -125,7 +125,12 @@ (define-widget 'notmuch-saved-search-plist 'list
>>  		(group :format "%v" :inline t (const :format "  Query: " :query) (string :format "%v")))
>>  	  (checklist :inline t
>>  		     :format "%v"
>> -		     (group :format "%v" :inline t (const :format "Count-Query: " :count-query) (string :format "%v")))))
>> +		     (group :format "%v" :inline t (const :format "Count-Query: " :count-query) (string :format "%v"))
>> +		     (group :format "%v" :inline t (const :format "" :sort-order)
>> +			    (choice :tag " Sort Order"
>
> Should there be a colon?  (I haven't applied the patches and I'm
> afraid this is beyond my mental implementation of define-widget!)

I think it is OK without: since this is using :tag rather than :format
the colon is supplied automatically.

Many thanks

Mark

>
>> +				    (const :tag "Default" nil)
>> +				    (const :tag "Oldest-first" oldest-first)
>> +				    (const :tag "Newest-first" newest-first))))))
>>  
>>  (defcustom notmuch-saved-searches '((:name "inbox" :query "tag:inbox")
>>  				    (:name "unread" :query "tag:unread"))

  reply	other threads:[~2014-04-06  5:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-05 21:24 [PATCH 0/5] emacs: hello: convert saved-searches to plists Mark Walters
2014-04-05 21:24 ` [PATCH 1/5] emacs: hello: add helper functions for saved-searches Mark Walters
2014-04-06  0:58   ` Austin Clements
2014-04-05 21:24 ` [PATCH 2/5] emacs: hello: use the saved-search helper functions Mark Walters
2014-04-06  1:06   ` Austin Clements
2014-04-05 21:24 ` [PATCH 3/5] emacs: hello: add a customize for saved-searches Mark Walters
2014-04-05 21:24 ` [PATCH 4/5] emacs: hello: switch notmuch-hello-insert-buttons to plists Mark Walters
2014-04-06  1:24   ` Austin Clements
2014-04-06  5:31     ` Mark Walters
2014-04-05 21:24 ` [PATCH 5/5] emacs: Add a sort-order option to saved-searches Mark Walters
2014-04-06  1:30   ` Austin Clements
2014-04-06  5:32     ` Mark Walters [this message]
2014-04-06  0:52 ` [PATCH 0/5] emacs: hello: convert saved-searches to plists David Bremner
2014-04-06  5:34   ` Mark Walters
2014-04-06  8:04   ` Tomi Ollila

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=87sipruioc.fsf@qmul.ac.uk \
    --to=markwalters1009@gmail.com \
    --cc=amdragon@MIT.EDU \
    --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).