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 A7251431FC3 for ; Wed, 25 Nov 2009 01:13:32 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org 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 d3U-6x5PJm1u for ; Wed, 25 Nov 2009 01:13:31 -0800 (PST) Received: from mail-yx0-f187.google.com (mail-yx0-f187.google.com [209.85.210.187]) by olra.theworths.org (Postfix) with ESMTP id 8F4DE431FBC for ; Wed, 25 Nov 2009 01:13:31 -0800 (PST) Received: by yxe17 with SMTP id 17so6439007yxe.33 for ; Wed, 25 Nov 2009 01:13:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:from:to:cc:subject :date:message-id:x-mailer:in-reply-to:references; bh=PyK/4N/jCy4clOP4LRELZRNPb7354wrI2nw4lGdxtMc=; b=xz0eRZSwVg8F4mdjZ9x0dg+a7kv3szKYgrao940qFrnC+iUwzFZge7sZtD9DiR6IcK 3Vq//Imj1Um0FS77h4CvXW31s57hD8WGp854Y+rVxKQAp1YiUVWt4YPD5UlnhXJhnywm m1xDLeVrqAn76NIXeDoUpdye5qkHyWynAH/DY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=NTJ7g1NWWya5tR0juAxEiDzZ28qxnOHeEy6IUU/cvam0TUr3fBw+28x1frfsnPbB4J /xt86tFgFNhKTN/ch81+eQnECBGv08DoDhhoRNtNbmE8bi9/IcBsss7p0S9VP+7rSGgP hHxj1cZDog4rCEClhhCtImlpyzrx6OiHhMlNE= Received: by 10.90.143.16 with SMTP id q16mr5225197agd.26.1259140411167; Wed, 25 Nov 2009 01:13:31 -0800 (PST) Received: from fortitudo (70-36-144-85.dsl.dynamic.sonic.net [70.36.144.85]) by mx.google.com with ESMTPS id 34sm302105yxf.11.2009.11.25.01.13.30 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 25 Nov 2009 01:13:30 -0800 (PST) Received: from alexbl (uid 1001) (envelope-from alexbl@fortitudo) id 710e by fortitudo (DragonFly Mail Agent) Wed, 25 Nov 2009 01:13:35 -0800 From: Alexander Botero-Lowry To: notmuch@notmuchmail.org Date: Wed, 25 Nov 2009 01:13:33 -0800 Message-Id: <1259140413-16278-2-git-send-email-alex.boterolowry@gmail.com> X-Mailer: git-send-email 1.6.5.2 In-Reply-To: <1259140413-16278-1-git-send-email-alex.boterolowry@gmail.com> References: <1259140413-16278-1-git-send-email-alex.boterolowry@gmail.com> Subject: [notmuch] [PATCH 2/2] add some very rudimentary support for handling html parts X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.12 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: Wed, 25 Nov 2009 09:13:33 -0000 I was planning to be committing super awesome mime-handling support that would make notmuch rival every mail program ever for pure mime awesomeness. It turns out, that mime is confusing and hard, and the mm-* functions do awesome things like provide different forms based on the number and composition of mime-parts in a document, so I set my first-pass goal a bit lower. What this does, is if there is an html mime-part in the message and it's the first part, it gets inlined using `mm-display-part'. This should solve the biggest problem I was facing, which is HTML only messages that I have to go into the awful mime-mode to view. This still even leaves in the Non-text part: message and all. --- notmuch.el | 41 ++++++++++++++++++++++++++++++++--------- 1 files changed, 32 insertions(+), 9 deletions(-) diff --git a/notmuch.el b/notmuch.el index 1853762..fa061c3 100644 --- a/notmuch.el +++ b/notmuch.el @@ -554,29 +554,52 @@ which this thread was originally shown." (goto-char end)))))) (forward-line)))) -(defun notmuch-show-markup-part (beg end depth) +(defun notmuch-show-markup-part (beg end depth mime-message) (if (re-search-forward notmuch-show-part-begin-regexp nil t) (progn + (if (eq mime-message nil) + (let ((filename (notmuch-show-get-filename))) + (with-temp-buffer + (insert-file-contents filename nil nil nil t) + (setq mime-message (mm-dissect-buffer))))) (forward-line) - (let ((beg (point-marker))) + (let ((part-beg (point-marker))) (re-search-forward notmuch-show-part-end-regexp) - (let ((end (copy-marker (match-beginning 0)))) - (goto-char end) + + (let ((part-end (copy-marker (match-beginning 0)))) + (goto-char part-end) (if (not (bolp)) (insert "\n")) - (indent-rigidly beg end depth) - (notmuch-show-markup-citations-region beg end depth) + (indent-rigidly part-beg part-end depth) + (save-excursion + (goto-char part-beg) + (forward-line -1) + (beginning-of-line) + (let ((handle-type (mm-handle-type mime-message)) + mime-type) + (if (sequencep (car handle-type)) + (setq mime-type (car handle-type)) + (setq mime-type (car (car (cdr handle-type)))) + ) + (if (equal mime-type "text/html") + (mm-display-part mime-message)))) + + (notmuch-show-markup-citations-region part-beg part-end depth) ; Advance to the next part (if any) (so the outer loop can ; determine whether we've left the current message. (if (re-search-forward notmuch-show-part-begin-regexp nil t) (beginning-of-line))))) - (goto-char end))) + (goto-char end)) + mime-message) (defun notmuch-show-markup-parts-region (beg end depth) (save-excursion (goto-char beg) - (while (< (point) end) - (notmuch-show-markup-part beg end depth)))) + (let (mime-message) + (while (< (point) end) + (setq mime-message + (notmuch-show-markup-part + beg end depth mime-message)))))) (defun notmuch-show-markup-body (depth btn) (re-search-forward notmuch-show-body-begin-regexp) -- 1.6.5.2