From: David Edmondson <dme@dme.org>
To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org
Subject: Re: [PATCH 6/7] emacs: hello: add highlight newly arrived messages option
Date: Mon, 12 May 2014 14:58:28 +0100 [thread overview]
Message-ID: <cunlhu76quz.fsf@hotblack-desiato.hh.sledj.net> (raw)
In-Reply-To: <1399797282-20389-7-git-send-email-markwalters1009@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2601 bytes --]
On Sun, May 11 2014, Mark Walters wrote:
> This adds a function that highlights searches which have newly arrived
> messages (ones which arrived since the previous refresh of
> notmuch-hello). It does that by getting a full list of matching
> message ids and checking whether any new messages have appeared. Thus
> it will be slow on large saved searches.
> ---
> emacs/notmuch-hello.el | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> index 28e16be..265b879 100644
> --- a/emacs/notmuch-hello.el
> +++ b/emacs/notmuch-hello.el
> @@ -96,6 +96,8 @@ (define-widget 'notmuch-saved-search-plist 'list
> (const :tag "Default (messages)" nil)
> (function-item :tag "messages/threads"
> notmuch-hello-display-count-threads-and-messages)
> + (function-item :tag "highlight newly arrived messages"
> + notmuch-hello-display-new-messages)
> function)))))
>
> (defcustom notmuch-saved-searches '((:name "inbox" :query "tag:inbox")
> @@ -507,6 +509,25 @@ (defun notmuch-hello-display-count-threads-and-messages (&rest args)
> (notmuch-hello-nice-number threads))))
> (plist-put current :count display)))
>
> +(defun notmuch-hello-display-new-messages (&rest args)
> + "Highlight saved searches which have new messages.
> +
> +New messages are ones which have appeared since the last time
> +notmuch hello was refreshed. This will be slow on large queries."
> + (let* ((current (plist-get args :current))
> + (old (plist-get args :old))
> + (query (plist-get current :query))
> + (name (plist-get current :name))
> + (new-list (notmuch-call-notmuch-sexp "search"
> + "--output=messages"
> + "--format=sexp"
> + query))
> + (old-list (plist-get old :message-list)))
> + (unless (subsetp new-list old-list :test 'equal)
> + (plist-put current :name (propertize name 'face '(:foreground "red"))))
> + (plist-put current :count (notmuch-hello-nice-number (length new-list)))
> + (plist-put current :message-list new-list)))
I wonder if it would be better to store a hash value derived from the
message list rather than the list itself. The list could be large.
> +
> (defun notmuch-hello-batch-message-count (elem-plist options)
> "Update the message count for a saved search.
>
> --
> 1.7.10.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 310 bytes --]
next prev parent reply other threads:[~2014-05-12 13:58 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-11 8:34 [PATCH 0/7] emacs: hello: custom display of saved searches Mark Walters
2014-05-11 8:34 ` [PATCH 1/7] emacs: hello: separate out the saved-search display function Mark Walters
2017-03-11 14:57 ` David Bremner
2014-05-11 8:34 ` [PATCH 2/7] emacs: hello: allow saved search display functions Mark Walters
2014-05-12 14:03 ` David Edmondson
2014-05-12 15:20 ` Mark Walters
2014-05-11 8:34 ` [PATCH 3/7] emacs: hello: store previous saved-search results Mark Walters
2014-05-11 8:34 ` [PATCH 4/7] emacs: hello: add a threads-and-messages function Mark Walters
2014-05-11 8:34 ` [PATCH 5/7] emacs: hello: require cl Mark Walters
2017-03-11 15:01 ` David Bremner
2014-05-11 8:34 ` [PATCH 6/7] emacs: hello: add highlight newly arrived messages option Mark Walters
2014-05-12 13:58 ` David Edmondson [this message]
2014-05-12 15:33 ` Mark Walters
2016-01-07 22:52 ` Tomi Ollila
2014-05-11 8:34 ` [PATCH 7/7] emacs: hello: add option to omit count for a search Mark Walters
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=cunlhu76quz.fsf@hotblack-desiato.hh.sledj.net \
--to=dme@dme.org \
--cc=markwalters1009@gmail.com \
--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).