From 59165d900de56d8c3cc486c9f327745c43ba5ba4 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Sun, 8 Apr 2012 04:56:00 +0100 Subject: [PATCH] Re: [PATCH 7/8] emacs: modify show tag functions to use new notmuch-tag interface --- 8e/8d1e7e6ebf86b7ef3225bd8989963cdbce5bad | 145 ++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 8e/8d1e7e6ebf86b7ef3225bd8989963cdbce5bad diff --git a/8e/8d1e7e6ebf86b7ef3225bd8989963cdbce5bad b/8e/8d1e7e6ebf86b7ef3225bd8989963cdbce5bad new file mode 100644 index 000000000..b49846751 --- /dev/null +++ b/8e/8d1e7e6ebf86b7ef3225bd8989963cdbce5bad @@ -0,0 +1,145 @@ +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 08DFF431FAF + for ; Sat, 7 Apr 2012 20:56:02 -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 zBNiUUdVCiRf for ; + Sat, 7 Apr 2012 20:56:01 -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 0E91C431FAE + for ; Sat, 7 Apr 2012 20:56:01 -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 1SGjEK-0002lY-MU; Sun, 08 Apr 2012 04:55:57 +0100 +Received: from 94.196.15.10.threembb.co.uk ([94.196.15.10] helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) + (envelope-from ) + id 1SGjEG-0004Aw-N9; Sun, 08 Apr 2012 04:55:56 +0100 +From: Mark Walters +To: Jameson Graef Rollins , + Notmuch Mail +Subject: Re: [PATCH 7/8] emacs: modify show tag functions to use new + notmuch-tag interface +In-Reply-To: <1333845338-22960-8-git-send-email-jrollins@finestructure.net> +References: <1333354853-25729-1-git-send-email-jrollins@finestructure.net> + <1333845338-22960-1-git-send-email-jrollins@finestructure.net> + <1333845338-22960-2-git-send-email-jrollins@finestructure.net> + <1333845338-22960-3-git-send-email-jrollins@finestructure.net> + <1333845338-22960-4-git-send-email-jrollins@finestructure.net> + <1333845338-22960-5-git-send-email-jrollins@finestructure.net> + <1333845338-22960-6-git-send-email-jrollins@finestructure.net> + <1333845338-22960-7-git-send-email-jrollins@finestructure.net> + <1333845338-22960-8-git-send-email-jrollins@finestructure.net> +User-Agent: Notmuch/0.12+96~g8f5ec3b (http://notmuchmail.org) Emacs/23.3.1 + (x86_64-pc-linux-gnu) +Date: Sun, 08 Apr 2012 04:56:00 +0100 +Message-ID: <87zkam6fn3.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 94.196.15.10 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: 6f44aeeeb60f972af20910723adb85d5 (of first 20000 bytes) +X-SpamAssassin-Score: -2.3 +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 -2.3 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 +X-QM-Scan-Virus: ClamAV says the message is clean +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: Sun, 08 Apr 2012 03:56:02 -0000 + + +On Sun, 08 Apr 2012, Jameson Graef Rollins wrote: +> The main change here is to modify argument parsing so as to not force +> tag-changes to be a list, and to let notmuch-tag handle prompting the +> user when required. doc strings are also updated and cleaned up. +> --- +> emacs/notmuch-show.el | 26 +++++++++++++++----------- +> 1 files changed, 15 insertions(+), 11 deletions(-) +> +> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +> index a4c313d..69bca02 100644 +> --- a/emacs/notmuch-show.el +> +++ b/emacs/notmuch-show.el +> @@ -1641,22 +1641,26 @@ TAG-CHANGES is a list of tag operations for `notmuch-tag'." +> (let* ((current-tags (notmuch-show-get-tags)) +> (new-tags (notmuch-update-tags current-tags tag-changes))) +> (unless (equal current-tags new-tags) +> - (apply 'notmuch-tag (notmuch-show-get-message-id) tag-changes) +> + (funcall 'notmuch-tag (notmuch-show-get-message-id) tag-changes) +> (notmuch-show-set-tags new-tags)))) +> +> -(defun notmuch-show-tag (&optional initial-input) +> - "Change tags for the current message, read input from the minibuffer." +> +(defun notmuch-show-tag (&optional tag-changes) +> + "Change tags for the current message. +> + +> +See `notmuch-tag' for information on the format of TAG-CHANGES." +> (interactive) +> - (let ((tag-changes (notmuch-read-tag-changes +> - initial-input (notmuch-show-get-message-id)))) +> - (apply 'notmuch-show-tag-message tag-changes))) +> + (setq tag-changes (funcall 'notmuch-tag (notmuch-show-get-message-id) tag-changes)) +> + (let* ((current-tags (notmuch-show-get-tags)) +> + (new-tags (notmuch-update-tags current-tags tag-changes))) +> + (unless (equal current-tags new-tags) +> + (notmuch-show-set-tags new-tags)))) + +Hi. If I am following this correctly the setq line funcalls notmuch tag +regardless of whether there will be a tag change. + +whereas the code from patch 8/8 +> -(defun notmuch-show-tag-message (&rest tag-changes) +> - "Change tags for the current message. +> - +> -TAG-CHANGES is a list of tag operations for `notmuch-tag'." +> - (let* ((current-tags (notmuch-show-get-tags)) +> - (new-tags (notmuch-update-tags current-tags tag-changes))) +> - (unless (equal current-tags new-tags) +> - (funcall 'notmuch-tag (notmuch-show-get-message-id) tag-changes) +> - (notmuch-show-set-tags new-tags)))) +> - + +seems to only do the funcall when the tags change. + +I think this is what is making the two tests fail: they count the number +of invocations of notmuch and in case there is one invocation of notmuch +show and one of notmuch tag -unread message-id, where before it was just +the single notmuch show. + +Best wishes + +Mark -- 2.26.2