--- /dev/null
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id D6104431FB6\r
+ for <notmuch@notmuchmail.org>; Sun, 2 Sep 2012 12:58:24 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id n-NGdqxOU7Py for <notmuch@notmuchmail.org>;\r
+ Sun, 2 Sep 2012 12:58:22 -0700 (PDT)\r
+Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com\r
+ [209.85.217.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 81F5D431FC2\r
+ for <notmuch@notmuchmail.org>; Sun, 2 Sep 2012 12:58:22 -0700 (PDT)\r
+Received: by mail-lb0-f181.google.com with SMTP id gk1so2402453lbb.26\r
+ for <notmuch@notmuchmail.org>; Sun, 02 Sep 2012 12:58:22 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=google.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references\r
+ :in-reply-to:references:x-gm-message-state;\r
+ bh=KvsPlCuF3X1Mzei7UwbBUt4hBv7Iv6yroufjbejmM9Q=;\r
+ b=Ka5jiLe0O5HL1adLVZ1eBpPoTnA5y9WpXWZstnb3B971VaPOSTFrd3ORRvyUrhfKFn\r
+ fcIxBE1QY+7SbBnp8EfTFsBRwPifVoqY+cTnpfXFH2AnrmUrKqlT+qxVSBjUl1x65FEt\r
+ acGmPZVcP0yuP+BVTrmwALJ0/sBMcImJJ3xWO8PoeVvlKQxKvcd5/fR62xAnYHMI9lgs\r
+ M1xu7Yx2horVJdU+5P8pv7WKyUfmlbq0U2KFSViTK854zbU8qTix7xO12ETjkQ3nPKi4\r
+ 06Ih06qpnQW8OSPytWn+hhQ2biR0mijJ8/9KT2mIONXM1ELDXv67dlCGZ/s6+OJ0q5rd\r
+ zjBA==\r
+Received: by 10.152.131.68 with SMTP id ok4mr12081943lab.47.1346615902161;\r
+ Sun, 02 Sep 2012 12:58:22 -0700 (PDT)\r
+Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi.\r
+ [80.223.81.27])\r
+ by mx.google.com with ESMTPS id ly17sm11378265lab.2.2012.09.02.12.58.20\r
+ (version=SSLv3 cipher=OTHER); Sun, 02 Sep 2012 12:58:21 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 4/6] emacs: add support for custom tag changes on\r
+ message/thread archive\r
+Date: Sun, 2 Sep 2012 22:58:03 +0300\r
+Message-Id:\r
+ <0907a84d74600df18b8663c28c26f9f7bc2f31c2.1346614915.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.9.5\r
+In-Reply-To: <cover.1346614915.git.jani@nikula.org>\r
+References: <cover.1346614915.git.jani@nikula.org>\r
+In-Reply-To: <cover.1346614915.git.jani@nikula.org>\r
+References: <cover.1346614915.git.jani@nikula.org>\r
+X-Gm-Message-State:\r
+ ALoCoQkjQv3B4VwBwpb5TliQ0kvPnQCFnWH1bGo2l8OYmZaCgsPoKnf98rQLXU1oGazXL47teNIe\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 02 Sep 2012 19:58:25 -0000\r
+\r
+Add support for customization of the tag changes that are applied when\r
+a message or a thread is archived. Instead of hard-coded removal of\r
+the "inbox" tag, the user can now specify a list of tag changes to\r
+perform.\r
+---\r
+ emacs/notmuch-lib.el | 14 ++++++++++++++\r
+ emacs/notmuch-show.el | 29 +++++++++++++++++------------\r
+ emacs/notmuch.el | 12 ++++++++++--\r
+ 3 files changed, 41 insertions(+), 14 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+index 900235b..20d990d 100644\r
+--- a/emacs/notmuch-lib.el\r
++++ b/emacs/notmuch-lib.el\r
+@@ -82,6 +82,20 @@\r
+ :type '(alist :key-type string :value-type string)\r
+ :group 'notmuch-hello)\r
+ \r
++(defcustom notmuch-archive-tags '("-inbox")\r
++ "List of tag changes to apply to a message or a thread when it is archived.\r
++\r
++Tags starting with \"+\" (or not starting with either \"+\" or\r
++\"-\") in the list will be added, and tags starting with \"-\"\r
++will be removed from the message or thread being archived.\r
++\r
++For example, if you wanted to remove an \"inbox\" tag and add an\r
++\"archived\" tag, you would set:\r
++ (\"-inbox\" \"+archived\")"\r
++ :type '(repeat string)\r
++ :group 'notmuch-search\r
++ :group 'notmuch-show)\r
++\r
+ (defvar notmuch-folders nil\r
+ "Deprecated name for what is now known as `notmuch-saved-searches'.")\r
+ \r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index ce5ea6f..e701aec 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -1748,18 +1748,20 @@ argument, hide all of the messages."\r
+ (defun notmuch-show-archive-thread (&optional unarchive)\r
+ "Archive each message in thread.\r
+ \r
+-Archive each message currently shown by removing the \"inbox\"\r
+-tag from each. If a prefix argument is given, the messages will\r
+-be \"unarchived\" (ie. the \"inbox\" tag will be added instead of\r
+-removed).\r
++Archive each message currently shown by applying the tag changes\r
++in `notmuch-archive-tags' to each (remove the \"inbox\" tag by\r
++default). If a prefix argument is given, the messages will be\r
++\"unarchived\", i.e. the tag changes in `notmuch-archive-tags'\r
++will be reversed.\r
+ \r
+ Note: This command is safe from any race condition of new messages\r
+ being delivered to the same thread. It does not archive the\r
+ entire thread, but only the messages shown in the current\r
+ buffer."\r
+ (interactive "P")\r
+- (let ((op (if unarchive "+" "-")))\r
+- (notmuch-show-tag-all (concat op "inbox"))))\r
++ (when notmuch-archive-tags\r
++ (notmuch-show-tag-all\r
++ (notmuch-tag-change-list notmuch-archive-tags unarchive))))\r
+ \r
+ (defun notmuch-show-archive-thread-then-next ()\r
+ "Archive all messages in the current buffer, then show next thread from search."\r
+@@ -1774,14 +1776,17 @@ buffer."\r
+ (notmuch-show-next-thread))\r
+ \r
+ (defun notmuch-show-archive-message (&optional unarchive)\r
+- "Archive the current message (remove \"inbox\" tag).\r
++ "Archive the current message.\r
+ \r
+-If a prefix argument is given, the message will be\r
+-\"unarchived\" (ie. the \"inbox\" tag will be added instead of\r
+-removed)."\r
++Archive the current message by applying the tag changes in\r
++`notmuch-archive-tags' to it (remove the \"inbox\" tag by\r
++default). If a prefix argument is given, the message will be\r
++\"unarchived\", i.e. the tag changes in `notmuch-archive-tags'\r
++will be reversed."\r
+ (interactive "P")\r
+- (let ((op (if unarchive "+" "-")))\r
+- (notmuch-show-tag-message (concat op "inbox"))))\r
++ (when notmuch-archive-tags\r
++ (apply 'notmuch-show-tag-message\r
++ (notmuch-tag-change-list notmuch-archive-tags unarchive))))\r
+ \r
+ (defun notmuch-show-archive-message-then-next-or-exit ()\r
+ "Archive the current message, then show the next open message in the current thread.\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index 1c43d3e..64caa3e 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -594,11 +594,19 @@ See `notmuch-tag' for information on the format of TAG-CHANGES."\r
+ (notmuch-search-tag "-"))\r
+ \r
+ (defun notmuch-search-archive-thread ()\r
+- "Archive the currently selected thread (remove its \"inbox\" tag).\r
++ "Archive the currently selected thread.\r
++\r
++Archive each message in the currently selected thread by applying\r
++the tag changes in `notmuch-archive-tags' to each (remove the\r
++\"inbox\" tag by default). If a prefix argument is given, the\r
++messages will be \"unarchived\" (i.e. the tag changes in\r
++`notmuch-archive-tags' will be reversed).\r
+ \r
+ This function advances the next thread when finished."\r
+ (interactive)\r
+- (notmuch-search-tag '("-inbox"))\r
++ (when notmuch-archive-tags\r
++ (notmuch-search-tag\r
++ (notmuch-tag-change-list notmuch-archive-tags)))\r
+ (notmuch-search-next-thread))\r
+ \r
+ (defun notmuch-search-update-result (result &optional pos)\r
+-- \r
+1.7.9.5\r
+\r