--- /dev/null
+Return-Path: <sojkam1@fel.cvut.cz>\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 D84FF431FD0\r
+ for <notmuch@notmuchmail.org>; Sun, 23 Jan 2011 02:46:05 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ 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 fdM4bORzyy0c for <notmuch@notmuchmail.org>;\r
+ Sun, 23 Jan 2011 02:46:04 -0800 (PST)\r
+Received: from mail.loccal.net (gw.loccal.net [94.142.235.206])\r
+ by olra.theworths.org (Postfix) with ESMTP id BD70F431FB6\r
+ for <notmuch@notmuchmail.org>; Sun, 23 Jan 2011 02:46:04 -0800 (PST)\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by mail.loccal.net (Postfix) with ESMTP id EF3A21046D;\r
+ Sun, 23 Jan 2011 11:59:17 +0100 (CET)\r
+X-Virus-Scanned: amavisd-new at loccal.net\r
+Received: from mail.loccal.net ([127.0.0.1])\r
+ by localhost (mail.loccal.net [127.0.0.1]) (amavisd-new, port 10024)\r
+ with LMTP id wdcYk6VvDBkU; Sun, 23 Jan 2011 11:59:15 +0100 (CET)\r
+Received: from steelpick.2x.cz (unknown [10.21.129.4])\r
+ by mail.loccal.net (Postfix) with ESMTPS id F1BE01043A;\r
+ Sun, 23 Jan 2011 11:59:14 +0100 (CET)\r
+Received: from wsh by steelpick.2x.cz with local (Exim 4.72)\r
+ (envelope-from <sojkam1@fel.cvut.cz>)\r
+ id 1PgxSJ-0003CY-1n; Sun, 23 Jan 2011 11:45:59 +0100\r
+From: Michal Sojka <sojkam1@fel.cvut.cz>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: View the output of pipe command when it fails\r
+Date: Sun, 23 Jan 2011 11:45:50 +0100\r
+Message-Id: <1295779550-12278-1-git-send-email-sojkam1@fel.cvut.cz>\r
+X-Mailer: git-send-email 1.7.2.3\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: Sun, 23 Jan 2011 10:46:06 -0000\r
+\r
+Previously, the user didn't know whether the pipe command succeeded or\r
+not. It was only possible to find it out by manually inspecting\r
+the work done (or not done) by the command or by manually switching to\r
+*notmuch-pipe* buffer and determine it from command output. For this\r
+the user had to first find the text corresponding to the last run of\r
+pipe command as the buffer accumulated the output from all pipe commands.\r
+\r
+This patch changes the following. The *notmuch-pipe* buffer is erased\r
+before every pipe command so it contains only the output from the last\r
+command. Additionally, when the command failed, the *notmuch-pipe* buffer\r
+is shown and an error message is displayed.\r
+with the output of pipe command.\r
+---\r
+ emacs/notmuch-show.el | 15 +++++++++++++--\r
+ 1 files changed, 13 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 3a60d43..f3150af 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -948,7 +948,7 @@ any effects from previous calls to\r
+ \r
+ The given command will be executed with the raw contents of the\r
+ current email message as stdin. Anything printed by the command\r
+-to stdout or stderr will appear in the *Messages* buffer.\r
++to stdout or stderr will appear in the *notmuch-pipe* buffer.\r
+ \r
+ When invoked with a prefix argument, the command will receive all\r
+ open messages in the current thread (formatted as an mbox) rather\r
+@@ -964,7 +964,18 @@ than only the current message."\r
+ (setq shell-command\r
+ (concat notmuch-command " show --format=raw "\r
+ (shell-quote-argument (notmuch-show-get-message-id)) " | " command)))\r
+- (start-process-shell-command "notmuch-pipe-command" "*notmuch-pipe*" shell-command)))\r
++ (let ((buf (get-buffer-create (concat "*notmuch-pipe*"))))\r
++ (with-current-buffer buf\r
++ (setq buffer-read-only nil)\r
++ (erase-buffer)\r
++ (let ((exit-code (call-process-shell-command shell-command nil buf)))\r
++ (goto-char (point-max))\r
++ (set-buffer-modified-p nil)\r
++ (setq buffer-read-only t)\r
++ (unless (zerop exit-code)\r
++ (switch-to-buffer-other-window buf)\r
++ (message (format "Command '%s' exited abnormally with code %d"\r
++ shell-command exit-code))))))))\r
+ \r
+ (defun notmuch-show-add-tags-worker (current-tags add-tags)\r
+ "Add to `current-tags' with any tags from `add-tags' not\r
+-- \r
+1.7.2.3\r
+\r