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 B1D14429E2D for ; Sun, 5 Jun 2011 17:29:39 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.921 X-Spam-Level: X-Spam-Status: No, score=-1.921 tagged_above=-999 required=5 tests=[NO_DNS_FOR_FROM=0.379, 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 FnWd37KUdLrQ for ; Sun, 5 Jun 2011 17:29:37 -0700 (PDT) Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu [131.215.239.19]) by olra.theworths.org (Postfix) with ESMTP id A450F431FB6 for ; Sun, 5 Jun 2011 17:29:37 -0700 (PDT) Received: from earth-doxen.imss.caltech.edu (localhost [127.0.0.1]) by earth-doxen-postvirus (Postfix) with ESMTP id B394E66E02A6; Sun, 5 Jun 2011 17:29:35 -0700 (PDT) X-Spam-Scanned: at Caltech-IMSS on earth-doxen by amavisd-new Received: from servo.finestructure.net (cpe-98-149-172-122.socal.res.rr.com [98.149.172.122]) (Authenticated sender: jrollins) by earth-doxen-submit (Postfix) with ESMTP id 73D3166E02D4; Sun, 5 Jun 2011 17:29:32 -0700 (PDT) Received: by servo.finestructure.net (Postfix, from userid 1000) id 2592BB52; Sun, 5 Jun 2011 17:29:31 -0700 (PDT) From: Jameson Graef Rollins To: Notmuch Mail Subject: [PATCH 5/5] emacs: Improve support for message/rfc822 parts. Date: Sun, 5 Jun 2011 17:29:29 -0700 Message-Id: <1307320169-29905-6-git-send-email-jrollins@finestructure.net> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1307320169-29905-5-git-send-email-jrollins@finestructure.net> References: <87sjrsi2b4.fsf@servo.factory.finestructure.net> <1307320169-29905-1-git-send-email-jrollins@finestructure.net> <1307320169-29905-2-git-send-email-jrollins@finestructure.net> <1307320169-29905-3-git-send-email-jrollins@finestructure.net> <1307320169-29905-4-git-send-email-jrollins@finestructure.net> <1307320169-29905-5-git-send-email-jrollins@finestructure.net> 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, 06 Jun 2011 00:29:39 -0000 The insert-part-message/rfc822 function is overhauled to properly processes the new formatting of message/rfc822 parts. The json output for message parts now includes "headers" and "body" fields, which are now parsed and output appropriately. --- emacs/notmuch-show.el | 21 +++++++++++++-------- 1 files changed, 13 insertions(+), 8 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 7d848e3..0f1fe69 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -519,21 +519,26 @@ current buffer, if possible." t) (defun notmuch-show-insert-part-message/rfc822 (msg part content-type nth depth declared-type) - (let* ((message-part (plist-get part :content)) - (inner-parts (plist-get message-part :content))) - (notmuch-show-insert-part-header nth declared-type content-type nil) + (notmuch-show-insert-part-header nth declared-type content-type nil) + (let* ((message (car (plist-get part :content))) + (headers (plist-get message :headers)) + (body (car (plist-get message :body))) + (start (point))) + ;; Override `notmuch-message-headers' to force `From' to be ;; displayed. (let ((notmuch-message-headers '("From" "Subject" "To" "Cc" "Date"))) - (notmuch-show-insert-headers (plist-get part :headers))) + (notmuch-show-insert-headers (plist-get message :headers))) + ;; Blank line after headers to be compatible with the normal ;; message display. (insert "\n") - ;; Show all of the parts. - (mapc (lambda (inner-part) - (notmuch-show-insert-bodypart msg inner-part depth)) - inner-parts)) + ;; Show the body + (notmuch-show-insert-bodypart msg body depth) + + (when notmuch-show-indent-multipart + (indent-rigidly start (point) 1))) t) (defun notmuch-show-insert-part-text/plain (msg part content-type nth depth declared-type) -- 1.7.4.4