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 30161431FB6 for ; Sun, 1 Sep 2013 07:54:41 -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 Vsto+rcqyeL3 for ; Sun, 1 Sep 2013 07:54:34 -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 39199431FAE for ; Sun, 1 Sep 2013 07:54:34 -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 1VG92q-0000hU-M6; Sun, 01 Sep 2013 15:54:29 +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 1VG92q-0001FX-A5; Sun, 01 Sep 2013 15:54:28 +0100 From: Mark Walters To: Jani Nikula , notmuch@notmuchmail.org Subject: Re: [PATCH v2] emacs: insert quotable parts in reply as they are displayed in show view In-Reply-To: <87ppsvp1i9.fsf@qmul.ac.uk> References: <1377633044-22044-1-git-send-email-jani@nikula.org> <1377791611-29506-1-git-send-email-jani@nikula.org> <87ppsvp1i9.fsf@qmul.ac.uk> User-Agent: Notmuch/0.15.2+269~g01f5508 (http://notmuchmail.org) Emacs/23.4.1 (x86_64-pc-linux-gnu) Date: Sun, 01 Sep 2013 15:54:27 +0100 Message-ID: <87eh98twws.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: 2f39fcaafe68e7cdf253f1ca72370508 (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 Cc: Tomi Ollila 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 14:54:41 -0000 Here is a slightly better (I think) version of this. If we use a temp-buffer we don't need the narrowing or point movement as the insert buffer-string should get that right. Best wishes Mark >From d0925d374411cf5031832f4d72b6fb5d21a45b21 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Fri, 30 Aug 2013 17:43:46 +0100 Subject: [PATCH] tweak --- emacs/notmuch-mua.el | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index e7cc94e..ff8149b 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -130,14 +130,15 @@ list." collect part)) (defun notmuch-mua-insert-quotable-part (message part) - (save-restriction - (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)) - (goto-char (point-max)))) + ;; We don't want text properties leaking from the show renderer into + ;; the reply so we use a temp buffer. Also we don't want hooks, such + ;; as notmuch-wash-*, to be run on the quotable part so we set + ;; notmuch-show-insert-text/plain-hook to nil. + (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))))) ;; 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 -- 1.7.9.1