emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: "Sébastien Delafond" <sdelafond@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-mime spurious alternative
Date: Thu, 12 Jun 2014 14:42:03 -0400	[thread overview]
Message-ID: <87tx7px4u0.fsf@gmail.com> (raw)
In-Reply-To: 20140610171252.707@usenet.piggo.com

[-- 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)

      reply	other threads:[~2014-06-12 20:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-10 15:15 org-mime spurious alternative Sébastien Delafond
2014-06-12 18:42 ` Eric Schulte [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tx7px4u0.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=sdelafond@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).