From: Ethan Glasser-Camp Date: Tue, 16 Oct 2012 02:18:12 +0000 (+2000) Subject: Re: [PATCH v2 4/6] emacs: add optional predicate arg to `notmuch-show-mapc' X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=f50b58d5a6eb6e01128cbd36c578cbadab1a2c59;p=notmuch-archives.git Re: [PATCH v2 4/6] emacs: add optional predicate arg to `notmuch-show-mapc' --- diff --git a/72/e6e67dc8f757f748bc3bdeb42fb7ec21826edd b/72/e6e67dc8f757f748bc3bdeb42fb7ec21826edd new file mode 100644 index 000000000..135781957 --- /dev/null +++ b/72/e6e67dc8f757f748bc3bdeb42fb7ec21826edd @@ -0,0 +1,106 @@ +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 D9DB1431FB6 + for ; Mon, 15 Oct 2012 19:18:20 -0700 (PDT) +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 FM7Hhw4-13d2 for ; + Mon, 15 Oct 2012 19:18:17 -0700 (PDT) +Received: from mail-qa0-f46.google.com (mail-qa0-f46.google.com + [209.85.216.46]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id DFE5B431FAE + for ; Mon, 15 Oct 2012 19:18:16 -0700 (PDT) +Received: by mail-qa0-f46.google.com with SMTP id c26so2300548qad.5 + for ; Mon, 15 Oct 2012 19:18:15 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:in-reply-to:references:user-agent:date + :message-id:mime-version:content-type; + bh=SWR65n0tLZFcxPVAQ0AXrHnCvOkg1foQtkMcCBlZ2Ps=; + b=z9a8kiJusZqkGVOh4fJog3ZCers/Mlybf7G+IoRVKLsJtt845msOMUJszAllJ8Um0L + IB9BUMG3ZnLFaDPEwCpZdPTk1jiENhF9u1XVnO3MUET+33l7xCM3KEeYEmfemjjtLmQL + nWcfwPu440BCPzLgcYvIyw+g1MmI4Np+NQRLkdjaFvqqpNqL2yx7nQ6IIwnPabX5SPns + VACrYSbX9dF3hBGvUNF6kj/GhfR5Rw97in83wIA7Nj9fYp4J/duCMtGEsf0GE483sDiE + jF20ToQLS4K4l6FE/umt2BkebSGBrjMjZ81nRP2cyr5/mNk+ypE133zO+0/8XHl5kiJb + gtgQ== +Received: by 10.49.130.234 with SMTP id oh10mr32205530qeb.42.1350353895215; + Mon, 15 Oct 2012 19:18:15 -0700 (PDT) +Received: from smtp.gmail.com (p70-80.acedsl.com. [66.114.70.80]) + by mx.google.com with ESMTPS id ck18sm17218493qab.7.2012.10.15.19.18.13 + (version=TLSv1/SSLv3 cipher=OTHER); + Mon, 15 Oct 2012 19:18:14 -0700 (PDT) +From: Ethan Glasser-Camp +To: Pieter Praet , David Bremner , + Dmitry Kurochkin +Subject: Re: [PATCH v2 4/6] emacs: add optional predicate arg to + `notmuch-show-mapc' +In-Reply-To: <1330122640-18895-5-git-send-email-pieter@praet.org> +References: <87wr7xqpuf.fsf@rocinante.cs.unb.ca> + <1330122640-18895-1-git-send-email-pieter@praet.org> + <1330122640-18895-5-git-send-email-pieter@praet.org> +User-Agent: Notmuch/0.14+45~g6ea9330 (http://notmuchmail.org) Emacs/23.3.1 + (x86_64-pc-linux-gnu) +Date: Mon, 15 Oct 2012 22:18:12 -0400 +Message-ID: <87r4oz88ij.fsf@betacantrips.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +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: Tue, 16 Oct 2012 02:18:21 -0000 + +Pieter Praet writes: + +> * emacs/notmuch-show.el (notmuch-show-mapc): +> +> If provided with optional argument PREDICATE, only call +> FUNCTION if calling PREDICATE returns non-nil. +> +> Also correct original docstring: 's/thread/buffer/'. +> --- + +This patch was marked stale, but isn't. + +> -(defun notmuch-show-mapc (function) +> - "Iterate through all messages in the current thread with +> +(defun notmuch-show-mapc (function &optional predicate) +> + "Iterate through all messages in the current buffer with +> `notmuch-show-goto-message-next' and call FUNCTION for side +> -effects." +> +effects. +> + +> +If provided with optional argument PREDICATE, only call +> +FUNCTION if calling PREDICATE returns non-nil." +> (save-excursion +> (goto-char (point-min)) +> - (loop do (funcall function) +> + (loop do (if predicate +> + (if (funcall predicate) +> + (funcall function)) +> + (funcall function)) + +I don't like the way this if-structure looks, since I have to squint to +see whether the "else" clause matches the inner or the outer "if". Maybe +change the inner "if" to a "when" or an "and"? + +Ethan +