aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch.el
diff options
context:
space:
mode:
authorGravatar Carl Worth <cworth@cworth.org>2009-11-04 15:53:41 -0800
committerGravatar Carl Worth <cworth@cworth.org>2009-11-04 15:53:41 -0800
commit988320ad74b9c6256a9b9641128bc38822bbd981 (patch)
tree325bef58bbd2e5e317fabd0ff3d2d3812f9b46f0 /notmuch.el
parentb1baaab2d53426b44adbbe93b067708a528edad0 (diff)
notmuch.el: Add 'w' binding to view raW email message.
This takes advantage of the new filename output just added to "notmuch show".
Diffstat (limited to 'notmuch.el')
-rw-r--r--notmuch.el17
1 files changed, 16 insertions, 1 deletions
diff --git a/notmuch.el b/notmuch.el
index 7459d786..fc7c48cd 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -38,6 +38,7 @@
(define-key map (kbd "C-p") 'notmuch-show-previous-line)
(define-key map "q" 'kill-this-buffer)
(define-key map "s" 'notmuch-show-toggle-signatures-visible)
+ (define-key map "w" 'notmuch-show-view-raw-message)
(define-key map "x" 'kill-this-buffer)
(define-key map "+" 'notmuch-show-add-tag)
(define-key map "-" 'notmuch-show-remove-tag)
@@ -61,7 +62,8 @@
(set 'notmuch-show-part-end-regexp " part}")
(set 'notmuch-show-marker-regexp " \\(message\\|header\\|body\\|attachment\\|part\\)[{}].*$")
-(set 'notmuch-show-id-regexp "ID: \\(.*\\)$")
+(set 'notmuch-show-id-regexp "ID: \\([^ ]*\\)")
+(set 'notmuch-show-filename-regexp "Filename: \\(.*\\)$")
(set 'notmuch-show-tags-regexp "(\\([^)]*\\))$")
; XXX: This should be a generic function in emacs somewhere, not here
@@ -110,6 +112,14 @@ Unlike builtin `next-line' this version accepts no arguments."
(re-search-forward notmuch-show-id-regexp)
(buffer-substring (match-beginning 1) (match-end 1))))
+(defun notmuch-show-get-filename ()
+ (save-excursion
+ (beginning-of-line)
+ (if (not (looking-at notmuch-show-message-begin-regexp))
+ (re-search-backward notmuch-show-message-begin-regexp))
+ (re-search-forward notmuch-show-filename-regexp)
+ (buffer-substring (match-beginning 1) (match-end 1))))
+
(defun notmuch-show-set-tags (tags)
(save-excursion
(beginning-of-line)
@@ -171,6 +181,11 @@ buffer."
(switch-to-buffer parent-buffer)
(notmuch-search-show-thread)))))
+(defun notmuch-show-view-raw-message ()
+ "View the raw email of the current message."
+ (interactive)
+ (view-file (notmuch-show-get-filename)))
+
(defun notmuch-show-move-to-current-message-summary-line ()
"Move to the beginning of the one-line summary of the current message.