emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] org-mime spurious alternative


From: Eric Schulte
Subject: Re: [O] org-mime spurious alternative
Date: Thu, 12 Jun 2014 14:42:03 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Sébastien Delafond <address@hidden> 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

>From 9af18107bd82fb9778b87b5891b1772fb847cc74 Mon Sep 17 00:00:00 2001
From: Eric Schulte <address@hidden>
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
             "--" "<<alternative>>-{\n"
             "--" "[[text/plain]]\n" plain
-           (when images (concat "--" "<<alternative>>-{\n"))
-            "--" "[[text/html]]\n"  html
-           images
-           (when images (concat "--" "}-<<alternative>>\n"))
+           (if (and images (> (length images) 0))
+               (concat "--" "<<related>>-{\n"
+                       "--" "[[text/html]]\n"  html
+                       images
+                       "--" "}-<<related>>\n")
+             (concat "--" "[[text/html]]\n"  html
+                     images))
             "--" "}-<<alternative>>\n"))
     ('vm "?")))
 
-- 
2.0.0

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D (see https://u.fsf.org/yw)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]