On Sun, 22 Apr 2012, Adam Wolfe Gordon <awg+notmuch@xvx.ca> wrote: > 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. My instinct would have been to do this with a temporary buffer rather than the narrowing but I am *definitely* too much of a lisp beginner to say that either is better. (I think notmuch-show-mm-display-part-inline uses the temporary buffer approach.) Anyway, as it is, it looks correct and seems to work! (and is obviously useful functionality) Best wishes Mark > Mark the test for this feature as not broken. > --- > emacs/notmuch-mua.el | 20 +++++++++++++++----- > test/emacs | 1 - > 2 files changed, 15 insertions(+), 6 deletions(-) > > diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el > index 87bd88d..f7af789 100644 > --- a/emacs/notmuch-mua.el > +++ b/emacs/notmuch-mua.el > @@ -21,6 +21,7 @@ > > (require 'json) > (require 'message) > +(require 'mm-view) > (require 'format-spec) > > (require 'notmuch-lib) > @@ -90,6 +91,19 @@ list." > else if (notmuch-match-content-type (plist-get part :content-type) "text/*") > collect part)) > > +(defun notmuch-mua-insert-quotable-part (message part) > + (save-restriction > + (narrow-to-region (point) (point)) > + (insert (notmuch-get-bodypart-content message part > + (plist-get part :id) > + notmuch-show-process-crypto)) > + (let ((handle (mm-make-handle (current-buffer) > + (list (plist-get part :content-type)))) > + (end-of-orig (point-max))) > + (mm-display-part handle) > + (kill-region (point-min) end-of-orig)) > + (goto-char (point-max)))) > + > ;; There is a bug in emacs 23's message.el that results in a newline > ;; not being inserted after the References header, so the next header > ;; is concatenated to the end of it. This function fixes the problem, > @@ -169,11 +183,7 @@ list." > ;; Get the parts of the original message that should be quoted; this includes > ;; all the text parts, except the non-preferred ones in a multipart/alternative. > (let ((quotable-parts (notmuch-mua-get-quotable-parts (plist-get original :body)))) > - (mapc (lambda (part) > - (insert (notmuch-get-bodypart-content original part > - (plist-get part :id) > - notmuch-show-process-crypto))) > - quotable-parts)) > + (mapc (apply-partially 'notmuch-mua-insert-quotable-part original) quotable-parts)) > > (set-mark (point)) > (goto-char start) > diff --git a/test/emacs b/test/emacs > index e648f80..579844f 100755 > --- a/test/emacs > +++ b/test/emacs > @@ -445,7 +445,6 @@ EOF > test_expect_equal_file OUTPUT EXPECTED > > test_begin_subtest "Reply within emacs to an html-only message" > -test_subtest_known_broken > add_message '[content-type]="text/html"' \ > '[body]="Hi,<br />This is an <b>HTML</b> test message.<br /><br />OK?"' > test_emacs "(let ((message-hidden-headers '())) > -- > 1.7.5.4 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch