From 988320ad74b9c6256a9b9641128bc38822bbd981 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 4 Nov 2009 15:53:41 -0800 Subject: [PATCH] notmuch.el: Add 'w' binding to view raW email message. This takes advantage of the new filename output just added to "notmuch show". --- notmuch.el | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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. -- 2.26.2