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 001D9431FAF for ; Sat, 24 Nov 2012 05:21:14 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0.201 X-Spam-Level: X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, 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 UW4HMZRQF9L2 for ; Sat, 24 Nov 2012 05:21:12 -0800 (PST) Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 9563B431FBD for ; Sat, 24 Nov 2012 05:21:10 -0800 (PST) Received: by mail-wi0-f175.google.com with SMTP id hm11so1793227wib.2 for ; Sat, 24 Nov 2012 05:21:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=zYeU6H4wUr10CB4Dr3R+Wc6zFiqS7r2NK2K+hw7KhLA=; b=GMRCXkH/PXpRr9z5aB9sc+27koE9td4f42EhXDO2dsXK9xHs13ZR9S0LN23kuIlmXD YjZxaniCOYi6toH5/Zl6I85pl0e4F66x4bYO1JtZlc8CBxLZ4kl+104imCNPVrwk8ZHv 5UVtzowpwTLF6iNLXQcmUsqYW+jHMQENhjszVpk9CMql6v5fFsv+ZQQpImzkxTC2NNt5 gmSot7vWcNhVKLi1rUDR5YAZJQOsE0AxLajEbfTIZV9LL+TpvcDjBnARzWtg64l07hKJ iAg+VMYXLgpFEXzEMgtpWDgTm0QtXd2ag/9uZ+OKjf3XRm/rtpIO/AuKbV5m8JCGMJFk 6Tug== Received: by 10.180.85.165 with SMTP id i5mr6336441wiz.11.1353763270219; Sat, 24 Nov 2012 05:21:10 -0800 (PST) Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) by mx.google.com with ESMTPS id i6sm12676635wix.5.2012.11.24.05.21.08 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 24 Nov 2012 05:21:09 -0800 (PST) From: markwalters1009 To: notmuch@notmuchmail.org Subject: [PATCH v2 4/7] emacs: make emacs tagging use the stdin query functionality Date: Sat, 24 Nov 2012 13:20:53 +0000 Message-Id: <1353763256-32336-5-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1353763256-32336-1-git-send-email-markwalters1009@gmail.com> References: <1353763256-32336-1-git-send-email-markwalters1009@gmail.com> 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 13:21:14 -0000 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 " ")) + (apply 'call-process-region (point-min) (point-max) notmuch-command nil + standard-output nil "search" "--output=tags" "--exclude=false" (list "-")))) "\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 + (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) -- 1.7.9.1