From: Pieter Praet Date: Thu, 23 Feb 2012 23:09:12 +0000 (+0100) Subject: [PATCH 4/6] emacs: add predicate arg to `notmuch-show-mapc' X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=12308dc93b8c8337f14125577768b9486fd5adb8;p=notmuch-archives.git [PATCH 4/6] emacs: add predicate arg to `notmuch-show-mapc' --- diff --git a/1a/a4a29a0d68f7a86ee23e6f6f8749d730e80a73 b/1a/a4a29a0d68f7a86ee23e6f6f8749d730e80a73 new file mode 100644 index 000000000..edcf848a8 --- /dev/null +++ b/1a/a4a29a0d68f7a86ee23e6f6f8749d730e80a73 @@ -0,0 +1,125 @@ +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 2BB60431FC2 + for ; Thu, 23 Feb 2012 15:11:47 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +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 42xN05KBSdAo for ; + Thu, 23 Feb 2012 15:11:45 -0800 (PST) +Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com + [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id C9F80431FC3 + for ; Thu, 23 Feb 2012 15:11:39 -0800 (PST) +Received: by mail-wi0-f181.google.com with SMTP id hi8so1241599wib.26 + for ; Thu, 23 Feb 2012 15:11:39 -0800 (PST) +Received-SPF: pass (google.com: domain of pieter@praet.org designates + 10.180.79.229 as permitted sender) client-ip=10.180.79.229; +Authentication-Results: mr.google.com; + spf=pass (google.com: domain of pieter@praet.org + designates 10.180.79.229 as permitted sender) + smtp.mail=pieter@praet.org +Received: from mr.google.com ([10.180.79.229]) + by 10.180.79.229 with SMTP id m5mr822997wix.6.1330038699483 (num_hops = + 1); Thu, 23 Feb 2012 15:11:39 -0800 (PST) +MIME-Version: 1.0 +Received: by 10.180.79.229 with SMTP id m5mr667007wix.6.1330038699413; + Thu, 23 Feb 2012 15:11:39 -0800 (PST) +Received: from localhost ([109.131.181.26]) + by mx.google.com with ESMTPS id gd8sm7407101wib.2.2012.02.23.15.11.38 + (version=TLSv1/SSLv3 cipher=OTHER); + Thu, 23 Feb 2012 15:11:39 -0800 (PST) +From: Pieter Praet +To: David Bremner , + Dmitry Kurochkin +Subject: [PATCH 4/6] emacs: add predicate arg to `notmuch-show-mapc' +Date: Fri, 24 Feb 2012 00:09:12 +0100 +Message-Id: <1330038554-10347-4-git-send-email-pieter@praet.org> +X-Mailer: git-send-email 1.7.8.1 +In-Reply-To: <878vjtqhcg.fsf@praet.org> +References: <878vjtqhcg.fsf@praet.org> +X-Gm-Message-State: + ALoCoQnQ/373VJmaUm6gcc215DUmyqhbWLyZngUz/fQHJ2K8yBQ7DFvtnLa+5WwYgvdDJILnMQpJ +Cc: Notmuch Mail +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, 23 Feb 2012 23:11:47 -0000 + +* emacs/notmuch-show.el + + (notmuch-show-mapc): + Only call FUNCTION if new argument PREDICATE is satisfied. + Also correct original docstring: 's/thread/buffer/'. + + (notmuch-show-get-messages-ids): + Update wrt changes to `notmuch-show-mapc'. + + (notmuch-show-tag-all): + Update wrt changes to `notmuch-show-mapc'. +--- + emacs/notmuch-show.el | 15 ++++++++------- + 1 files changed, 8 insertions(+), 7 deletions(-) + +diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +index aa9ccee..5fc0e43 100644 +--- a/emacs/notmuch-show.el ++++ b/emacs/notmuch-show.el +@@ -1272,13 +1272,14 @@ (defun notmuch-show-goto-message-previous () + (notmuch-show-move-to-message-top) + t)) + +-(defun notmuch-show-mapc (function) +- "Iterate through all messages in the current thread with +-`notmuch-show-goto-message-next' and call FUNCTION for side +-effects." ++(defun notmuch-show-mapc (predicate function) ++ "Iterate through all messages in the current buffer with ++`notmuch-show-goto-message-next'. If PREDICATE is satisfied, ++call FUNCTION for side effects." + (save-excursion + (goto-char (point-min)) +- (loop do (funcall function) ++ (loop do (if (eval predicate) ++ (funcall function)) + while (notmuch-show-goto-message-next)))) + + ;; Functions relating to the visibility of messages and their +@@ -1336,7 +1337,7 @@ (defun notmuch-show-get-message-id () + (defun notmuch-show-get-messages-ids () + "Return all message ids of messages in the current thread." + (let ((message-ids)) +- (notmuch-show-mapc ++ (notmuch-show-mapc t + (lambda () (push (notmuch-show-get-message-id) message-ids))) + message-ids)) + +@@ -1633,7 +1634,7 @@ (defun notmuch-show-tag-all (&rest tag-changes) + TAG-CHANGES is a list of tag operations for `notmuch-tag'." + (interactive (notmuch-read-tag-changes nil notmuch-show-thread-id)) + (apply 'notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes) +- (notmuch-show-mapc ++ (notmuch-show-mapc t + (lambda () + (let* ((current-tags (notmuch-show-get-tags)) + (new-tags (notmuch-update-tags current-tags tag-changes))) +-- +1.7.8.1 +