mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 10:58:10 +01:00
Factor out message buffer mgmt from notmuch-show-view-all-mime-parts
The ability to temporarily create a buffer containing only the contents of the currently selected message in notmuch show mode is generally useful. This commit factors the majority of the code required to do so out of notmuch-show-view-all-mime-parts into a macro called with-current-notmuch-show-message and rewrites the original function in terms of the macro. A future set of commits will provide additional functionality using the macro as well.
This commit is contained in:
parent
30bdcfe651
commit
c4463d4cb4
1 changed files with 12 additions and 8 deletions
20
notmuch.el
20
notmuch.el
|
@ -283,17 +283,21 @@ buffer."
|
||||||
(interactive)
|
(interactive)
|
||||||
(view-file (notmuch-show-get-filename)))
|
(view-file (notmuch-show-get-filename)))
|
||||||
|
|
||||||
|
(defmacro with-current-notmuch-show-message (&rest body)
|
||||||
|
"Evaluate body with current buffer set to the text of current message"
|
||||||
|
`(save-excursion
|
||||||
|
(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)
|
||||||
|
,@body)
|
||||||
|
(kill-buffer buf)))))
|
||||||
|
|
||||||
(defun notmuch-show-view-all-mime-parts ()
|
(defun notmuch-show-view-all-mime-parts ()
|
||||||
"Use external viewers (according to mailcap) to view all MIME-encoded parts."
|
"Use external viewers (according to mailcap) to view all MIME-encoded parts."
|
||||||
(interactive)
|
(interactive)
|
||||||
(save-excursion
|
(with-current-notmuch-show-message
|
||||||
(let ((filename (notmuch-show-get-filename)))
|
(mm-display-parts (mm-dissect-buffer))))
|
||||||
(switch-to-buffer (generate-new-buffer (concat "*notmuch-mime-"
|
|
||||||
filename
|
|
||||||
"*")))
|
|
||||||
(insert-file-contents filename nil nil nil t)
|
|
||||||
(mm-display-parts (mm-dissect-buffer))
|
|
||||||
(kill-this-buffer))))
|
|
||||||
|
|
||||||
(defun notmuch-reply (query-string)
|
(defun notmuch-reply (query-string)
|
||||||
(switch-to-buffer (generate-new-buffer "notmuch-draft"))
|
(switch-to-buffer (generate-new-buffer "notmuch-draft"))
|
||||||
|
|
Loading…
Reference in a new issue