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