From 327841c17ac17243c1882e7feec0b303bde7cc18 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Sat, 31 Aug 2013 13:18:07 +2000 Subject: [PATCH] Re: [PATCH v2] emacs: insert quotable parts in reply as they are displayed in show view --- c7/721d6f8e3d4fb91350e8126aa0ede6cf76078d | 131 ++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 c7/721d6f8e3d4fb91350e8126aa0ede6cf76078d diff --git a/c7/721d6f8e3d4fb91350e8126aa0ede6cf76078d b/c7/721d6f8e3d4fb91350e8126aa0ede6cf76078d new file mode 100644 index 000000000..d875878be --- /dev/null +++ b/c7/721d6f8e3d4fb91350e8126aa0ede6cf76078d @@ -0,0 +1,131 @@ +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 5BF93431FD2 + for ; Sun, 1 Sep 2013 00:14:03 -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 rZQswIS7T7Be for ; + Sun, 1 Sep 2013 00:13:55 -0700 (PDT) +Received: from dmz-mailsec-scanner-2.mit.edu (dmz-mailsec-scanner-2.mit.edu + [18.9.25.13]) + by olra.theworths.org (Postfix) with ESMTP id 4AD58407BC7 + for ; Fri, 30 Aug 2013 10:18:16 -0700 (PDT) +X-AuditID: 1209190d-b7f078e000000937-46-5220d3d4a619 +Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) + by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP + id B1.25.02359.4D3D0225; Fri, 30 Aug 2013 13:18:12 -0400 (EDT) +Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) + by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id r7UHIA8h005553; + Fri, 30 Aug 2013 13:18:11 -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.8/8.12.4) with ESMTP id r7UHI73T028805 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); + Fri, 30 Aug 2013 13:18:09 -0400 +Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80) + (envelope-from ) + id 1VFSKl-0003MR-Gg; Fri, 30 Aug 2013 13:18:07 -0400 +Date: Fri, 30 Aug 2013 13:18:07 -0400 +From: Austin Clements +To: Mark Walters +Subject: Re: [PATCH v2] emacs: insert quotable parts in reply as they are + displayed in show view +Message-ID: <20130830171807.GB20236@mit.edu> +References: <1377633044-22044-1-git-send-email-jani@nikula.org> + <1377791611-29506-1-git-send-email-jani@nikula.org> + <87ppsvp1i9.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <87ppsvp1i9.fsf@qmul.ac.uk> +User-Agent: Mutt/1.5.21 (2010-09-15) +X-Brightmail-Tracker: + H4sIAAAAAAAAA01SW0hTYRzv2znbzuZOHI+an7pKhpGYc1ZSi0JkFoz1ooIvQeSZ+9xGu3XO + XGqEYiC2wjQDdaZoKuYy1KyVL5ZTCI2gtPBG+qJiWkGC0UNK5zhvb7//97t9NwKjn4pjCavD + jVgHY1NJ5DgtTT+u/jIRn5M63arUltdlap81KbST0w2Y9kdXszgD1w/4vkn1w+utuH5mflWq + X/LPYFn4FfkFE7JZPYjVpOfJLd7yfszVHl70arEZLwOTpBcQBKTS4PCIzgtkPDwEP831SLxA + TtDUIIBjwfui0NAHYG3NKBYaPojgcs2UNDS0AxhYWMYFP04dg/dez21hCZUIA287gYAjqWQ4 + G2yRChijEOyYXRUJOIIywof++i0NyWvKF/5sN9QC2D3g2ybC4WjDAh4yJ8Gpze8iYd8YFQc7 + NwlhWcZ3dTxZ2sqPohLgo9GApBrQvn1u3z63b8/dAjA/OGyyl6jtjNXGoXw1l884HIhVn0qx + W90pyFT4AgjXL4sh34BfQ6ogoAigUpB5HfE5tJjxcMX2IIghRKoo8vxnfumg0WkqtjCc5Rpb + aENcEEACU0WSv9t4jjQxxSWIde5QcQSuiiYXFz9m05SZcaPrCLkQu8MqCUIFyQT+yelwFplR + UYHV5t6jRYRMCFfw4ZGChuRcjJ2zmkP8GDhN/OtqWgPE4J3mNUDjDqcDxUaTYYKUEqSWQsdu + 2s4HWwHR/OEiyI1xXqXgv99u3gpfJeKrqp1HhCo3s0fFloESZbcT16aCbG9BxcStpquGizF1 + qXMRmYn95xqnlLoKCEx5a+Mpz3PfMZWlRs3tXHHD0IrxbvaAverGfL2hB19PPBp4sNxYcPOn + 7m+vOv2l2X827ERlWsWlrsBlg+eMIstjq2LaSzUbUY+TDxj62nondK73X8W9s2MjGiWZocI5 + C3MyCWM55j/TLyYvOwMAAA== +Cc: Tomi Ollila , notmuch@notmuchmail.org +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, 01 Sep 2013 07:14:03 -0000 + +Quoth Mark Walters on Aug 30 at 5:49 pm: +> +> > In reply, insert quotable parts using notmuch-show-insert-bodypart +> > instead of calling notmuch-mm-display-part-inline directly to render +> > the quoted parts as they are rendered in show view. +> > +> > The notable change is that replies to text/calendar parts quote the +> > pretty printed output of icalendar-import-buffer rather than the ugly +> > raw vcalendar. +> +> I slightly worry that some text-properties or similar from notmuch-show +> could make their way into the reply buffer: in particular it would be +> very bad if any invisible character made it into the buffer. I don't +> think this is actually a problem currently but just in case (and to +> avoid future problems) how about the following on top of the parent +> patch? + +I haven't tested this, but I like the idea. It won't actually help +with invisible text (though we could fix that in the future if +necessary), but there are plenty of other properties and overlays you +wouldn't want bleeding into the reply buffer. This puts a clear wall +between the potentially interactive but read-only show output and the +plain but editable reply text. + +> Best wishes +> +> Mark +> +> --- +> emacs/notmuch-mua.el | 8 +++++--- +> 1 files changed, 5 insertions(+), 3 deletions(-) +> +> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el +> index e7cc94e..9e4a232 100644 +> --- a/emacs/notmuch-mua.el +> +++ b/emacs/notmuch-mua.el +> @@ -134,9 +134,11 @@ list." +> (narrow-to-region (point-min) (point)) +> ;; We don't want hooks, such as notmuch-wash-*, to be run on the +> ;; quotable part. +> - (let ((notmuch-show-insert-text/plain-hook nil)) +> - ;; Show the part but do not add buttons. +> - (notmuch-show-insert-bodypart message part 0 'no-buttons)) +> + (insert (with-temp-buffer +> + (let ((notmuch-show-insert-text/plain-hook nil)) +> + ;; Show the part but do not add buttons. +> + (notmuch-show-insert-bodypart message part 0 'no-buttons)) +> + (buffer-substring-no-properties (point-min) (point-max)))) +> (goto-char (point-max)))) +> +> ;; There is a bug in emacs 23's message.el that results in a newline -- 2.26.2