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 B5227431FAF for ; Sat, 24 Nov 2012 14:09:32 -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 20yoziCEfMpT for ; Sat, 24 Nov 2012 14:09:32 -0800 (PST) Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU [18.9.25.15]) by olra.theworths.org (Postfix) with ESMTP id 3030A431FAE for ; Sat, 24 Nov 2012 14:09:32 -0800 (PST) X-AuditID: 1209190f-b7f636d00000095b-aa-50b1459b63a6 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP id 63.84.02395.B9541B05; Sat, 24 Nov 2012 17:09:31 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id qAOM9UiJ024004; Sat, 24 Nov 2012 17:09:31 -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 qAOM9TVt021272 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Sat, 24 Nov 2012 17:09:30 -0500 (EST) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80) (envelope-from ) id 1TcNui-0005uo-SM; Sat, 24 Nov 2012 17:09:28 -0500 Date: Sat, 24 Nov 2012 17:09:28 -0500 From: Austin Clements To: markwalters1009 Subject: Re: [PATCH v2 4/7] emacs: make emacs tagging use the stdin query functionality Message-ID: <20121124220902.GI4562@mit.edu> References: <1353763256-32336-1-git-send-email-markwalters1009@gmail.com> <1353763256-32336-5-git-send-email-markwalters1009@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1353763256-32336-5-git-send-email-markwalters1009@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpmleLIzCtJLcpLzFFi42IR4hTV1p3tujHAYMZ3eYvVc3ksrt+cyezA 5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZcy6so61YKpAxfMFe1gaGK/wdDFyckgImEjc m/yEGcIWk7hwbz1bFyMXh5DAPkaJ571/mCGcDYwS665+YYJwLjJJnH18igXCWcIocbt3MVAZ BweLgKrEn78WIKPYBDQktu1fzghiiwjoS+xZcZsNxGYWkJb49ruZCcQWFoiUWPagiwXE5hXQ lnh/6TTUtk5Gic7DM1ghEoISJ2c+YYFo1pK48e8lE8gukEHL/3GAhDkFvCS2bn0FVi4qoCIx 5eQ2tgmMQrOQdM9C0j0LoXsBI/MqRtmU3Crd3MTMnOLUZN3i5MS8vNQiXRO93MwSvdSU0k2M 4LCW5N/B+O2g0iFGAQ5GJR7exDPrA4RYE8uKK3MPMUpyMCmJ8lY5bQwQ4kvKT6nMSCzOiC8q zUktPsQowcGsJMJrrQqU401JrKxKLcqHSUlzsCiJ815NuekvJJCeWJKanZpakFoEk5Xh4FCS 4OUCxq+QYFFqempFWmZOCUKaiYMTZDgP0HATkBre4oLE3OLMdIj8KUZFKXHepy5ACQGQREZp HlwvLO28YhQHekWYlx2knQeYsuC6XwENZgIa/HT2OpDBJYkIKakGxhlnHk1eULBX3cFtn+EF aVduVZfyFelr1YS7i6TPMCrpPmlnZXf+u7JHeO0G7rQ0X/cP8uGRnwuuSDlvyGneOC0/puDc puzp6h/35C5yZda6tkhD9uSJ7FLZ1pe+G9U+hUaaHawIjInQmWWR8PqLVr2okaNOmYn2Pe09 KWtqVDf45PLV7f+jxFKckWioxVxUnAgAnKmopxYDAAA= 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: Sat, 24 Nov 2012 22:09:32 -0000 Quoth markwalters1009 on Nov 24 at 1:20 pm: > From: Mark Walters > > In preparation for the use of large queries in some cases make tagging > from emacs use the new query on stdin functionality. Currently uses > this for all tagging (as I could not see a reason not to). > --- > emacs/notmuch-tag.el | 14 +++++++++----- > 1 files changed, 9 insertions(+), 5 deletions(-) > > diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el > index 4fce3a9..4634b0d 100644 > --- a/emacs/notmuch-tag.el > +++ b/emacs/notmuch-tag.el > @@ -59,9 +59,10 @@ the messages that were tagged" > (setq search-terms (list "*"))) > (split-string > (with-output-to-string > - (with-current-buffer standard-output > - (apply 'call-process notmuch-command nil t > - nil "search" "--output=tags" "--exclude=false" search-terms))) > + (with-temp-buffer > + (insert (mapconcat 'identity search-terms " ")) #'identity ? > + (apply 'call-process-region (point-min) (point-max) notmuch-command nil #'call-process-region ? > + standard-output nil "search" "--output=tags" "--exclude=false" (list "-")))) If you use funcall instead of apply here, you won't need to put "-" in a list. Also, the lines seem a little long (but maybe that's just diff and quoting?) > "\n+" t)) > > (defun notmuch-select-tag-with-completion (prompt &rest search-terms) > @@ -134,8 +135,11 @@ notmuch-after-tag-hook will be run." > tag-changes) > (unless (null tag-changes) > (run-hooks 'notmuch-before-tag-hook) > - (apply 'notmuch-call-notmuch-process "tag" > - (append tag-changes (list "--" query))) > + (with-temp-buffer > + (insert query) > + (apply 'notmuch-call-notmuch-process-region #'notmuch-call-notmuch-process-region ? > + (point-min) (point-max) > + "tag" (append tag-changes (list "--" "-")))) > (run-hooks 'notmuch-after-tag-hook)) > ;; in all cases we return tag-changes as a list > tag-changes)