From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 3B038429E57 for ; Sun, 29 Jan 2012 15:12:11 -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 mxfpL+cXU-Mn for ; Sun, 29 Jan 2012 15:12:10 -0800 (PST) Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU [18.9.25.14]) by olra.theworths.org (Postfix) with ESMTP id A7761429E54 for ; Sun, 29 Jan 2012 15:12:10 -0800 (PST) X-AuditID: 1209190e-b7f7c6d0000008c3-cd-4f25d24aec92 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP id 33.72.02243.A42D52F4; Sun, 29 Jan 2012 18:12:10 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q0TNC9WB020541; Sun, 29 Jan 2012 18:12:10 -0500 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q0TNC8bB024487 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Sun, 29 Jan 2012 18:12:09 -0500 (EST) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) (envelope-from ) id 1Rrdu4-00008t-JZ; Sun, 29 Jan 2012 18:11:20 -0500 Date: Sun, 29 Jan 2012 18:11:20 -0500 From: Austin Clements To: Dmitry Kurochkin Subject: Re: [PATCH 8/6] emacs: use message ids instead of thread id in `notmuch-show-operate-all' Message-ID: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1327730348-6466-1-git-send-email-dmitry.kurochkin@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHIsWRmVeSWpSXmKPExsUixG6nrut1SdXfoG2+kMXVrf3sFtdvzmR2 YPLYOesuu8ezVbeYA5iiuGxSUnMyy1KL9O0SuDIaP/kXtItVnLj3kLGB8Z5gFyMHh4SAicSq A7FdjJxAppjEhXvr2UBsIYF9jBKrD2VB2BsYJa78jYewTzJJvH8Q3sXIBWQvYZQ4dW0eE8gc FgFVifffdUFq2AQ0JLbtX84IYosIGErcuviKGcRmFpCW+Pa7mQnEFhZIkXj94B7YLl4BHYmb b5ezQczsZJS4/Pk1C0RCUOLkzCcsEM1aEjf+vQTbBTJo+T8OEJNTwEvi1EI+kApRARWJKSe3 sU1gFJqFpHkWkuZZCM0LGJlXMcqm5Fbp5iZm5hSnJusWJyfm5aUW6Rrr5WaW6KWmlG5iBAUz pyTfDsavB5UOMQpwMCrx8CquUPEXYk0sK67MPcQoycGkJMobeEHVX4gvKT+lMiOxOCO+qDQn tfgQowQHs5II75xlQDnelMTKqtSifJiUNAeLkjivmtY7PyGB9MSS1OzU1ILUIpisDAeHkgTv 0YtAjYJFqempFWmZOSUIaSYOTpDhPEDDL4HU8BYXJOYWZ6ZD5E8xKkqJ814FSQiAJDJK8+B6 YcnmFaM40CvCvPNAqniAiQqu+xXQYCagwc8ZwAaXJCKkpBoYN53wOtmk/jLx7nrnxgMGK8Un LmE071fwPHmlfI2S0GzvIxv8GXPXVzpwOMewRFc0/y++y29XuiJeV2zL9N3zzDcc36P278eb /YsLjnXl/3xnpSSfOJOxV8LMu+D3mnph9fkHfx7dIftVpWvbS2UJYQ2D7ikOgh+5vri7fOq+ clF22nGHOes5lViKMxINtZiLihMBxTwphREDAAA= 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: Sun, 29 Jan 2012 23:12:11 -0000 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? > --- > 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. > + (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"? > + (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. > + (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))