[PATCH] notmuch-show: add notmuch-show-auto-mark-read option
Tomi Ollila
tomi.ollila at iki.fi
Tue Aug 7 08:51:37 PDT 2012
On Tue, Aug 07 2012, Mark Walters <markwalters1009 at gmail.com> wrote:
> On Mon, 06 Aug 2012, Michal Nazarewicz <mpn at google.com> wrote:
>> From: Michal Nazarewicz <mina86 at mina86.com>
>>
>> Setting `notmuch-show-auto-mark-read' to nil stops notmuch-show from marking
>> the message as read (by removing the unread tag). Inteded for people who
>> like to mark messages read explicitly.
>> ---
>> emacs/notmuch-show.el | 16 +++++++++++++---
>> 1 files changed, 13 insertions(+), 3 deletions(-)
>>
>> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
>> index d318430..85a17b1 100644
>> --- a/emacs/notmuch-show.el
>> +++ b/emacs/notmuch-show.el
>> @@ -183,6 +183,14 @@ provided with an MLA argument nor `completing-read' input."
>> notmuch-show-stash-mlarchive-link-alist))
>> :group 'notmuch-show)
>>
>> +(defcustom notmuch-show-auto-mark-read t
>> + "Whether to automatically mark message as read when it is shown. If
>> +nil, message needs to be marked as read manually for instance by
>> +removing the unread tag."
>> + :type 'boolean
>> + :group 'notmuch-show)
>> +
>> +
>> (defmacro with-current-notmuch-show-message (&rest body)
>> "Evaluate body with current buffer set to the text of current message"
>> `(save-excursion
>> @@ -1374,9 +1382,11 @@ current thread."
>> "Are the headers of the current message visible?"
>> (notmuch-show-get-prop :headers-visible))
>>
>> -(defun notmuch-show-mark-read ()
>> - "Mark the current message as read."
>> - (notmuch-show-tag-message "-unread"))
>> +(defun notmuch-show-mark-read (&optional force)
>> + "Mark the current message as read if FORCE or
>> +`notmuch-show-auto-mark-read' is non-nil."
>> + (when (or force notmuch-show-auto-mark-read)
>> + (notmuch-show-tag-message "-unread")))
>
>
> As an alternative approach would allowing a list of tags (or even tag
> changes) to apply when a message is "read" do what you want and be more
> flexible?
That's a great idea -- better than mine (just a variable which informs
which tag is to be removed) .. something like:
(defcustom notmuch-message-read-tag-changes '("-unread") "docstring" ...)
Then one can have e.g.
'() -- for no tag changes
'("-inbox" "-unread" "+read")
'("-postilaatikko" "-lukematon" "+luettu") -- the above in finnish.
Tomi
> I am thinking of something roughly analogous to
> notmuch-message-replied-tags. I can imagine some people would like to
> remove the inbox tag automatically for example. (And since we sync with
> maildir flags the exact tag name does matter).
>
> I agree with Austin that the current unread marking is a little
> weird/unpredictable (eg notmuch-show-next-message marks a message read
> even if it is closed) but I don't think fixing that helps your use.
>
> Best wishes
>
> Mark
>
>
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
More information about the notmuch
mailing list