Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1A110431FB6 for ; Fri, 4 May 2012 12:05:12 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id spuVHow3GV2V for ; Fri, 4 May 2012 12:05:11 -0700 (PDT) Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU [18.9.25.15]) by olra.theworths.org (Postfix) with ESMTP id 3400F431FAE for ; Fri, 4 May 2012 12:05:11 -0700 (PDT) X-AuditID: 1209190f-b7f4f6d00000092b-66-4fa428657d90 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP id 87.2E.02347.56824AF4; Fri, 4 May 2012 15:05:09 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q44J59Kf000362; Fri, 4 May 2012 15:05:09 -0400 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q44J57wP017437 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Fri, 4 May 2012 15:05:08 -0400 (EDT) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) (envelope-from ) id 1SQNoR-0005PT-NA; Fri, 04 May 2012 15:05:07 -0400 From: Austin Clements To: Adam Wolfe Gordon , notmuch@notmuchmail.org Subject: Re: [PATCH 2/2] emacs: Correctly quote non-text/plain parts in reply In-Reply-To: <1335056093-17621-3-git-send-email-awg+notmuch@xvx.ca> References: <1335056093-17621-1-git-send-email-awg+notmuch@xvx.ca> <1335056093-17621-3-git-send-email-awg+notmuch@xvx.ca> User-Agent: Notmuch/0.12+132~gf2f390b (http://notmuchmail.org) Emacs/23.3.1 (i486-pc-linux-gnu) Date: Fri, 04 May 2012 15:05:07 -0400 Message-ID: <87obq3ahss.fsf@awakening.csail.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEIsWRmVeSWpSXmKPExsUixG6nrpuqscTf4OtVK4sje2axW1y/OZPZ gcnj2apbzB5NPxazBjBFcdmkpOZklqUW6dslcGUsnHiYqaBDsaJ310W2BsabUl2MnBwSAiYS 11ZuZoWwxSQu3FvP1sXIxSEksI9RYsvX/ywQznpGiQl3NjJDOCeYJKZt+M8E4SxhlLi78zE7 SD+bgIbEtv3LGUFsEQFniS3HXrOB2MICvhIvNp0A28EJFL+wZR1YXEigUuLnnYVMILaoQLzE n97NYHEWAVWJ5bc6wep5ge7r+L6QHcIWlDg58wkLiM0soCVx499LpgmMArOQpGYhSS1gZFrF KJuSW6Wbm5iZU5yarFucnJiXl1qka6KXm1mil5pSuokRFJSckvw7GL8dVDrEKMDBqMTDm8G7 xF+INbGsuDL3EKMkB5OSKG+APFCILyk/pTIjsTgjvqg0J7X4EKMEB7OSCG/S18X+QrwpiZVV qUX5MClpDhYlcV41rXd+QgLpiSWp2ampBalFMFkZDg4lCd6J6kBDBYtS01Mr0jJzShDSTByc IMN5gIYvA6nhLS5IzC3OTIfIn2JUlBLnnQuSEABJZJTmwfXCksYrRnGgV4R5t4NU8QATDlz3 K6DBTECDpQ0WgQwuSURISTUwSn5wm97gIfSb//Pv2K1ial+37Q8t7Ddojc274/3J6+Oio8f9 ZhZU85kkcNwqONlnY3qp5/uCE4+zH7ppJxvsSXH6uWbrxJnRm7jXrWmf5Rj7wihh38mXSd+/ vbFQF4gOOcL6N33d1DtTvrU0vTkWEyF2vdjs9LU/qa/0nORmHtz0PqfnyTXteiWW4oxEQy3m ouJEAGjPyyn1AgAA X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 May 2012 19:05:12 -0000 Personally I think the narrowing trick is clever, but I worry that it assumes too much about how mm-display-part works, since mm-display-part just takes a buffer in the handle. Is there a reason this doesn't simply use notmuch-show-mm-display-part-inline? Something like (untested) (defun notmuch-mua-insert-quotable-part (message part) (notmuch-show-mm-display-part-inline message part (plist-get part :id) (plist-get part :content-type))) You might not even need notmuch-mua-insert-quotable-part. (Why does notmuch-show-mm-display-part-inline take all of those redundant arguments?) If there's a reason that doesn't work, I still think it would be better to use a temporary buffer; something like (untested) (defun notmuch-mua-insert-quotable-part (message part) (let ((orig-buffer (current-buffer))) (notmuch-with-temp-part-buffer message (plist-get part :id) (let ((handle ...)) (with-current-buffer orig-buffer (mm-display-part handle)))))) In general, I feel like the reply code should share more structure with the notmuch-show code. I worry that the quoted text people wind up with may not resemble the text they saw in the show buffer because the two code paths use different rules. But addressing that (if it's addressable) should be done in a later series. On Sat, 21 Apr 2012, Adam Wolfe Gordon 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. > > 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,
This is an HTML test message.

OK?"' > test_emacs "(let ((message-hidden-headers '())) > -- > 1.7.5.4 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch