From f19a4b6b14e8af26dcc07c61e57ec5fbdeb0566a Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Thu, 6 Sep 2012 18:32:42 +0300 Subject: [PATCH] [PATCH v2 6/6] emacs: add support for reversing notmuch-show-mark-read tag changes --- 24/86386143afb15a63c3c39b760593168422bc79 | 128 ++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 24/86386143afb15a63c3c39b760593168422bc79 diff --git a/24/86386143afb15a63c3c39b760593168422bc79 b/24/86386143afb15a63c3c39b760593168422bc79 new file mode 100644 index 000000000..107a00e39 --- /dev/null +++ b/24/86386143afb15a63c3c39b760593168422bc79 @@ -0,0 +1,128 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 2F7CF431FDA + for ; Thu, 6 Sep 2012 08:33:06 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 6GDO5JZTcUZB for ; + Thu, 6 Sep 2012 08:33:05 -0700 (PDT) +Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com + [209.85.217.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 31D26431FAE + for ; Thu, 6 Sep 2012 08:33:05 -0700 (PDT) +Received: by mail-lb0-f181.google.com with SMTP id gk1so1344042lbb.26 + for ; Thu, 06 Sep 2012 08:33:04 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=google.com; s=20120113; + h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references + :in-reply-to:references:x-gm-message-state; + bh=NAotDv459hN0jsIRemhOkbS9fpnJEIKpiGQ01BiMWyI=; + b=e6/Bmbmr+tB/1CMP74D7L2yQcqd9dlGD2+9lUPOtJ3OAj9oohxSbFDCcVW7lQBboBB + 5McEjlgWXLPQBetiamjQpINFVMnn/VPQsNne40yCZngDFzaeq9FAoNRezh8mdHowUCvT + WfgR8V9Q+NU6EGwzy6n5QbO57o2rXAznOpqOyJjCZkHD9VwIMLvGb+8MKEKFfZ4pKDPJ + ZCMIVRnoQEUQr73MJtzOGudbIZ3LMLYF/+wvuUeivig3tXEdI+U5ztsFQvi9Hvw90knA + qwtf+KyR0sKrNsTBhBWGdnRr/3TboVTLKR17lPXRwiMA/NyRxZI7zCoqH3pclD3VQm+D + wvFQ== +Received: by 10.112.86.232 with SMTP id s8mr1017437lbz.117.1346945584739; + Thu, 06 Sep 2012 08:33:04 -0700 (PDT) +Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi. + [80.223.81.27]) + by mx.google.com with ESMTPS id p7sm488542lbg.17.2012.09.06.08.33.03 + (version=SSLv3 cipher=OTHER); Thu, 06 Sep 2012 08:33:04 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH v2 6/6] emacs: add support for reversing + notmuch-show-mark-read tag changes +Date: Thu, 6 Sep 2012 18:32:42 +0300 +Message-Id: + <8377ff5c19587cc90bbde9e603ae4f5c3d62d086.1346945257.git.jani@nikula.org> +X-Mailer: git-send-email 1.7.9.5 +In-Reply-To: +References: +In-Reply-To: +References: +X-Gm-Message-State: + ALoCoQkL/MvFQ4n5OEBFZlQOePsSxESxL0FLCBLD2fGjvf68SrpNt4oVVCaKB41u3BSanPlFc8FL +Cc: Tomi Ollila +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Thu, 06 Sep 2012 15:33:06 -0000 + +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 + -- 2.26.2