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 721E0431FD2 for ; Sun, 29 Jan 2012 17:51:26 -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 5GcWvdz40L7d for ; Sun, 29 Jan 2012 17:51:25 -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 A697F431FBC for ; Sun, 29 Jan 2012 17:51:25 -0800 (PST) Received: by bke11 with SMTP id 11so942363bke.26 for ; Sun, 29 Jan 2012 17:51:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type; bh=IiAG+8nJprtMalIS+7Op9BqP6k34iSdKEcn8kuENXYw=; b=jO2afrIf4obKm6O6RSKQKxeTvJoYG2+m4EFn+FCSyiPhlxQw1EwXc+qBwN1LCEf8Ry AjMuN8uvTnYkPKYKdavrmFdiI3TekgXYXcfWv2BMgwAC/3ewUvFYuBrQbcVh/TdGqPtP H3k58o4xX0IKGD6rTLLRe5C8PJIaji0PU1QEM= Received: by 10.204.129.198 with SMTP id p6mr7459468bks.96.1327888284175; Sun, 29 Jan 2012 17:51:24 -0800 (PST) Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id 20sm23351692bkr.0.2012.01.29.17.51.23 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 29 Jan 2012 17:51:23 -0800 (PST) From: Dmitry Kurochkin To: Austin Clements Subject: Re: [PATCH 8/6] emacs: use message ids instead of thread id in `notmuch-show-operate-all' In-Reply-To: <20120129231120.GJ17991@mit.edu> References: <1327725684-5887-1-git-send-email-dmitry.kurochkin@gmail.com> <1327730348-6466-1-git-send-email-dmitry.kurochkin@gmail.com> <20120129231120.GJ17991@mit.edu> User-Agent: Notmuch/0.11+134~g7ddba9d (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Mon, 30 Jan 2012 05:50:14 +0400 Message-ID: <87y5sq6js9.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: notmuch@notmuchmail.org 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: Mon, 30 Jan 2012 01:51:26 -0000 EOn Sun, 29 Jan 2012 18:11:20 -0500, Austin Clements wrote: > Eighth in the increasingly inaccurately named six patch series... > > Quoth Dmitry Kurochkin on Jan 28 at 9:59 am: > > Before the change, `notmuch-show-operate-all' used thread id for > > "notmuch tag" search. This could result in tagging unexpected > > messages that were added to the thread after the notmuch-show buffer > > was created. The patch changes `notmuch-show-operate-all' to use ids > > of shown messages to fix this. > > Are you planning to roll this into your earlier patch? > I would prefer to leave it separate. > > --- > > emacs/notmuch-show.el | 23 ++++++++++++++++++++++- > > 1 files changed, 22 insertions(+), 1 deletions(-) > > > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > > index 2ca4d92..e606224 100644 > > --- a/emacs/notmuch-show.el > > +++ b/emacs/notmuch-show.el > > @@ -1170,6 +1170,15 @@ All currently available key bindings: > > (notmuch-show-move-to-message-top) > > t)) > > > > +(defun notmuch-show-mapc (function) > > + "Iterate through all messages with > > +`notmuch-show-goto-message-next' and call `function' for side > > +effects." > > `function' should be FUNCTION. > done > > + (save-excursion > > + (goto-char (point-min)) > > + (loop do (funcall function) > > + while (notmuch-show-goto-message-next)))) > > + > > ;; Functions relating to the visibility of messages and their > > ;; components. > > > > @@ -1222,6 +1231,18 @@ Some useful entries are: > > "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 currently shown messages." > > "currently shown" could mean visible on the screen, which is not what > you mean. You also don't mean "open messages". Maybe "Return all > message ids of messages in this show buffer"? > Changed to "messages in the current thread". That is consistent with other docstrings in notmuch-show.el. > > + (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 currently shown > > +messages." > > Same. > fixed Regards, Dmitry > > + (mapconcat 'identity (notmuch-show-get-messages-ids) " or ")) > > + > > ;; dme: Would it make sense to use a macro for many of these? > > > > (defun notmuch-show-get-filename () > > @@ -1496,7 +1517,7 @@ i.e. a list of tags to change with '+' and '-' prefixes." > > `Changed-tags' is a list of tag operations for \"notmuch tag\", > > i.e. a list of tags to change with '+' and '-' prefixes." > > (interactive (notmuch-select-tags-with-completion nil notmuch-show-thread-id)) > > - (apply 'notmuch-tag notmuch-show-thread-id changed-tags) > > + (apply 'notmuch-tag (notmuch-show-get-messages-ids-search) changed-tags) > > (save-excursion > > (goto-char (point-min)) > > (loop do (let* ((current-tags (notmuch-show-get-tags))