emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/org-mime f1175e3fab 035/118: can htmlize new mail


From: ELPA Syncer
Subject: [nongnu] elpa/org-mime f1175e3fab 035/118: can htmlize new mail
Date: Wed, 5 Jan 2022 07:58:44 -0500 (EST)

branch: elpa/org-mime
commit f1175e3faba25d3f862a43392b69854cdd18be9d
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: Chen Bin <chenbin.sh@gmail.com>

    can htmlize new mail
---
 org-mime.el | 34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)

diff --git a/org-mime.el b/org-mime.el
index 4a243482d5..776273b979 100644
--- a/org-mime.el
+++ b/org-mime.el
@@ -282,11 +282,21 @@ You could use either `org-up-heading-safe' or 
`org-back-to-heading'.")
                  "<p>[\n\r]*&gt;&gt;&gt;&gt;&gt; .* == 
\\([^\r\n]*\\)[\r\n]*</p>"
                  "<div class=\"gmail_quote\">\\1</div>"
                  html))
-        (setq info (org-mime-encode-quoted-mail-body))
-        (delete-region (nth 0 info) (nth 1 info))
-        (goto-char (nth 0 info))
-        (insert (nth 2 info))
-        (buffer-substring-no-properties (point-min) (point-max)))))
+        (unwind-protect
+            (let (retval)
+              (condition-case ex
+                  (setq info (org-mime-encode-quoted-mail-body))
+                  (setq retval info)
+                ('error (setq info nil)))
+              retval))
+        (cond
+         (info
+          (delete-region (nth 0 info) (nth 1 info))
+          (goto-char (nth 0 info))
+          (insert (nth 2 info))
+          (buffer-substring-no-properties (point-min) (point-max)))
+         (t
+          html)))))
    (t
     html)))
 
@@ -295,13 +305,13 @@ You could use either `org-up-heading-safe' or 
`org-back-to-heading'.")
 If html portion of message includes IMAGES they are wrapped in 
multipart/related part."
   (cl-case org-mime-library
     (mml (concat "<#multipart type=alternative><#part type=text/plain>"
-                 plain
-                 (when images "<#multipart type=related>")
-                 "<#part type=text/html>"
-                 (org-mime-cleanup-quoted html)
-                 images
-                 (when images "<#/multipart>\n")
-                 "<#/multipart>\n"))
+                 plain
+                 (when images "<#multipart type=related>")
+                 "<#part type=text/html>"
+                 (org-mime-cleanup-quoted html)
+                 images
+                 (when images "<#/multipart>\n")
+                 "<#/multipart>\n"))
     (semi (concat
             "--" "<<alternative>>-{\n"
             "--" "[[text/plain]]\n" plain



reply via email to

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