unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [PATCH] emacs: remove newlines from input to notmuch count --batch
Date: Sat,  8 Feb 2014 10:25:17 -0400	[thread overview]
Message-ID: <1391869517-2742-1-git-send-email-david@tethera.net> (raw)
In-Reply-To: <m2sirzj3k0.fsf@guru.guru-group.fi>

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

  reply	other threads:[~2014-02-08 14:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-03 19:13 sanitization of args notmuch-cli in notmuch-emacs David Bremner
2014-02-03 20:36 ` Tomi Ollila
2014-02-03 21:21   ` Tomi Ollila
2014-02-08 14:25     ` David Bremner [this message]
2014-02-08 18:31       ` [PATCH] emacs: remove newlines from input to notmuch count --batch Tomi Ollila
2014-02-26  1:02       ` David Bremner
2014-02-04 13:10   ` sanitization of args notmuch-cli in notmuch-emacs David Bremner
2014-02-04 17:30     ` Mark Walters
2014-02-04 18:02     ` Tomi Ollila
2014-02-26  1:03 ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1391869517-2742-1-git-send-email-david@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).