From abbbca056ca1a15299278b62d01a8d87cc3fb618 Mon Sep 17 00:00:00 2001 From: Pieter Praet Date: Fri, 24 Feb 2012 23:37:10 +0100 Subject: [PATCH] Re: [PATCH 6/6] emacs: `notmuch-show-tag-all' sans prefix arg only tags open messages --- dc/efcf955cc1ff16f9b943f92ae93430cf806c63 | 189 ++++++++++++++++++++++ 1 file changed, 189 insertions(+) create mode 100644 dc/efcf955cc1ff16f9b943f92ae93430cf806c63 diff --git a/dc/efcf955cc1ff16f9b943f92ae93430cf806c63 b/dc/efcf955cc1ff16f9b943f92ae93430cf806c63 new file mode 100644 index 000000000..841246c4b --- /dev/null +++ b/dc/efcf955cc1ff16f9b943f92ae93430cf806c63 @@ -0,0 +1,189 @@ +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 A47E1416159 + for ; Fri, 24 Feb 2012 14:39:26 -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 zroAcE2HhnVK for ; + Fri, 24 Feb 2012 14:39:26 -0800 (PST) +Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com + [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + D5589416158 for ; Fri, 24 Feb 2012 14:39:25 -0800 + (PST) +Received: by wgbdt12 with SMTP id dt12so2229215wgb.2 + for ; Fri, 24 Feb 2012 14:39:24 -0800 (PST) +Received-SPF: pass (google.com: domain of pieter@praet.org designates + 10.180.24.166 as permitted sender) client-ip=10.180.24.166; +Authentication-Results: mr.google.com; + spf=pass (google.com: domain of pieter@praet.org + designates 10.180.24.166 as permitted sender) + smtp.mail=pieter@praet.org +Received: from mr.google.com ([10.180.24.166]) + by 10.180.24.166 with SMTP id v6mr9131891wif.10.1330123164674 (num_hops + = 1); Fri, 24 Feb 2012 14:39:24 -0800 (PST) +Received: by 10.180.24.166 with SMTP id v6mr7271604wif.10.1330123164552; + Fri, 24 Feb 2012 14:39:24 -0800 (PST) +Received: from localhost ([109.131.181.26]) + by mx.google.com with ESMTPS id by4sm423844wib.3.2012.02.24.14.39.23 + (version=TLSv1/SSLv3 cipher=OTHER); + Fri, 24 Feb 2012 14:39:24 -0800 (PST) +From: Pieter Praet +To: Dmitry Kurochkin , + David Bremner +Subject: Re: [PATCH 6/6] emacs: `notmuch-show-tag-all' sans prefix arg only + tags open messages +In-Reply-To: <87aa48jynx.fsf@gmail.com> +References: <878vjtqhcg.fsf@praet.org> + <1330038554-10347-6-git-send-email-pieter@praet.org> + <87aa48jynx.fsf@gmail.com> +User-Agent: Notmuch/0.11.1+210~g6afc43e (http://notmuchmail.org) Emacs/23.3.1 + (x86_64-unknown-linux-gnu) +Date: Fri, 24 Feb 2012 23:37:10 +0100 +Message-ID: <871upjeu3t.fsf@praet.org> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Gm-Message-State: + ALoCoQlg+iUFZN+D9zv7E3Fkk8zQn4jJl0lW/TDew5MkSlPFwGOtLx015OwI3yr9632UNEwWhS75 +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: Fri, 24 Feb 2012 22:39:26 -0000 + +On Fri, 24 Feb 2012 14:47:30 +0400, Dmitry Kurochkin wrote: +> On Fri, 24 Feb 2012 00:09:14 +0100, Pieter Praet wrote: +> > * emacs/notmuch-show.el +> > +> > (notmuch-show-get-messages-ids): +> > New optional argument ONLY-OPEN. If non-nil, only return +> > Message-Id's for messages which are currently visible. +> > +> > (notmuch-show-tag-all): +> > New optional argument IGNORE-VISIBILITY, of which the inverse is +> > passed as ONLY-OPEN argument to `notmuch-show-get-messages-ids': +> > If called with a prefix arg, affect *all* messages in the current +> > buffer. Otherwise, only change tags of visible messages. +> > +> > (notmuch-show-archive-thread): +> > Update wrt changes to `notmuch-show-tag-all'. +> > +> > * test/emacs +> > +> > - Subtest "notmuch-show: change tags of open messages in current buffer" +> > is no longer broken. +> > --- +> > emacs/notmuch-show.el | 28 ++++++++++++++++++++-------- +> > test/emacs | 1 - +> > 2 files changed, 20 insertions(+), 9 deletions(-) +> > +> > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +> > index 4b37c77..4499fcd 100644 +> > --- a/emacs/notmuch-show.el +> > +++ b/emacs/notmuch-show.el +> > @@ -1334,13 +1334,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 (&optional separator) +> > +(defun notmuch-show-get-messages-ids (&optional only-open separator) +> > "Return a list of Message-Id's of all messages in the current buffer. +> > +> > +If optional argument ONLY-OPEN is non-nil, only return +> > +Message-Id's for messages which are currently visible. +> > + +> > 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 t +> > + (notmuch-show-mapc +> > + `(if only-open (notmuch-show-message-visible-p) t) +> +> How about changing ONLY-OPEN to a general optional PREDICATE argument +> and pass it as is to `notmuch-show-mapc'? Please make it the last +> argument. +> + +Done. + + +> Regards, +> Dmitry +> +> > (lambda () (push (notmuch-show-get-message-id) message-ids))) +> > (if separator +> > (mapconcat 'identity message-ids separator) +> > @@ -1628,13 +1632,21 @@ (defun notmuch-show-tag (&optional initial-input) +> > initial-input (notmuch-show-get-message-id)))) +> > (apply 'notmuch-show-tag-message tag-changes))) +> > +> > -(defun notmuch-show-tag-all (&rest tag-changes) +> > - "Change tags for all messages in the current thread. +> > +(defun notmuch-show-tag-all (&optional ignore-visibility &rest tag-changes) +> > + "Change tags of all open messages in the current buffer. +> > + +> > +If optional arg IGNORE-VISIBILITY is non-nil, change tags of +> > +*all* messages in the current buffer, independent of their +> > +visibility. +> > +> > 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 " or ") tag-changes) +> > - (notmuch-show-mapc t +> > + (interactive (cons current-prefix-arg +> > + (notmuch-read-tag-changes nil notmuch-show-thread-id))) +> > + (apply 'notmuch-tag +> > + (notmuch-show-get-messages-ids (not ignore-visibility) " or ") +> > + tag-changes) +> > + (notmuch-show-mapc +> > + `(if ignore-visibility t (notmuch-show-message-visible-p)) +> > (lambda () +> > (let* ((current-tags (notmuch-show-get-tags)) +> > (new-tags (notmuch-update-tags current-tags tag-changes))) +> > @@ -1719,7 +1731,7 @@ (defun notmuch-show-archive-thread (&optional unarchive) +> > buffer." +> > (interactive "P") +> > (let ((op (if unarchive "+" "-"))) +> > - (notmuch-show-tag-all (concat op "inbox")))) +> > + (notmuch-show-tag-all t (concat op "inbox")))) +> > +> > (defun notmuch-show-archive-thread-then-next () +> > "Archive each message in thread, then show next thread from search." +> > diff --git a/test/emacs b/test/emacs +> > index 644ef59..c286ff5 100755 +> > --- a/test/emacs +> > +++ b/test/emacs +> > @@ -152,7 +152,6 @@ notmuch tag +"$del_tag" -"$add_tag" -- "$query" # revert tag changes +> > test_expect_equal "$count_changed" "$count_total" # assert that CHANGED == TOTAL +> > +> > test_begin_subtest "notmuch-show: change tags of open messages in current buffer" +> > -test_subtest_known_broken +> > query="$os_x_darwin_thread" +> > filter="from:Jiang" +> > add_tag="notmuch-show-tag-all" +> > -- +> > 1.7.8.1 +> > + + +Peace + +-- +Pieter -- 2.26.2