Re: [O] org-mime spurious alternative

2014-06-12 Thread Eric Schulte
Sébastien 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

>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


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


[O] org-mime spurious alternative

2014-06-10 Thread Sébastien Delafond
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