From: David Bremner Date: Sat, 8 Feb 2014 14:25:17 +0000 (+2000) Subject: [PATCH] emacs: remove newlines from input to notmuch count --batch X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1859e2fd634ceaec5301a0c80a3d267dc7651445;p=notmuch-archives.git [PATCH] emacs: remove newlines from input to notmuch count --batch --- diff --git a/b6/3718c0938cdc79dd091a68a87d93ba36f3a3a5 b/b6/3718c0938cdc79dd091a68a87d93ba36f3a3a5 new file mode 100644 index 000000000..934c879c6 --- /dev/null +++ b/b6/3718c0938cdc79dd091a68a87d93ba36f3a3a5 @@ -0,0 +1,84 @@ +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 BE44A431FBD + for ; Sat, 8 Feb 2014 06:25:35 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + 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 gKdHtWkvNPwv for ; + Sat, 8 Feb 2014 06:25:28 -0800 (PST) +Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155]) + (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id D97BE431FBC + for ; Sat, 8 Feb 2014 06:25:27 -0800 (PST) +Received: from remotemail by yantan.tethera.net with local (Exim 4.80) + (envelope-from ) + id 1WC8qV-0003Cr-Ea; Sat, 08 Feb 2014 10:25:27 -0400 +Received: (nullmailer pid 2779 invoked by uid 1000); Sat, 08 Feb 2014 + 14:25:23 -0000 +From: David Bremner +To: notmuch@notmuchmail.org +Subject: [PATCH] emacs: remove newlines from input to notmuch count --batch +Date: Sat, 8 Feb 2014 10:25:17 -0400 +Message-Id: <1391869517-2742-1-git-send-email-david@tethera.net> +X-Mailer: git-send-email 1.8.5.2 +In-Reply-To: +References: +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, 08 Feb 2014 14:25:40 -0000 + +Since a newline starts a new query in batch mode, this causes +mysterious crashes in the emacs interface if saved searches contain +newlines. See the discussion at + + id:87wqhcxb5j.fsf@maritornes.cs.unb.ca + +In general newlines seem to be just whitespace to the xapian query +parser, so this should be mainly harmless. +--- + emacs/notmuch-hello.el | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el +index 7b3d76b..e325cd3 100644 +--- a/emacs/notmuch-hello.el ++++ b/emacs/notmuch-hello.el +@@ -399,10 +399,12 @@ options will be handled as specified for + (third elem) + (cdr elem)))) + (insert +- (notmuch-hello-filtered-query count-query +- (or (plist-get options :filter-count) +- (plist-get options :filter))) +- "\n"))) ++ (replace-regexp-in-string ++ "\n" " " ++ (notmuch-hello-filtered-query count-query ++ (or (plist-get options :filter-count) ++ (plist-get options :filter)))) ++ "\n"))) + + (unless (= (call-process-region (point-min) (point-max) notmuch-command + t t nil "count" "--batch") 0) +-- +1.8.5.2 +