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 <sojkam1@fel.cvut.cz> --- 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