X-Git-Url: https://git.notmuchmail.org/git?p=notmuch-wiki;a=blobdiff_plain;f=emacstips.mdwn;h=f5b418c6700cec7588040ed85a4b80248ceb528e;hp=04c85219c6d80a95922bc0571984b2d662b3d555;hb=0364b91f49267bb59ef4a70f78114673f9b3efb0;hpb=a88f545ad6b18eb609ace3f0fd3412bdaebe99ce diff --git a/emacstips.mdwn b/emacstips.mdwn index 04c8521..f5b418c 100644 --- a/emacstips.mdwn +++ b/emacstips.mdwn @@ -700,25 +700,27 @@ refine, next hunk etc all work. "View the the current message as a patch." (interactive) (let* ((id (notmuch-show-get-message-id)) + (msg (notmuch-show-get-message-properties)) + (part (notmuch-show-get-part-properties)) (subject (concat "Subject: " (notmuch-show-get-subject) "\n")) (diff-default-read-only t) (buf (get-buffer-create (concat "*notmuch-patch-" id "*"))) (map (make-sparse-keymap))) - (define-key map "q" 'notmuch-kill-this-buffer) + (define-key map "q" 'notmuch-bury-or-kill-this-buffer) (switch-to-buffer buf) (let ((inhibit-read-only t)) (erase-buffer) (insert subject) - (insert (notmuch-get-bodypart-internal id 1 nil))) + (insert (notmuch-get-bodypart-text msg part nil))) (set-buffer-modified-p nil) (diff-mode) (lexical-let ((new-ro-bind (cons 'buffer-read-only map))) (add-to-list 'minor-mode-overriding-map-alist new-ro-bind)) (goto-char (point-min)))) -and then this function needs to bound into the keymap with something like +and then this function needs to bound to `. d` in the keymap - (define-key 'notmuch-show-mode-map "D" 'my-notmuch-show-view-as-patch) + (define-key 'notmuch-show-part-map "d" 'my-notmuch-show-view-as-patch) ## Interfacing with Patchwork