emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-mime spurious alternative
@ 2014-06-10 15:15 Sébastien Delafond
  2014-06-12 18:42 ` Eric Schulte
  0 siblings, 1 reply; 2+ messages in thread
From: Sébastien Delafond @ 2014-06-10 15:15 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: org-mime spurious alternative
  2014-06-10 15:15 org-mime spurious alternative Sébastien Delafond
@ 2014-06-12 18:42 ` Eric Schulte
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Schulte @ 2014-06-12 18:42 UTC (permalink / raw)
  To: Sébastien Delafond; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1008 bytes --]

Sébastien Delafond <sdelafond@gmail.com> 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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-fix-semi-backend-bug-in-org-mime.patch --]
[-- Type: text/x-diff, Size: 1204 bytes --]

From 9af18107bd82fb9778b87b5891b1772fb847cc74 Mon Sep 17 00:00:00 2001
From: Eric Schulte <schulte.eric@gmail.com>
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


[-- Attachment #3: Type: text/plain, Size: 90 bytes --]


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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-12 20:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-10 15:15 org-mime spurious alternative Sébastien Delafond
2014-06-12 18:42 ` Eric Schulte

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).