[PATCH 4/4] Update NEWS for user.other_name
[notmuch-archives.git] / 75 / 011ea8750558dc638b88bcb74726c9acf36911
1 Return-Path: <sojkam1@fel.cvut.cz>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id D84FF431FD0\r
6         for <notmuch@notmuchmail.org>; Sun, 23 Jan 2011 02:46:05 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id fdM4bORzyy0c for <notmuch@notmuchmail.org>;\r
16         Sun, 23 Jan 2011 02:46:04 -0800 (PST)\r
17 Received: from mail.loccal.net (gw.loccal.net [94.142.235.206])\r
18         by olra.theworths.org (Postfix) with ESMTP id BD70F431FB6\r
19         for <notmuch@notmuchmail.org>; Sun, 23 Jan 2011 02:46:04 -0800 (PST)\r
20 Received: from localhost (localhost [127.0.0.1])\r
21         by mail.loccal.net (Postfix) with ESMTP id EF3A21046D;\r
22         Sun, 23 Jan 2011 11:59:17 +0100 (CET)\r
23 X-Virus-Scanned: amavisd-new at loccal.net\r
24 Received: from mail.loccal.net ([127.0.0.1])\r
25         by localhost (mail.loccal.net [127.0.0.1]) (amavisd-new, port 10024)\r
26         with LMTP id wdcYk6VvDBkU; Sun, 23 Jan 2011 11:59:15 +0100 (CET)\r
27 Received: from steelpick.2x.cz (unknown [10.21.129.4])\r
28         by mail.loccal.net (Postfix) with ESMTPS id F1BE01043A;\r
29         Sun, 23 Jan 2011 11:59:14 +0100 (CET)\r
30 Received: from wsh by steelpick.2x.cz with local (Exim 4.72)\r
31         (envelope-from <sojkam1@fel.cvut.cz>)\r
32         id 1PgxSJ-0003CY-1n; Sun, 23 Jan 2011 11:45:59 +0100\r
33 From: Michal Sojka <sojkam1@fel.cvut.cz>\r
34 To: notmuch@notmuchmail.org\r
35 Subject: [PATCH] emacs: View the output of pipe command when it fails\r
36 Date: Sun, 23 Jan 2011 11:45:50 +0100\r
37 Message-Id: <1295779550-12278-1-git-send-email-sojkam1@fel.cvut.cz>\r
38 X-Mailer: git-send-email 1.7.2.3\r
39 X-BeenThere: notmuch@notmuchmail.org\r
40 X-Mailman-Version: 2.1.13\r
41 Precedence: list\r
42 List-Id: "Use and development of the notmuch mail system."\r
43         <notmuch.notmuchmail.org>\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
47 List-Post: <mailto:notmuch@notmuchmail.org>\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
50         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
51 X-List-Received-Date: Sun, 23 Jan 2011 10:46:06 -0000\r
52 \r
53 Previously, the user didn't know whether the pipe command succeeded or\r
54 not. It was only possible to find it out by manually inspecting\r
55 the work done (or not done) by the command or by manually switching to\r
56 *notmuch-pipe* buffer and determine it from command output. For this\r
57 the user had to first find the text corresponding to the last run of\r
58 pipe command as the buffer accumulated the output from all pipe commands.\r
59 \r
60 This patch changes the following. The *notmuch-pipe* buffer is erased\r
61 before every pipe command so it contains only the output from the last\r
62 command. Additionally, when the command failed, the *notmuch-pipe* buffer\r
63 is shown and an error message is displayed.\r
64 with the output of pipe command.\r
65 ---\r
66  emacs/notmuch-show.el |   15 +++++++++++++--\r
67  1 files changed, 13 insertions(+), 2 deletions(-)\r
68 \r
69 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
70 index 3a60d43..f3150af 100644\r
71 --- a/emacs/notmuch-show.el\r
72 +++ b/emacs/notmuch-show.el\r
73 @@ -948,7 +948,7 @@ any effects from previous calls to\r
74  \r
75  The given command will be executed with the raw contents of the\r
76  current email message as stdin. Anything printed by the command\r
77 -to stdout or stderr will appear in the *Messages* buffer.\r
78 +to stdout or stderr will appear in the *notmuch-pipe* buffer.\r
79  \r
80  When invoked with a prefix argument, the command will receive all\r
81  open messages in the current thread (formatted as an mbox) rather\r
82 @@ -964,7 +964,18 @@ than only the current message."\r
83        (setq shell-command\r
84             (concat notmuch-command " show --format=raw "\r
85                     (shell-quote-argument (notmuch-show-get-message-id)) " | " command)))\r
86 -    (start-process-shell-command "notmuch-pipe-command" "*notmuch-pipe*" shell-command)))\r
87 +    (let ((buf (get-buffer-create (concat "*notmuch-pipe*"))))\r
88 +      (with-current-buffer buf\r
89 +       (setq buffer-read-only nil)\r
90 +       (erase-buffer)\r
91 +       (let ((exit-code (call-process-shell-command shell-command nil buf)))\r
92 +         (goto-char (point-max))\r
93 +         (set-buffer-modified-p nil)\r
94 +         (setq buffer-read-only t)\r
95 +         (unless (zerop exit-code)\r
96 +           (switch-to-buffer-other-window buf)\r
97 +           (message (format "Command '%s' exited abnormally with code %d"\r
98 +                            shell-command exit-code))))))))\r
99  \r
100  (defun notmuch-show-add-tags-worker (current-tags add-tags)\r
101    "Add to `current-tags' with any tags from `add-tags' not\r
102 -- \r
103 1.7.2.3\r
104 \r