From: Mark Walters Date: Sun, 22 Apr 2012 08:10:59 +0000 (+0100) Subject: Re: [PATCH 2/2] emacs: Correctly quote non-text/plain parts in reply X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=e00994be3bf174674c14243cea54475c6e4ebf8e;p=notmuch-archives.git Re: [PATCH 2/2] emacs: Correctly quote non-text/plain parts in reply --- diff --git a/62/d401d07fe2572a820d33a6d4b1afd960b63710 b/62/d401d07fe2572a820d33a6d4b1afd960b63710 new file mode 100644 index 000000000..b1949d4da --- /dev/null +++ b/62/d401d07fe2572a820d33a6d4b1afd960b63710 @@ -0,0 +1,165 @@ +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 37C2C431FAF + for ; Sun, 22 Apr 2012 01:10:43 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -1.098 +X-Spam-Level: +X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 uQpihxlSZPYD for ; + Sun, 22 Apr 2012 01:10:42 -0700 (PDT) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 511EF431FAE + for ; Sun, 22 Apr 2012 01:10:42 -0700 (PDT) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1SLrsW-0002Jf-GX; Sun, 22 Apr 2012 09:10:40 +0100 +Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223] + helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) + (envelope-from ) + id 1SLrsW-0000RR-5S; Sun, 22 Apr 2012 09:10:40 +0100 +From: Mark Walters +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+110~gbc97b4a (http://notmuchmail.org) Emacs/23.3.1 + (x86_64-pc-linux-gnu) +Date: Sun, 22 Apr 2012 09:10:59 +0100 +Message-ID: <87hawcuqy4.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 94.192.233.223 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: a7785dd892df14389f9af2d32dbb5335 (of first 20000 bytes) +X-SpamAssassin-Score: -1.8 +X-SpamAssassin-SpamBar: - +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored -1.8 points. + Summary of the scoring: + * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, + * medium trust + * [138.37.6.40 listed in list.dnswl.org] + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay + * domain + * 0.5 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is clean +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: Sun, 22 Apr 2012 08:10:43 -0000 + +On Sun, 22 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. + +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,
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