]> git.notmuchmail.org Git - notmuch/commitdiff
emacs: Use `view-mode' when examining raw messages.
authorDavid Edmondson <dme@dme.org>
Mon, 15 Nov 2010 14:21:53 +0000 (14:21 +0000)
committerCarl Worth <cworth@cworth.org>
Tue, 16 Nov 2010 19:16:59 +0000 (11:16 -0800)
Explained-by: Carl Worth: This gives convenient keybindings for
navigating the file and for quitting from the buffer, (since, with a
raw message file the user will generally want to just view the
message, not edit it).

emacs/notmuch-show.el

index d8773e65d90dbfeff5ad4e8fda91d4d07c402ca5..3a60d4308470c5643975741d21912c4ac49d89bc 100644 (file)
@@ -935,11 +935,13 @@ any effects from previous calls to
 (defun notmuch-show-view-raw-message ()
   "View the file holding the current message."
   (interactive)
 (defun notmuch-show-view-raw-message ()
   "View the file holding the current message."
   (interactive)
-  (let ((id (notmuch-show-get-message-id)))
-    (let ((buf (get-buffer-create (concat "*notmuch-raw-" id "*"))))
-      (switch-to-buffer buf)
-      (save-excursion
-       (call-process notmuch-command nil t nil "show" "--format=raw" id)))))
+  (let* ((id (notmuch-show-get-message-id))
+        (buf (get-buffer-create (concat "*notmuch-raw-" id "*"))))
+    (call-process notmuch-command nil buf nil "show" "--format=raw" id)
+    (switch-to-buffer buf)
+    (goto-char (point-min))
+    (set-buffer-modified-p nil)
+    (view-buffer buf 'kill-buffer-if-not-modified)))
 
 (defun notmuch-show-pipe-message (entire-thread command)
   "Pipe the contents of the current message (or thread) to the given command.
 
 (defun notmuch-show-pipe-message (entire-thread command)
   "Pipe the contents of the current message (or thread) to the given command.