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 899B3431E64 for ; Sun, 29 Jan 2012 20:58:01 -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 8b7eqbADJEaD for ; Sun, 29 Jan 2012 20:58:01 -0800 (PST) Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU [18.9.25.13]) by olra.theworths.org (Postfix) with ESMTP id EB386431FBC for ; Sun, 29 Jan 2012 20:58:00 -0800 (PST) X-AuditID: 1209190d-b7fbf6d0000008ba-e0-4f262358f901 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP id FB.AA.02234.853262F4; Sun, 29 Jan 2012 23:58:00 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q0U4vx6Q003387; Sun, 29 Jan 2012 23:58:00 -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 q0U4vv76029978 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Sun, 29 Jan 2012 23:57:58 -0500 (EST) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) (envelope-from ) id 1RrjIj-0000WC-BR; Sun, 29 Jan 2012 23:57:09 -0500 Date: Sun, 29 Jan 2012 23:57:09 -0500 From: Austin Clements To: Dmitry Kurochkin Subject: Re: [PATCH v2 10/13] emacs: use message ids instead of thread id in `notmuch-show-operate-all' Message-ID: <20120130045709.GN17991@mit.edu> References: <1327725684-5887-1-git-send-email-dmitry.kurochkin@gmail.com> <1327890382-548-1-git-send-email-dmitry.kurochkin@gmail.com> <1327890382-548-11-git-send-email-dmitry.kurochkin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1327890382-548-11-git-send-email-dmitry.kurochkin@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmphleLIzCtJLcpLzFFi42IRYrdT0Y1QVvM3ODJJzOLq1n52i+s3ZzI7 MHnsnHWX3ePZqlvMAUxRXDYpqTmZZalF+nYJXBlT2veyFHSLVDxoaGVqYJwt0MXIySEhYCLx YvkKRghbTOLCvfVsXYxcHEIC+xglLh5bAeVsYJS4suURM0iVkMBJJon29zIQiSWMEouaJ7KC JFgEVCVmff7EBGKzCWhIbNu/HGysiIChxK2Lr8CamQWkJb79bgarERbIlNjy7Qk7iM0roCPR PmcuI8TQE4wS79vuMkEkBCVOznzCAtGsJXHj30ugOAfYoOX/OEDCnAJeEpufXwa7QVRARWLK yW1sExiFZiHpnoWkexZC9wJG5lWMsim5Vbq5iZk5xanJusXJiXl5qUW6Rnq5mSV6qSmlmxhB gc0pybuD8d1BpUOMAhyMSjy8Qf9U/YVYE8uKK3MPMUpyMCmJ8rooqfkL8SXlp1RmJBZnxBeV 5qQWH2KU4GBWEuF99BOonDclsbIqtSgfJiXNwaIkzquq9c5PSCA9sSQ1OzW1ILUIJivDwaEk wXsMZKhgUWp6akVaZk4JQpqJgxNkOA/Q8LMgNbzFBYm5xZnpEPlTjIpS4rwfQBICIImM0jy4 XljiecUoDvSKMO8LkCoeYNKC634FNJgJaPBzBpCri0sSEVJSDYxuqn3pJxY4mUVEfN0ZHXdC yPh6/GHNGt8rgs8E9StkGgW6zptx9iT4qv8Kma++vFZn7Z36/9cexZRL3d6eu2TnxbK/fVe4 K7plA78fCzWw+u2YenqHw0a2aRv9p/N0zv9xeOXtjpRis3fGb1u3/TyyXeGsCce9jjfZ3hP+ nb52JZ+rYJVskq8SS3FGoqEWc1FxIgC/vIC/FwMAAA== 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 04:58:01 -0000 Quoth Dmitry Kurochkin on Jan 30 at 6:26 am: > Before the change, `notmuch-show-operate-all' used thread id for notmuch-show-tag-all? > "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. > --- If you move this patch before the one that introduces notmuch-show-tag-all, you could do it this way from the beginning. > 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 0d90c1e..b115a8f 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 in the current thread with > +`notmuch-show-goto-message-next' and call FUNCTION for side > +effects." > + (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 messages in the current thread." > + (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 ")) > + > ;; dme: Would it make sense to use a macro for many of these? > > (defun notmuch-show-get-filename () > @@ -1494,7 +1515,7 @@ TAG-CHANGES is a list of tag operations for `notmuch-tag'." > > 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-thread-id tag-changes) > + (apply 'notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes) > (save-excursion > (goto-char (point-min)) > (loop do (let* ((current-tags (notmuch-show-get-tags))