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 EC741431FD2 for ; Wed, 25 Jan 2012 02:47:54 -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 txkKXuFotI8t for ; Wed, 25 Jan 2012 02:47:54 -0800 (PST) Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 197E4431FBC for ; Wed, 25 Jan 2012 02:47:53 -0800 (PST) Received: by wibhi8 with SMTP id hi8so2360067wib.26 for ; Wed, 25 Jan 2012 02:47:53 -0800 (PST) Received: by 10.180.80.164 with SMTP id s4mr468672wix.22.1327488471171; Wed, 25 Jan 2012 02:47:51 -0800 (PST) Received: from hotblack-desiato.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25]) by mx.google.com with ESMTPS id fr8sm70280wib.10.2012.01.25.02.47.48 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 Jan 2012 02:47:50 -0800 (PST) Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000) id 6B0A59FE67; Wed, 25 Jan 2012 10:47:47 +0000 (GMT) To: Jameson Graef Rollins , Notmuch Mail Subject: Re: [PATCH v3 2/8] emacs: break up notmuch-show-archive-thread-internal into two more generally useful functions In-Reply-To: <1327449983-23638-3-git-send-email-jrollins@finestructure.net> References: <87pqea24z0.fsf@servo.finestructure.net> <1327449983-23638-1-git-send-email-jrollins@finestructure.net> <1327449983-23638-2-git-send-email-jrollins@finestructure.net> <1327449983-23638-3-git-send-email-jrollins@finestructure.net> User-Agent: Notmuch/0.11+109~g03934e4 (http://notmuchmail.org) Emacs/24.0.92.1 (x86_64-pc-linux-gnu) From: David Edmondson Date: Wed, 25 Jan 2012 10:47:47 +0000 Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Gm-Message-State: ALoCoQl5qYYhTQURIo5NWTi+FId1LCokWgxFgVDEaokOaPheO0smPU/LCG+Bn+buGWKrd4Gn1Los 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: Wed, 25 Jan 2012 10:47:55 -0000 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Tue, 24 Jan 2012 16:06:17 -0800, Jameson Graef Rollins wrote: > notmuch-show-tag-thread-internal: applies a tag to all messages in > thread. If option remove flag is t, tags will be removed instead of > added. If it's non-nil, but yes. > notmuch-show-next-thread: moves to the next thread in the search > result. If given a prefix, will show the next result, otherwise will > just move to it in the search view. >=20 > Two new interactive functions, notmuch-show-{add,remove}-tag-thread, > are also added. Together, these provide a better suit of thread > tagging and navigation tools. >=20 > The higher level thread archiving functions are modified to use these > new function. > --- > emacs/notmuch-show.el | 46 +++++++++++++++++++++++++++++++++----------= --- > 1 files changed, 33 insertions(+), 13 deletions(-) >=20 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > index a0045fc..fb908b0 100644 > --- a/emacs/notmuch-show.el > +++ b/emacs/notmuch-show.el > @@ -1525,20 +1525,38 @@ argument, hide all of the messages." > (interactive) > (backward-button 1)) >=20=20 > -(defun notmuch-show-archive-thread-internal (show-next) > - ;; Remove the tag from the current set of messages. > +(defun notmuch-show-tag-thread-internal (tag &optional remove) > + "Add tag to the current set of messages. "Add TAG to all messages in the current buffer." > + > +If the remove switch is given, tags will be removed instead of > +added." "If the REMOVE argument is non-nil, ..." > (goto-char (point-min)) > - (loop do (notmuch-show-remove-tag "inbox") > - until (not (notmuch-show-goto-message-next))) > - ;; Move to the next item in the search results, if any. > + (let ((tag-function (if remove > + 'notmuch-show-remove-tag > + 'notmuch-show-add-tag))) > + (loop do (funcall tag-function tag) > + until (not (notmuch-show-goto-message-next))))) I wonder if we shouldn't have a macro for "do something to all messages in the current buffer" that could be used more widely. > + > +(defun notmuch-show-add-tag-thread (tag) > + "Add tag to all messages in the current thread." > + (interactive) > + (notmuch-show-tag-thread-internal tag)) > + > +(defun notmuch-show-remove-tag-thread (tag) > + "Remove tag from all messages in the current thread." > + (interactive) > + (notmuch-show-tag-thread-internal tag t)) > + > +(defun notmuch-show-next-thread (&optional show-next) > + "Move to the next item in the search results, if any." Describe the meaning of SHOW-NEXT. > + (interactive "P") > (let ((parent-buffer notmuch-show-parent-buffer)) > (notmuch-kill-this-buffer) > - (if parent-buffer > - (progn > - (switch-to-buffer parent-buffer) > - (notmuch-search-next-thread) > - (if show-next > - (notmuch-search-show-thread)))))) > + (when parent-buffer > + (switch-to-buffer parent-buffer) > + (notmuch-search-next-thread) > + (if show-next > + (notmuch-search-show-thread))))) >=20=20 > (defun notmuch-show-archive-thread () > "Archive each message in thread, then show next thread from search. > @@ -1552,12 +1570,14 @@ being delivered to the same thread. It does not a= rchive the > entire thread, but only the messages shown in the current > buffer." > (interactive) > - (notmuch-show-archive-thread-internal t)) > + (notmuch-show-remove-tag-thread "inbox") > + (notmuch-show-next-thread t)) >=20=20 > (defun notmuch-show-archive-thread-then-exit () > "Archive each message in thread, then exit back to search results." > (interactive) > - (notmuch-show-archive-thread-internal nil)) > + (notmuch-show-remove-tag-thread "inbox") > + (notmuch-show-next-thread)) >=20=20 > (defun notmuch-show-stash-cc () > "Copy CC field of current message to kill-ring." > --=20 > 1.7.8.3 >=20 > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk8f3dMACgkQaezQq/BJZRZqfwCbBFxjBEvmkV740tf5bL96HMwU MB4An20ZmUSJqwZwzm7UBdhkBy1dW60S =mLRN -----END PGP SIGNATURE----- --=-=-=--