From 066d8dc313bad90ae2dc35107ab697e217ccaa54 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Fri, 23 Aug 2013 15:50:28 +0100 Subject: [PATCH] Re: [PATCH] emacs: insert quotable parts in reply as they are displayed in show view --- d2/8500d8406de3755f5d7f50aaf3061ad54676d0 | 165 ++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 d2/8500d8406de3755f5d7f50aaf3061ad54676d0 diff --git a/d2/8500d8406de3755f5d7f50aaf3061ad54676d0 b/d2/8500d8406de3755f5d7f50aaf3061ad54676d0 new file mode 100644 index 000000000..010cf1015 --- /dev/null +++ b/d2/8500d8406de3755f5d7f50aaf3061ad54676d0 @@ -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 EDB60431FBC + for ; Fri, 23 Aug 2013 07:50:40 -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 S-35ss06HvWe for ; + Fri, 23 Aug 2013 07:50:36 -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 05491431FAE + for ; Fri, 23 Aug 2013 07:50:35 -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 1VCsh3-0006KZ-UQ; Fri, 23 Aug 2013 15:50:32 +0100 +Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71) + (envelope-from ) + id 1VCsh3-0006xH-Lt; Fri, 23 Aug 2013 15:50:29 +0100 +From: Mark Walters +To: Jani Nikula , notmuch@notmuchmail.org +Subject: Re: [PATCH] emacs: insert quotable parts in reply as they are + displayed in show view +In-Reply-To: <1376901495-17349-1-git-send-email-jani@nikula.org> +References: <1376901495-17349-1-git-send-email-jani@nikula.org> +User-Agent: Notmuch/0.15.2+192~g8222af3 (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Fri, 23 Aug 2013 15:50:28 +0100 +Message-ID: <87ob8oh363.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 93.97.24.31 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: 5a552b70c6f96399f9495eb803b53df1 (of first 20000 bytes) +X-SpamAssassin-Score: 0.0 +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 0.0 points. Summary of the scoring: + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * 0.0 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: Fri, 23 Aug 2013 14:50:41 -0000 + + +Hi + +On Mon, 19 Aug 2013, Jani Nikula wrote: +> 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. + +In general I like this. + +I am slightly worried whether this changes replies to text/html message: +from code following I think it does not but I don't have enough +text/html messages to check this. (Note unless the user customises +notmuch-multipart/alternative-discouraged it definitely does not affect +multipart messages with a text/html alternative) + +If someone who does have text/html messages could test that would be +very helpful. + +Otherwise just a couple of nits in the code: + +> --- +> emacs/notmuch-mua.el | 7 ++++--- +> emacs/notmuch-show.el | 9 ++++++--- +> 2 files changed, 10 insertions(+), 6 deletions(-) +> +> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el +> index 2baae5f..24b0d0f 100644 +> --- a/emacs/notmuch-mua.el +> +++ b/emacs/notmuch-mua.el +> @@ -130,9 +130,10 @@ list." +> (defun notmuch-mua-insert-quotable-part (message part) +> (save-restriction +> (narrow-to-region (point) (point)) +> - (notmuch-mm-display-part-inline message part (plist-get part :id) +> - (plist-get part :content-type) +> - notmuch-show-process-crypto) +> + ;; We don't want hooks, such as notmuch-wash-*, to be run on the +> + ;; quotable part. +> + (let ((notmuch-show-insert-text/plain-hook nil)) +> + (notmuch-show-insert-bodypart message part 0 nil t)) +> (goto-char (point-max)))) +> +> ;; There is a bug in emacs 23's message.el that results in a newline + +notmuch-show-insert-bodypart might need to be declared in notmuch-mua.el +as I seem to get a compile warning. + +> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +> index 82b70ba..1fb48aa 100644 +> --- a/emacs/notmuch-show.el +> +++ b/emacs/notmuch-show.el +> @@ -874,7 +874,7 @@ message at DEPTH in the current thread." +> ;; showable this returns nil. +> (notmuch-show-create-part-overlays button part-beg part-end)))) +> +> -(defun notmuch-show-insert-bodypart (msg part depth &optional hide) +> +(defun notmuch-show-insert-bodypart (msg part depth &optional hide quote) +> "Insert the body part PART at depth DEPTH in the current thread. +> +> If HIDE is non-nil then initially hide this part." +> @@ -887,8 +887,11 @@ If HIDE is non-nil then initially hide this part." +> content-type)) +> (nth (plist-get part :id)) +> (beg (point)) +> - ;; We omit the part button for the first (or only) part if this is text/plain. +> - (button (unless (and (string= mime-type "text/plain") (<= nth 1)) +> + ;; We omit the part button for the first (or only) part if +> + ;; this is text/plain, or we're inserting the part for +> + ;; quoting in reply. +> + (button (unless (or quote +> + (and (string= mime-type "text/plain") (<= nth 1))) + + +Since quote is the name of a lisp function I would prefer some other name +for the variable. It is correct code as is but my eye sort of slipped +over the initial "or" and assumed quote was the function. + +Best wishes + +Mark + +> (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename)))) +> (content-beg (point))) +> +> -- +> 1.7.10.4 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch -- 2.26.2