unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jani Nikula <jani@nikula.org>
To: notmuch@notmuchmail.org
Subject: [PATCH 6/6] emacs: add support for reversing notmuch-show-mark-read tag changes
Date: Sun,  2 Sep 2012 22:58:05 +0300	[thread overview]
Message-ID: <51fb66f6f49ef30a4dac2168aa5f8c270b84c2bd.1346614915.git.jani@nikula.org> (raw)
In-Reply-To: <cover.1346614915.git.jani@nikula.org>
In-Reply-To: <cover.1346614915.git.jani@nikula.org>

Since marking a message as read can now be a user customized set of
tag changes, make reversing this easier. Allow a prefix argument to
notmuch-show-mark-read to reverse the marking as read, similar to the
unarchiving in notmuch-show-archive-message.

While at it, update the relevant documentation to match that of other
automatic tagging (i.e. archive and reply).
---
 emacs/notmuch-show.el |   25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index e701aec..1c1cf9c 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -184,8 +184,15 @@ provided with an MLA argument nor `completing-read' input."
   :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."
+  "List of tag changes to apply to a message when it is marked as read.
+
+Tags starting with \"+\" (or not starting with either \"+\" or
+\"-\") in the list will be added, and tags starting with \"-\"
+will be removed from the message being marked as read.
+
+For example, if you wanted to remove an \"unread\" tag and add a
+\"read\" tag (which would make little sense), you would set:
+    (\"-unread\" \"+read\")"
   :type '(repeat string)
   :group 'notmuch-show)
 
@@ -1390,10 +1397,18 @@ current thread."
   "Are the headers of the current message visible?"
   (notmuch-show-get-prop :headers-visible))
 
-(defun notmuch-show-mark-read ()
-  "Apply `notmuch-show-mark-read-tags' to the message."
+(defun notmuch-show-mark-read (&optional unread)
+  "Mark the current message as read.
+
+Mark the current message as read by applying the tag changes in
+`notmuch-show-mark-read-tags' to it (remove the \"unread\" tag by
+default). If a prefix argument is given, the message will be
+marked as unread, i.e. the tag changes in
+`notmuch-show-mark-read-tags' will be reversed."
+  (interactive "P")
   (when notmuch-show-mark-read-tags
-    (apply 'notmuch-show-tag-message notmuch-show-mark-read-tags)))
+    (apply 'notmuch-show-tag-message
+	   (notmuch-tag-change-list notmuch-show-mark-read-tags unread))))
 
 ;; Functions for getting attributes of several messages in the current
 ;; thread.
-- 
1.7.9.5

  parent reply	other threads:[~2012-09-02 19:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-02 19:57 [PATCH 0/6] emacs: customization for tag changes on archive Jani Nikula
2012-09-02 19:58 ` [PATCH 1/6] emacs: add helper for tag change list manipulation Jani Nikula
2012-09-03 11:33   ` Michal Nazarewicz
2012-09-03 12:06     ` Jani Nikula
2012-09-06 14:30       ` Tomi Ollila
2012-09-06 15:35         ` Jani Nikula
2012-09-02 19:58 ` [PATCH 2/6] emacs: fix notmuch-message-replied-tags defcustom type Jani Nikula
2012-09-02 19:58 ` [PATCH 3/6] emacs: use new tag change helper to mark messages as replied Jani Nikula
2012-09-02 19:58 ` [PATCH 4/6] emacs: add support for custom tag changes on message/thread archive Jani Nikula
2012-09-03 11:39   ` Michal Nazarewicz
2012-09-03 12:08     ` Jani Nikula
2012-09-03 13:31       ` Michal Nazarewicz
2012-09-02 19:58 ` [PATCH 5/6] emacs: add support for reversing notmuch-search-archive-thread tag changes Jani Nikula
2012-09-02 19:58 ` Jani Nikula [this message]
2012-09-03 11:41 ` [PATCH 0/6] emacs: customization for tag changes on archive Michal Nazarewicz
2012-09-04  7:02 ` 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=51fb66f6f49ef30a4dac2168aa5f8c270b84c2bd.1346614915.git.jani@nikula.org \
    --to=jani@nikula.org \
    --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).