aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs/notmuch-lib.el
diff options
context:
space:
mode:
authorGravatar Adam Wolfe Gordon <awg+notmuch@xvx.ca>2012-05-05 13:30:37 -0600
committerGravatar David Bremner <bremner@debian.org>2012-05-06 08:48:11 -0300
commitf6c170fabca8f39e74705e3813504137811bf162 (patch)
tree9f3d4875f44a5c2732ab7e47512799cf92473f2a /emacs/notmuch-lib.el
parent7fb8ab9f0b470dc236c92686ed33f8e0fa1d5727 (diff)
emacs: Correctly quote non-text/plain parts in reply
Quote non-text parts nicely by displaying them with mm-display-part before calling message-cite-original to quote them. HTML-only emails can now be quoted correctly. We re-use some code from notmuch-show (notmuch-show-mm-display-part-inline), which has been moved to notmuch-lib.el. Mark the test for this feature as not broken.
Diffstat (limited to 'emacs/notmuch-lib.el')
-rw-r--r--emacs/notmuch-lib.el19
1 files changed, 19 insertions, 0 deletions
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 6907a5f9..7fa441af 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -21,6 +21,8 @@
;; This is an part of an emacs-based interface to the notmuch mail system.
+(require 'mm-view)
+(require 'mm-decode)
(eval-when-compile (require 'cl))
(defvar notmuch-command "notmuch"
@@ -237,6 +239,23 @@ the given type."
(or (plist-get part :content)
(notmuch-get-bodypart-internal (notmuch-id-to-query (plist-get msg :id)) nth process-crypto)))
+(defun notmuch-mm-display-part-inline (msg part nth content-type process-crypto)
+ "Use the mm-decode/mm-view functions to display a part in the
+current buffer, if possible."
+ (let ((display-buffer (current-buffer)))
+ (with-temp-buffer
+ (let* ((charset (plist-get part :content-charset))
+ (handle (mm-make-handle (current-buffer) `(,content-type (charset . ,charset)))))
+ ;; If the user wants the part inlined, insert the content and
+ ;; test whether we are able to inline it (which includes both
+ ;; capability and suitability tests).
+ (when (mm-inlined-p handle)
+ (insert (notmuch-get-bodypart-content msg part nth process-crypto))
+ (when (mm-inlinable-p handle)
+ (set-buffer display-buffer)
+ (mm-display-part handle)
+ t))))))
+
;; Converts a plist of headers to an alist of headers. The input plist should
;; have symbols of the form :Header as keys, and the resulting alist will have
;; symbols of the form 'Header as keys.