--- /dev/null
+Return-Path: <dmitry.kurochkin@gmail.com>\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 C2EE9431FAF\r
+ for <notmuch@notmuchmail.org>; Wed, 8 Feb 2012 08:50:12 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_FROM=0.001, 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 EAKr1diHCgEL for <notmuch@notmuchmail.org>;\r
+ Wed, 8 Feb 2012 08:50:12 -0800 (PST)\r
+Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com\r
+ [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 23232431FAE\r
+ for <notmuch@notmuchmail.org>; Wed, 8 Feb 2012 08:50:12 -0800 (PST)\r
+Received: by bkcjk7 with SMTP id jk7so798174bkc.26\r
+ for <notmuch@notmuchmail.org>; Wed, 08 Feb 2012 08:50:09 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+ h=from:to:subject:date:message-id:x-mailer;\r
+ bh=x8A2tivaQCvZBXg70cTV1JoFcEumr7yZNVwCXMcNkfg=;\r
+ b=Z96Mxbb4BrY850bHCL3vdahN0XOzwwthUQB1YNTOaLJ2QmSbnAaPXKm6A0RRghkiQN\r
+ V7nJgsunDy8xGYh6o05RdqB3J1HkVZz2JWsx7Th+ZXT0mRd5kz+9+q66UqM2PY06Kp65\r
+ 6wqEfpE8AXo6qbC+4tQyPmQJ45Yz99cM97MSI=\r
+Received: by 10.205.120.132 with SMTP id fy4mr12882370bkc.23.1328719809241;\r
+ Wed, 08 Feb 2012 08:50:09 -0800 (PST)\r
+Received: from localhost ([91.144.186.21])\r
+ by mx.google.com with ESMTPS id sp6sm6222856bkb.2.2012.02.08.08.50.08\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Wed, 08 Feb 2012 08:50:08 -0800 (PST)\r
+From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: cleanup and simplify `notmuch-show-archive-thread' and\r
+ related functions\r
+Date: Wed, 8 Feb 2012 20:48:51 +0400\r
+Message-Id: <1328719731-13402-1-git-send-email-dmitry.kurochkin@gmail.com>\r
+X-Mailer: git-send-email 1.7.9\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: Wed, 08 Feb 2012 16:50:12 -0000\r
+\r
+Recent changes in notmuch-show tagging introduced some code\r
+duplication. The patch cleanups and simplifies\r
+`notmuch-show-archive-thread' function by using\r
+`notmuch-show-tag-all', no longer used function are removed. After\r
+the change, `notmuch-show-archive-thread' function becomes symmetric\r
+with `notmuch-show-archive-message'.\r
+\r
+A side effect of these changes is that `notmuch-show-archive-thread'\r
+no longer calls "notmuch tag" for each message in the thread.\r
+---\r
+ emacs/notmuch-show.el | 25 ++-----------------------\r
+ 1 files changed, 2 insertions(+), 23 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index faa9f9b..8199f56 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -1598,26 +1598,6 @@ argument, hide all of the messages."\r
+ (interactive)\r
+ (backward-button 1))\r
+ \r
+-(defun notmuch-show-tag-thread-internal (tag &optional remove)\r
+- "Add tag to the current set of messages.\r
+-\r
+-If the remove switch is given, tags will be removed instead of\r
+-added."\r
+- (goto-char (point-min))\r
+- (let ((op (if remove "-" "+")))\r
+- (loop do (notmuch-show-tag-message (concat op tag))\r
+- until (not (notmuch-show-goto-message-next)))))\r
+-\r
+-(defun notmuch-show-add-tag-thread (tag)\r
+- "Add tag to all messages in the current thread."\r
+- (interactive)\r
+- (notmuch-show-tag-thread-internal tag))\r
+-\r
+-(defun notmuch-show-remove-tag-thread (tag)\r
+- "Remove tag from all messages in the current thread."\r
+- (interactive)\r
+- (notmuch-show-tag-thread-internal tag t))\r
+-\r
+ (defun notmuch-show-next-thread (&optional show-next)\r
+ "Move to the next item in the search results, if any."\r
+ (interactive "P")\r
+@@ -1645,9 +1625,8 @@ 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
+- (if unarchive\r
+- (notmuch-show-add-tag-thread "inbox")\r
+- (notmuch-show-remove-tag-thread "inbox")))\r
++ (let ((op (if unarchive "+" "-")))\r
++ (notmuch-show-tag-all (concat op "inbox"))))\r
+ \r
+ (defun notmuch-show-archive-thread-then-next ()\r
+ "Archive each message in thread, then show next thread from search."\r
+-- \r
+1.7.9\r
+\r