Re: [PATCH] emacs: insert quotable parts in reply as they are displayed in show view
authorMark Walters <markwalters1009@gmail.com>
Fri, 23 Aug 2013 14:50:28 +0000 (15:50 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:56:34 +0000 (09:56 -0800)
d2/8500d8406de3755f5d7f50aaf3061ad54676d0 [new file with mode: 0644]

diff --git a/d2/8500d8406de3755f5d7f50aaf3061ad54676d0 b/d2/8500d8406de3755f5d7f50aaf3061ad54676d0
new file mode 100644 (file)
index 0000000..010cf10
--- /dev/null
@@ -0,0 +1,165 @@
+Return-Path: <m.walters@qmul.ac.uk>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id EDB60431FBC\r
+       for <notmuch@notmuchmail.org>; Fri, 23 Aug 2013 07:50:40 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.098\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
+       tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+       NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id S-35ss06HvWe for <notmuch@notmuchmail.org>;\r
+       Fri, 23 Aug 2013 07:50:36 -0700 (PDT)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 05491431FAE\r
+       for <notmuch@notmuchmail.org>; Fri, 23 Aug 2013 07:50:35 -0700 (PDT)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+       by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+       (envelope-from <m.walters@qmul.ac.uk>)\r
+       id 1VCsh3-0006KZ-UQ; Fri, 23 Aug 2013 15:50:32 +0100\r
+Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)\r
+       by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+       (envelope-from <m.walters@qmul.ac.uk>)\r
+       id 1VCsh3-0006xH-Lt; Fri, 23 Aug 2013 15:50:29 +0100\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] emacs: insert quotable parts in reply as they are\r
+       displayed in show view\r
+In-Reply-To: <1376901495-17349-1-git-send-email-jani@nikula.org>\r
+References: <1376901495-17349-1-git-send-email-jani@nikula.org>\r
+User-Agent: Notmuch/0.15.2+192~g8222af3 (http://notmuchmail.org) Emacs/23.4.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Fri, 23 Aug 2013 15:50:28 +0100\r
+Message-ID: <87ob8oh363.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 93.97.24.31\r
+X-QM-SPAM-Info: Sender has good ham record.  :)\r
+X-QM-Body-MD5: 5a552b70c6f96399f9495eb803b53df1 (of first 20000 bytes)\r
+X-SpamAssassin-Score: 0.0\r
+X-SpamAssassin-SpamBar: /\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+       determine if it is\r
+       spam. We require at least 5.0 points to mark a message as spam.\r
+       This message scored 0.0 points. Summary of the scoring: \r
+       * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+       provider *      (markwalters1009[at]gmail.com)\r
+       *  0.0 AWL AWL: From: address is in the auto white-list\r
+X-QM-Scan-Virus: ClamAV says the message is clean\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 23 Aug 2013 14:50:41 -0000\r
+\r
+\r
+Hi\r
+\r
+On Mon, 19 Aug 2013, Jani Nikula <jani@nikula.org> wrote:\r
+> In reply, insert quotable parts using notmuch-show-insert-bodypart\r
+> instead of calling notmuch-mm-display-part-inline directly to render\r
+> the quoted parts as they are rendered in show view.\r
+>\r
+> The notable change is that replies to text/calendar parts quote the\r
+> pretty printed output of icalendar-import-buffer rather than the ugly\r
+> raw vcalendar.\r
+\r
+In general I like this. \r
+\r
+I am slightly worried whether this changes replies to text/html message:\r
+from code following I think it does not but I don't have enough\r
+text/html messages to check this. (Note unless the user customises\r
+notmuch-multipart/alternative-discouraged it definitely does not affect\r
+multipart messages with a text/html alternative)\r
+\r
+If someone who does have text/html messages could test that would be\r
+very helpful.\r
+\r
+Otherwise just a couple of nits in the code:\r
+\r
+> ---\r
+>  emacs/notmuch-mua.el  |    7 ++++---\r
+>  emacs/notmuch-show.el |    9 ++++++---\r
+>  2 files changed, 10 insertions(+), 6 deletions(-)\r
+>\r
+> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
+> index 2baae5f..24b0d0f 100644\r
+> --- a/emacs/notmuch-mua.el\r
+> +++ b/emacs/notmuch-mua.el\r
+> @@ -130,9 +130,10 @@ list."\r
+>  (defun notmuch-mua-insert-quotable-part (message part)\r
+>    (save-restriction\r
+>      (narrow-to-region (point) (point))\r
+> -    (notmuch-mm-display-part-inline message part (plist-get part :id)\r
+> -                                (plist-get part :content-type)\r
+> -                                notmuch-show-process-crypto)\r
+> +    ;; We don't want hooks, such as notmuch-wash-*, to be run on the\r
+> +    ;; quotable part.\r
+> +    (let ((notmuch-show-insert-text/plain-hook nil))\r
+> +      (notmuch-show-insert-bodypart message part 0 nil t))\r
+>      (goto-char (point-max))))\r
+>  \r
+>  ;; There is a bug in emacs 23's message.el that results in a newline\r
+\r
+notmuch-show-insert-bodypart might need to be declared in notmuch-mua.el\r
+as I seem to get a compile warning.\r
+\r
+> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+> index 82b70ba..1fb48aa 100644\r
+> --- a/emacs/notmuch-show.el\r
+> +++ b/emacs/notmuch-show.el\r
+> @@ -874,7 +874,7 @@ message at DEPTH in the current thread."\r
+>        ;; showable this returns nil.\r
+>        (notmuch-show-create-part-overlays button part-beg part-end))))\r
+>  \r
+> -(defun notmuch-show-insert-bodypart (msg part depth &optional hide)\r
+> +(defun notmuch-show-insert-bodypart (msg part depth &optional hide quote)\r
+>    "Insert the body part PART at depth DEPTH in the current thread.\r
+>  \r
+>  If HIDE is non-nil then initially hide this part."\r
+> @@ -887,8 +887,11 @@ If HIDE is non-nil then initially hide this part."\r
+>                      content-type))\r
+>       (nth (plist-get part :id))\r
+>       (beg (point))\r
+> -     ;; We omit the part button for the first (or only) part if this is text/plain.\r
+> -     (button (unless (and (string= mime-type "text/plain") (<= nth 1))\r
+> +     ;; We omit the part button for the first (or only) part if\r
+> +     ;; this is text/plain, or we're inserting the part for\r
+> +     ;; quoting in reply.\r
+> +     (button (unless (or quote\r
+> +                         (and (string= mime-type "text/plain") (<= nth 1)))\r
+\r
+\r
+Since quote is the name of a lisp function I would prefer some other name\r
+for the variable. It is correct code as is but my eye sort of slipped\r
+over the initial "or" and assumed quote was the function.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+>                 (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))\r
+>       (content-beg (point)))\r
+>  \r
+> -- \r
+> 1.7.10.4\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r