[PATCH v2 4/7] emacs: make emacs tagging use the stdin query functionality
authormarkwalters1009 <markwalters1009@gmail.com>
Sat, 24 Nov 2012 13:20:53 +0000 (13:20 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:50:49 +0000 (09:50 -0800)
0a/8f6bb845ffd00e18890b1c63839be2e26bd0f1 [new file with mode: 0644]

diff --git a/0a/8f6bb845ffd00e18890b1c63839be2e26bd0f1 b/0a/8f6bb845ffd00e18890b1c63839be2e26bd0f1
new file mode 100644 (file)
index 0000000..d8dc0cf
--- /dev/null
@@ -0,0 +1,107 @@
+Return-Path: <markwalters1009@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 001D9431FAF\r
+       for <notmuch@notmuchmail.org>; Sat, 24 Nov 2012 05:21:14 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+       RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id UW4HMZRQF9L2 for <notmuch@notmuchmail.org>;\r
+       Sat, 24 Nov 2012 05:21:12 -0800 (PST)\r
+Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com\r
+       [209.85.212.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 9563B431FBD\r
+       for <notmuch@notmuchmail.org>; Sat, 24 Nov 2012 05:21:10 -0800 (PST)\r
+Received: by mail-wi0-f175.google.com with SMTP id hm11so1793227wib.2\r
+       for <notmuch@notmuchmail.org>; Sat, 24 Nov 2012 05:21:10 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+       bh=zYeU6H4wUr10CB4Dr3R+Wc6zFiqS7r2NK2K+hw7KhLA=;\r
+       b=GMRCXkH/PXpRr9z5aB9sc+27koE9td4f42EhXDO2dsXK9xHs13ZR9S0LN23kuIlmXD\r
+       YjZxaniCOYi6toH5/Zl6I85pl0e4F66x4bYO1JtZlc8CBxLZ4kl+104imCNPVrwk8ZHv\r
+       5UVtzowpwTLF6iNLXQcmUsqYW+jHMQENhjszVpk9CMql6v5fFsv+ZQQpImzkxTC2NNt5\r
+       gmSot7vWcNhVKLi1rUDR5YAZJQOsE0AxLajEbfTIZV9LL+TpvcDjBnARzWtg64l07hKJ\r
+       iAg+VMYXLgpFEXzEMgtpWDgTm0QtXd2ag/9uZ+OKjf3XRm/rtpIO/AuKbV5m8JCGMJFk\r
+       6Tug==\r
+Received: by 10.180.85.165 with SMTP id i5mr6336441wiz.11.1353763270219;\r
+       Sat, 24 Nov 2012 05:21:10 -0800 (PST)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+       by mx.google.com with ESMTPS id i6sm12676635wix.5.2012.11.24.05.21.08\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Sat, 24 Nov 2012 05:21:09 -0800 (PST)\r
+From: markwalters1009 <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 4/7] emacs: make emacs tagging use the stdin query\r
+       functionality\r
+Date: Sat, 24 Nov 2012 13:20:53 +0000\r
+Message-Id: <1353763256-32336-5-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1353763256-32336-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1353763256-32336-1-git-send-email-markwalters1009@gmail.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 24 Nov 2012 13:21:14 -0000\r
+\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+\r
+In preparation for the use of large queries in some cases make tagging\r
+from emacs use the new query on stdin functionality. Currently uses\r
+this for all tagging (as I could not see a reason not to).\r
+---\r
+ emacs/notmuch-tag.el |   14 +++++++++-----\r
+ 1 files changed, 9 insertions(+), 5 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el\r
+index 4fce3a9..4634b0d 100644\r
+--- a/emacs/notmuch-tag.el\r
++++ b/emacs/notmuch-tag.el\r
+@@ -59,9 +59,10 @@ the messages that were tagged"\r
+       (setq search-terms (list "*")))\r
+   (split-string\r
+    (with-output-to-string\r
+-     (with-current-buffer standard-output\r
+-       (apply 'call-process notmuch-command nil t\r
+-            nil "search" "--output=tags" "--exclude=false" search-terms)))\r
++     (with-temp-buffer\r
++       (insert (mapconcat 'identity search-terms " "))\r
++       (apply 'call-process-region (point-min) (point-max) notmuch-command nil\r
++            standard-output nil "search" "--output=tags" "--exclude=false" (list "-"))))\r
+    "\n+" t))\r
\r
+ (defun notmuch-select-tag-with-completion (prompt &rest search-terms)\r
+@@ -134,8 +135,11 @@ notmuch-after-tag-hook will be run."\r
+       tag-changes)\r
+   (unless (null tag-changes)\r
+     (run-hooks 'notmuch-before-tag-hook)\r
+-    (apply 'notmuch-call-notmuch-process "tag"\r
+-         (append tag-changes (list "--" query)))\r
++    (with-temp-buffer\r
++      (insert query)\r
++      (apply 'notmuch-call-notmuch-process-region\r
++           (point-min) (point-max)\r
++           "tag" (append tag-changes (list "--" "-"))))\r
+     (run-hooks 'notmuch-after-tag-hook))\r
+   ;; in all cases we return tag-changes as a list\r
+   tag-changes)\r
+-- \r
+1.7.9.1\r
+\r