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 830864196F3 for ; Tue, 20 Apr 2010 00:16:38 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] autolearn=ham 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 AcwwCjFG4BrZ for ; Tue, 20 Apr 2010 00:16:36 -0700 (PDT) Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36]) by olra.theworths.org (Postfix) with ESMTP id 9C2934196F2 for ; Tue, 20 Apr 2010 00:16:36 -0700 (PDT) Received: from localhost (unknown [192.168.200.4]) by max.feld.cvut.cz (Postfix) with ESMTP id 8E8B519F339C for ; Tue, 20 Apr 2010 09:16:35 +0200 (CEST) X-Virus-Scanned: IMAP AMAVIS Received: from max.feld.cvut.cz ([192.168.200.1]) by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new, port 10044) with ESMTP id V4doBOZl6kYu for ; Tue, 20 Apr 2010 09:16:34 +0200 (CEST) Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34]) by max.feld.cvut.cz (Postfix) with ESMTP id 003F319F3361 for ; Tue, 20 Apr 2010 09:16:33 +0200 (CEST) Received: from steelpick.2x.cz (k335-30.felk.cvut.cz [147.32.86.30]) (Authenticated sender: sojkam1) by imap.feld.cvut.cz (Postfix) with ESMTPSA id ECFFAFA004 for ; Tue, 20 Apr 2010 09:16:33 +0200 (CEST) Received: from wsh by steelpick.2x.cz with local (Exim 4.71) (envelope-from ) id 1O47hB-0004Yv-Ng for notmuch@notmuchmail.org; Tue, 20 Apr 2010 09:16:33 +0200 From: Michal Sojka To: notmuch@notmuchmail.org Subject: [PATCH 2/2] emacs: Access raw messages through cat subcommand Date: Tue, 20 Apr 2010 09:16:33 +0200 Message-Id: <1271747793-17507-2-git-send-email-sojkam1@fel.cvut.cz> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1271747793-17507-1-git-send-email-sojkam1@fel.cvut.cz> References: <1271747793-17507-1-git-send-email-sojkam1@fel.cvut.cz> 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: Tue, 20 Apr 2010 07:16:38 -0000 The following commands now access the messages via the cat subcommand: view/save attachments, view raw message and pipe message to command. With this patch, it is straightforward to use notmuch emacs interface with a remote database accessed over SSH. To do this, it is sufficient to redefine notmuch-command variable to contain the name of a script containing: ssh user@host notmuch "$@" If the ssh client has enabled connection sharing (ControlMaster option in OpenSSH), the emacs interface is almost as responsive as with local invocation. Signed-off-by: Michal Sojka --- emacs/notmuch-show.el | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 81276d9..29a726e 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -328,7 +328,11 @@ buffer." (defun notmuch-show-view-raw-message () "View the raw email of the current message." (interactive) - (view-file (notmuch-show-get-filename))) + (let ((filename (notmuch-show-get-filename))) + (let ((buf (get-buffer-create (concat "*notmuch-raw-" filename "*")))) + (switch-to-buffer buf) + (save-excursion + (call-process notmuch-command nil t nil "cat" filename))))) (defmacro with-current-notmuch-show-message (&rest body) "Evaluate body with current buffer set to the text of current message" @@ -336,7 +340,7 @@ buffer." (let ((filename (notmuch-show-get-filename))) (let ((buf (generate-new-buffer (concat "*notmuch-msg-" filename "*")))) (with-current-buffer buf - (insert-file-contents filename nil nil nil t) + (call-process notmuch-command nil t nil "cat" filename) ,@body) (kill-buffer buf))))) @@ -390,7 +394,8 @@ current email message as stdin. Anything printed by the command to stdout or stderr will appear in the *Messages* buffer." (interactive "sPipe message to command: ") (apply 'start-process-shell-command "notmuch-pipe-command" "*notmuch-pipe*" - (list command " < " (shell-quote-argument (notmuch-show-get-filename))))) + (list notmuch-command "cat" + (shell-quote-argument (notmuch-show-get-filename)) " | " command))) (defun notmuch-show-move-to-current-message-summary-line () "Move to the beginning of the one-line summary of the current message. -- 1.7.0.4