From: Mark Walters Date: Wed, 21 Mar 2012 01:36:44 +0000 (+0000) Subject: Re: [PATCH v2 5/6] emacs: simplify `notmuch-show-get-messages-ids{, -search}' X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=e5d755606d996b35b5583cb4958816971cef31c2;p=notmuch-archives.git Re: [PATCH v2 5/6] emacs: simplify `notmuch-show-get-messages-ids{, -search}' --- diff --git a/92/712273080bd9d4a9d1d958b7aaf85b50426e27 b/92/712273080bd9d4a9d1d958b7aaf85b50426e27 new file mode 100644 index 000000000..5c4413915 --- /dev/null +++ b/92/712273080bd9d4a9d1d958b7aaf85b50426e27 @@ -0,0 +1,148 @@ +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 AFE3B431FD0 + for ; Tue, 20 Mar 2012 18:36:35 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -1.098 +X-Spam-Level: +X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 tbEbMnzIZw5X for ; + Tue, 20 Mar 2012 18:36:35 -0700 (PDT) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id D9B25431FC0 + for ; Tue, 20 Mar 2012 18:36:34 -0700 (PDT) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1SAATY-0000U6-5j; Wed, 21 Mar 2012 01:36:32 +0000 +Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223] + helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) + (envelope-from ) + id 1SAATX-0001lM-PO; Wed, 21 Mar 2012 01:36:31 +0000 +From: Mark Walters +To: Pieter Praet , David Bremner , + Dmitry Kurochkin +Subject: Re: [PATCH v2 5/6] emacs: simplify `notmuch-show-get-messages-ids{, + -search}' +In-Reply-To: <1330122640-18895-6-git-send-email-pieter@praet.org> +References: <87wr7xqpuf.fsf@rocinante.cs.unb.ca> + <1330122640-18895-1-git-send-email-pieter@praet.org> + <1330122640-18895-6-git-send-email-pieter@praet.org> +User-Agent: Notmuch/0.12+67~g3bd579a (http://notmuchmail.org) Emacs/23.3.1 + (x86_64-pc-linux-gnu) +Date: Wed, 21 Mar 2012 01:36:44 +0000 +Message-ID: <87sjh2wx8z.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 94.192.233.223 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: b6a004674a0782afab6e7455d1e8217e (of first 20000 bytes) +X-SpamAssassin-Score: -1.8 +X-SpamAssassin-SpamBar: - +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored -1.8 points. + Summary of the scoring: + * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, + * medium trust + * [138.37.6.40 listed in list.dnswl.org] + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay + * domain + * 0.5 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is clean +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: Wed, 21 Mar 2012 01:36:35 -0000 + +On Fri, 24 Feb 2012 23:30:39 +0100, Pieter Praet wrote: +> * emacs/notmuch-show.el +> +> (notmuch-show-get-messages-ids): +> If provided with optional arg SEPARATOR, return a string consisting +> of all Message-Id's, separated by SEPARATOR. Also improve original +> docstring wrt default return value. +> +> (notmuch-show-get-messages-ids-search): +> Removed, as its functionality is now in `notmuch-show-get-messages-ids'. +> +> (notmuch-show-tag-all): +> Call `notmuch-show-get-messages-ids' with SEPARATOR arg instead of +> `notmuch-show-get-messages-ids-search'. +> --- +> emacs/notmuch-show.el | 18 +++++++++--------- +> 1 files changed, 9 insertions(+), 9 deletions(-) +> +> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +> index 6adbdc0..05606fc 100644 +> --- a/emacs/notmuch-show.el +> +++ b/emacs/notmuch-show.el +> @@ -1339,17 +1339,17 @@ (defun notmuch-show-get-message-id () +> "Return the message id of the current message." +> (concat "id:\"" (notmuch-show-get-prop :id) "\"")) +> +> -(defun notmuch-show-get-messages-ids () +> - "Return all message ids of messages in the current thread." +> +(defun notmuch-show-get-messages-ids (&optional separator) +> + "Return a list of Message-Id's of all messages in the current buffer. +> + +> +If provided with optional argument SEPARATOR, return a string +> +instead, consisting of all Message-Id's separated by SEPARATOR." +> (let ((message-ids)) +> (notmuch-show-mapc +> (lambda () (push (notmuch-show-get-message-id) message-ids))) +> - message-ids)) +> - +> -(defun notmuch-show-get-messages-ids-search () +> - "Return a search string for all message ids of messages in the +> -current thread." +> - (mapconcat 'identity (notmuch-show-get-messages-ids) " or ")) +> + (if separator +> + (mapconcat 'identity message-ids separator) +> + message-ids))) +> +> ;; dme: Would it make sense to use a macro for many of these? +> +> @@ -1638,7 +1638,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) +> + (apply 'notmuch-tag (notmuch-show-get-messages-ids " or ") tag-changes) +> (notmuch-show-mapc +> (lambda () +> (let* ((current-tags (notmuch-show-get-tags)) + +I like the use of separator rather than hard-wiring " or ". My personal +preference would be to make that change but keep the two functions +separate (my "C"ness makes me like functions that have clear return +types!) But I am happy with the change too. + +Best wishes + +Mark + +