From: Mark Walters <markwalters1009@gmail.com>
To: Austin Clements <amdragon@MIT.EDU>
Cc: notmuch@notmuchmail.org
Subject: Re: [PATCH 4/5] emacs: hello: switch notmuch-hello-insert-buttons to plists
Date: Sun, 06 Apr 2014 06:31:29 +0100 [thread overview]
Message-ID: <87vbunuiq6.fsf@qmul.ac.uk> (raw)
In-Reply-To: <20140406012425.GF15472@mit.edu>
Hello
>> @@ -455,23 +457,26 @@ (defun notmuch-hello-query-counts (query-list &rest options)
>> #'identity
>> (mapcar
>> (lambda (elem)
>> - (let ((name (notmuch-saved-search-get elem :name))
>> - (search-query (notmuch-saved-search-get elem :query))
>> - (message-count (prog1 (read (current-buffer))
>> + (let* ((elem-plist (notmuch-hello-saved-search-to-plist elem))
>> + (search-query (plist-get elem-plist :query))
>> + (filtered-query (notmuch-hello-filtered-query
>> + search-query (plist-get options :filter)))
>> + (message-count (prog1 (read (current-buffer))
>> (forward-line 1))))
>> (and (or (plist-get options :show-empty-searches) (> message-count 0))
>> - (list name (notmuch-hello-filtered-query
>> - search-query (plist-get options :filter))
>> - message-count))))
>> + (setq elem-plist (plist-put elem-plist :query filtered-query))
>
> This technically works, but `setq' is a strange thing to see in an
> `and'. But the problem isn't the `setq'; it's that crazy `and'. I'd
> replace the `and' with `when', keep the `setq' and `plist-put' in the
> body, and squint a lot less at this code.
This was actually a bug on my part: the filtered query can be nil (which
is used to mean hide this search); in earlier versions having a setq
inside the `and' achieved this but obviously not in this plist form. I
have switched to the when as suggested and added a test for
filtered-query being nil.
Best wishes
Mark
next prev parent reply other threads:[~2014-04-06 5:31 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 [this message]
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
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=87vbunuiq6.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).