From: Jani Nikula Date: Sun, 2 Sep 2012 19:58:05 +0000 (+0300) Subject: [PATCH 6/6] emacs: add support for reversing notmuch-show-mark-read tag changes X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=f675233900240b75b6972eaa785560ed445deaca;p=notmuch-archives.git [PATCH 6/6] emacs: add support for reversing notmuch-show-mark-read tag changes --- diff --git a/dc/0e699fe6a6eccefa1dda280f8fb0054fac5426 b/dc/0e699fe6a6eccefa1dda280f8fb0054fac5426 new file mode 100644 index 000000000..48a1886da --- /dev/null +++ b/dc/0e699fe6a6eccefa1dda280f8fb0054fac5426 @@ -0,0 +1,127 @@ +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 29AB5431FC0 + for ; Sun, 2 Sep 2012 12:58:29 -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 VbvnDhdw481f for ; + Sun, 2 Sep 2012 12:58:28 -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 2FC6A431FB6 + for ; Sun, 2 Sep 2012 12:58:28 -0700 (PDT) +Received: by mail-lb0-f181.google.com with SMTP id gk1so2402453lbb.26 + for ; Sun, 02 Sep 2012 12:58:27 -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=Qrg489bL2xY5Cua7AWq9q2DK+ONu4nmyclwaCmYaMf9hzWicgsxWwNCmlbF908NrBK + /cVIV6+mwRjwVvh/pKXdeTHWoVDks2775fIPpLWMyRFS4dhqMh7+lKWr7Tm2Bnf008x/ + 8z3FDdvcvQDg5wt4+j79KxOQy4fVfLOVsthVodWl6f0ikvFDMNhPKPZ2v1/IV/Jp9gDB + VDYxYxPVF/tmQU/ONxpxTk4TUXavLrvICM+QRqcWbras9nHa3NWlstN3znnRpOCWiNn9 + BdWKGyA9O539igqaWSNyrgIeKeRzFeEkjhlPWmHnj6qsJrZqaki+jcEqJlnb/x8X1/4q + bIfQ== +Received: by 10.152.131.42 with SMTP id oj10mr12023899lab.49.1346615907840; + Sun, 02 Sep 2012 12:58:27 -0700 (PDT) +Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi. + [80.223.81.27]) + by mx.google.com with ESMTPS id r1sm2750731lbk.12.2012.09.02.12.58.26 + (version=SSLv3 cipher=OTHER); Sun, 02 Sep 2012 12:58:27 -0700 (PDT) +From: Jani Nikula +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 +Message-Id: + <51fb66f6f49ef30a4dac2168aa5f8c270b84c2bd.1346614915.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: + ALoCoQljXPaWT7D3UKYRhy+eS8B5s82Vkv03rWRSpIBQnIJBn2aX240S3EeJkfkvQiGQtKSnThTa +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: Sun, 02 Sep 2012 19:58:29 -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 +