From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 91588431FDC for ; Mon, 19 Aug 2013 01:38:22 -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 DZq697wWaxWv for ; Mon, 19 Aug 2013 01:38:15 -0700 (PDT) Received: from mail-bk0-f41.google.com (mail-bk0-f41.google.com [209.85.214.41]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id CE7C3431FBD for ; Mon, 19 Aug 2013 01:38:14 -0700 (PDT) Received: by mail-bk0-f41.google.com with SMTP id na10so1334627bkb.14 for ; Mon, 19 Aug 2013 01:38:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=e/LQhyA7rjusE9XyBJ0qgcGNiPMc7WR0DpiIINMgpEk=; b=MwuUGhN/2ErSWqOi6qax5FcesD9EPFfBQo8r2/JU57XONDNR3fvO4D8+P5X7FYPWoe U2BIOqOsT/81Kc4Hm8Q8JgAFLvLh/PxKU8I2vwz0BXWeMviDPtjuo8dKMEHfqSzjGwDV SfsPo8EUDxSjfiI9Umxp9X26GuBnbPe8unwCXN2tKedKakngt8kHG/Gaq/ue3IIlXheR kcCR/bDuYtNGHntSgr5cZeq2wC6tpfwEY1HRf5r5GbFVdXGk7wfkpPePOSBi2i25AmJ2 X+5Cukuxbu2LkHlSsgskALXIrvQ6X+FQxH3ibIyLvzdOxzVMbo3XI/1an8VXSSn4Jj7y k10Q== X-Gm-Message-State: ALoCoQknIJg+P1EgcjWdisQh/UAZIWu1jdhL68FoukG1kvU5tc3cbv0E/zAE5abiAIEVazD9hjW4 X-Received: by 10.205.10.200 with SMTP id pb8mr7149161bkb.16.1376901493489; Mon, 19 Aug 2013 01:38:13 -0700 (PDT) Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi. [88.195.111.91]) by mx.google.com with ESMTPSA id if11sm1421624bkc.15.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 19 Aug 2013 01:38:12 -0700 (PDT) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [PATCH] emacs: insert quotable parts in reply as they are displayed in show view Date: Mon, 19 Aug 2013 11:38:15 +0300 Message-Id: <1376901495-17349-1-git-send-email-jani@nikula.org> X-Mailer: git-send-email 1.7.10.4 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: Mon, 19 Aug 2013 08:38:22 -0000 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. --- 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 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))) (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename)))) (content-beg (point))) -- 1.7.10.4