[PATCH] notmuch-show: add notmuch-show-auto-mark-read option
Michal Nazarewicz
mpn at google.com
Tue Aug 7 08:32:51 PDT 2012
> On Mon, 06 Aug 2012, Michal Nazarewicz <mpn at google.com> wrote:
>> @@ -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")))
Mark Walters <markwalters1009 at gmail.com> writes:
> 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?
Something like the following (not tested)?
From: Michal Nazarewicz <mina86 at mina86.com>
Date: Mon, 6 Aug 2012 15:31:20 +0200
Subject: [PATCH] notmuch-show: add notmuch-show-mark-read-tags option
The `notmuch-show-mark-read-tags' lists tags that are to be applied when
message is read. By default, the only value is "-unread" which will remove
the unread tag. Among other uses, this variable can be used to stop
notmuch-show from modifying tags when message is shown (by setting the
variable to an empty list).
---
emacs/notmuch-show.el | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index dcfc190..92a4beb 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -183,6 +183,13 @@ provided with an MLA argument nor `completing-read' input."
notmuch-show-stash-mlarchive-link-alist))
:group 'notmuch-show)
+(defcustom notmuch-show-mark-read-tags '("-unread")
+ "List of tags to apply when message is read, ie. shown in notmuch-show
+buffer."
+ :type '(repeat string)
+ :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
@@ -1383,8 +1390,9 @@ current thread."
(notmuch-show-get-prop :headers-visible))
(defun notmuch-show-mark-read ()
- "Mark the current message as read."
- (notmuch-show-tag-message "-unread"))
+ "Apply `notmuch-show-mark-read-tags' to the message."
+ (when notmuch-show-mark-read-tags
+ (apply notmuch-show-tag-message notmuch-show-mark-read-tags)))
;; Functions for getting attributes of several messages in the current
;; thread.
--
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michał “mina86” Nazarewicz (o o)
ooo +----<email/xmpp: mpn at google.com>--------------ooO--(_)--Ooo--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20120807/657154a7/attachment.pgp>
More information about the notmuch
mailing list