From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: org-mime spurious alternative Date: Thu, 12 Jun 2014 14:42:03 -0400 Message-ID: <87tx7px4u0.fsf@gmail.com> References: <20140610171252.707@usenet.piggo.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49750) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvBPV-0004wS-US for emacs-orgmode@gnu.org; Thu, 12 Jun 2014 16:15:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WvBPR-0008Um-32 for emacs-orgmode@gnu.org; Thu, 12 Jun 2014 16:15:45 -0400 Received: from mail-ob0-x22c.google.com ([2607:f8b0:4003:c01::22c]:44204) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvBPQ-0008Uf-OL for emacs-orgmode@gnu.org; Thu, 12 Jun 2014 16:15:40 -0400 Received: by mail-ob0-f172.google.com with SMTP id uy5so1919689obc.31 for ; Thu, 12 Jun 2014 13:15:39 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: =?utf-8?Q?S=C3=A9bastien?= Delafond Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable S=C3=A9bastien Delafond writes: > Hello, > > from Debian bug #751014 (http://bugs.debian.org/751014): > > When org-mime-library is set to semi, org-mime generates a spurious > alternative section around the HTML part. This is due to two bugs in > the function org-mime-multipart: > > 1. it attempts to put a multipart/alternative section around the HTML, > where it should be putting a multipart/related part; > > 2. it tests for the presence of images by doing "(when images ...)", > which triggers when images is the empty string (somebody has been > programming in Python or Javascript?). > > To repeat: > > M-x load-library "org-mime" RET > M-: (setq org-mime-library 'semi) RET > M-x wl RET > w > > Then insert some text below the separator line, and do > > M-x org-mime-htmlize > > and see the breakage. > > Cheers, > > --Seb > > Does the attached patch fix these problems? Thanks, Eric --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-fix-semi-backend-bug-in-org-mime.patch >From 9af18107bd82fb9778b87b5891b1772fb847cc74 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Thu, 12 Jun 2014 14:40:32 -0400 Subject: [PATCH] fix semi-backend bug in org-mime * contrib/lisp/org-mime.el (org-mime-multipart): Fix bug in use of the semi org-mime-library when converting emails to HTML. --- contrib/lisp/org-mime.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/contrib/lisp/org-mime.el b/contrib/lisp/org-mime.el index 5f874d9..44bf91b 100644 --- a/contrib/lisp/org-mime.el +++ b/contrib/lisp/org-mime.el @@ -163,10 +163,13 @@ and images in a multipart/related part." ('semi (concat "--" "<>-{\n" "--" "[[text/plain]]\n" plain - (when images (concat "--" "<>-{\n")) - "--" "[[text/html]]\n" html - images - (when images (concat "--" "}-<>\n")) + (if (and images (> (length images) 0)) + (concat "--" "<>-{\n" + "--" "[[text/html]]\n" html + images + "--" "}-<>\n") + (concat "--" "[[text/html]]\n" html + images)) "--" "}-<>\n")) ('vm "?"))) -- 2.0.0 --=-=-= Content-Type: text/plain -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D (see https://u.fsf.org/yw) --=-=-=--