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 2687F40D14A
\r
6 for <notmuch@notmuchmail.org>; Fri, 22 Oct 2010 02:28:33 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5
\r
12 tests=[BAYES_00=-1.9] autolearn=ham
\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 C86HckQNEXLt for <notmuch@notmuchmail.org>;
\r
16 Fri, 22 Oct 2010 02:28:18 -0700 (PDT)
\r
17 Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])
\r
18 by olra.theworths.org (Postfix) with ESMTP id E872040D148
\r
19 for <notmuch@notmuchmail.org>; Fri, 22 Oct 2010 02:28:17 -0700 (PDT)
\r
20 Received: from localhost (unknown [192.168.200.4])
\r
21 by max.feld.cvut.cz (Postfix) with ESMTP id D664719F33CB;
\r
22 Fri, 22 Oct 2010 11:28:16 +0200 (CEST)
\r
23 X-Virus-Scanned: IMAP AMAVIS
\r
24 Received: from max.feld.cvut.cz ([192.168.200.1])
\r
25 by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new,
\r
27 with ESMTP id kPGf+Ttcd+Rf; Fri, 22 Oct 2010 11:28:15 +0200 (CEST)
\r
28 Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])
\r
29 by max.feld.cvut.cz (Postfix) with ESMTP id F167219F33B2;
\r
30 Fri, 22 Oct 2010 11:28:14 +0200 (CEST)
\r
31 Received: from steelpick.2x.cz (note-sojka.felk.cvut.cz [147.32.86.30])
\r
32 (Authenticated sender: sojkam1)
\r
33 by imap.feld.cvut.cz (Postfix) with ESMTPSA id 052C5FA007;
\r
34 Fri, 22 Oct 2010 11:28:14 +0200 (CEST)
\r
35 Received: from wsh by steelpick.2x.cz with local (Exim 4.72)
\r
36 (envelope-from <sojkam1@fel.cvut.cz>)
\r
37 id 1P9Dv4-0006p2-BR; Fri, 22 Oct 2010 11:28:14 +0200
\r
38 From: Michal Sojka <sojkam1@fel.cvut.cz>
\r
39 To: notmuch@notmuchmail.org
\r
40 Subject: [PATCH 2/2] emacs: Access raw messages via cat subcommand
\r
41 Date: Fri, 22 Oct 2010 11:28:04 +0200
\r
42 Message-Id: <1287739684-26188-3-git-send-email-sojkam1@fel.cvut.cz>
\r
43 X-Mailer: git-send-email 1.7.2.3
\r
44 In-Reply-To: <1287739684-26188-1-git-send-email-sojkam1@fel.cvut.cz>
\r
45 References: <1287739684-26188-1-git-send-email-sojkam1@fel.cvut.cz>
\r
46 X-BeenThere: notmuch@notmuchmail.org
\r
47 X-Mailman-Version: 2.1.13
\r
49 List-Id: "Use and development of the notmuch mail system."
\r
50 <notmuch.notmuchmail.org>
\r
51 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
52 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
53 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
54 List-Post: <mailto:notmuch@notmuchmail.org>
\r
55 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
56 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
57 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
58 X-List-Received-Date: Fri, 22 Oct 2010 09:28:33 -0000
\r
60 This patch modifies the following commands to access the messages via
\r
62 - view/save attachments ('v', 'w'),
\r
63 - view a raw message ('V') and
\r
64 - pipe a message to a command ('|').
\r
66 With this patch, it is straightforward to use notmuch emacs interface
\r
67 with a remote database accessed over SSH. To do this, it is sufficient
\r
68 to redefine notmuch-command variable to contain the name of a script
\r
71 ssh user@host notmuch "$@"
\r
73 If the ssh client has enabled connection sharing (ControlMaster option
\r
74 in OpenSSH), the emacs interface is almost as responsive as when
\r
75 notmuch is invoked locally.
\r
77 emacs/notmuch-show.el | 14 +++++++++-----
\r
78 1 files changed, 9 insertions(+), 5 deletions(-)
\r
80 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
81 index 98d25ef..5d207b9 100644
\r
82 --- a/emacs/notmuch-show.el
\r
83 +++ b/emacs/notmuch-show.el
\r
84 @@ -85,10 +85,10 @@ any given message."
\r
85 (defmacro with-current-notmuch-show-message (&rest body)
\r
86 "Evaluate body with current buffer set to the text of current message"
\r
88 - (let ((filename (notmuch-show-get-filename)))
\r
89 - (let ((buf (generate-new-buffer (concat "*notmuch-msg-" filename "*"))))
\r
90 + (let ((id (notmuch-show-get-message-id)))
\r
91 + (let ((buf (generate-new-buffer (concat "*notmuch-msg-" id "*"))))
\r
92 (with-current-buffer buf
\r
93 - (insert-file-contents filename nil nil nil t)
\r
94 + (call-process notmuch-command nil t nil "cat" id)
\r
96 (kill-buffer buf)))))
\r
98 @@ -918,7 +918,11 @@ any effects from previous calls to
\r
99 (defun notmuch-show-view-raw-message ()
\r
100 "View the file holding the current message."
\r
102 - (view-file (notmuch-show-get-filename)))
\r
103 + (let ((id (notmuch-show-get-message-id)))
\r
104 + (let ((buf (get-buffer-create (concat "*notmuch-raw-" id "*"))))
\r
105 + (switch-to-buffer buf)
\r
107 + (call-process notmuch-command nil t nil "cat" id)))))
\r
109 (defun notmuch-show-pipe-message (entire-thread command)
\r
110 "Pipe the contents of the current message (or thread) to the given command.
\r
111 @@ -939,7 +943,7 @@ than only the current message."
\r
112 (mapconcat 'identity (notmuch-show-get-message-ids-for-open-messages) " OR "))
\r
114 (setq shell-command
\r
115 - (concat command " < " (shell-quote-argument (notmuch-show-get-filename)))))
\r
116 + (concat "notmuch cat " (shell-quote-argument (notmuch-show-get-message-id)) " | " command)))
\r
117 (start-process-shell-command "notmuch-pipe-command" "*notmuch-pipe*" shell-command)))
\r
119 (defun notmuch-show-add-tag (&rest toadd)
\r