From 2cc67f424220ab58866287d1a7a82c085e0465d9 Mon Sep 17 00:00:00 2001 From: Adam Wolfe Gordon Date: Sun, 22 Apr 2012 18:54:53 +1800 Subject: [PATCH] [PATCH 2/2] emacs: Correctly quote non-text/plain parts in reply --- a6/766cfd3d063916fc10b6e835d5b2275f104cbc | 123 ++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 a6/766cfd3d063916fc10b6e835d5b2275f104cbc diff --git a/a6/766cfd3d063916fc10b6e835d5b2275f104cbc b/a6/766cfd3d063916fc10b6e835d5b2275f104cbc new file mode 100644 index 000000000..216b5bbd4 --- /dev/null +++ b/a6/766cfd3d063916fc10b6e835d5b2275f104cbc @@ -0,0 +1,123 @@ +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 46518431FC0 + for ; Sat, 21 Apr 2012 17:55:07 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_NONE=-0.0001] 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 Ig1ZCXn0vodQ for ; + Sat, 21 Apr 2012 17:54:56 -0700 (PDT) +Received: from idcmail-mo2no.shaw.ca (idcmail-mo2no.shaw.ca [64.59.134.9]) + by olra.theworths.org (Postfix) with ESMTP id 4B3B3431FAE + for ; Sat, 21 Apr 2012 17:54:56 -0700 (PDT) +Received: from lb7f8hsrpno-svcs.dcs.int.inet (HELO pd7ml2no-ssvc.prod.shaw.ca) + ([10.0.144.222]) + by pd7mo1no-svcs.prod.shaw.ca with ESMTP; 21 Apr 2012 18:54:55 -0600 +X-Cloudmark-SP-Filtered: true +X-Cloudmark-SP-Result: v=1.1 cv=GZn8e3lTBEeJrlGK3+GUWyR5aYe1SJcDn5uEERMe9yQ= + c=1 sm=1 + a=B06ZCV3J_Z4A:10 a=BLceEmwcHowA:10 a=yQp6g8lIsgqumF79BAsFDg==:17 + a=m7wnEdaWTtPIwypKjJwA:9 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 +Received: from unknown (HELO lagos.xvx.ca) ([96.52.216.56]) + by pd7ml2no-dmz.prod.shaw.ca with ESMTP; 21 Apr 2012 18:54:55 -0600 +Received: by lagos.xvx.ca (Postfix, from userid 1000) + id EEBB48004814; Sat, 21 Apr 2012 18:54:54 -0600 (MDT) +From: Adam Wolfe Gordon +To: notmuch@notmuchmail.org +Subject: [PATCH 2/2] emacs: Correctly quote non-text/plain parts in reply +Date: Sat, 21 Apr 2012 18:54:53 -0600 +Message-Id: <1335056093-17621-3-git-send-email-awg+notmuch@xvx.ca> +X-Mailer: git-send-email 1.7.5.4 +In-Reply-To: <1335056093-17621-1-git-send-email-awg+notmuch@xvx.ca> +References: <1335056093-17621-1-git-send-email-awg+notmuch@xvx.ca> +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 00:55:07 -0000 + +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 + -- 2.26.2