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

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

[nongnu] elpa/org-mime c6e2b95664 047/118: clean code


From: ELPA Syncer
Subject: [nongnu] elpa/org-mime c6e2b95664 047/118: clean code
Date: Wed, 5 Jan 2022 07:58:45 -0500 (EST)

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

    clean code
---
 org-mime.el | 59 ++++++++++++++++++++++++++++++++---------------------------
 1 file changed, 32 insertions(+), 27 deletions(-)

diff --git a/org-mime.el b/org-mime.el
index 51947b1427..084bfe2922 100644
--- a/org-mime.el
+++ b/org-mime.el
@@ -226,7 +226,7 @@ OPTS is export options."
 ;;             (org-mime-change-element-style
 ;;              "pre" (format "color: %s; background-color: %s;"
 ;;                            "#E6E1DC" "#232323"))
-;;         (org-mime-change-class-style
+;;       (org-mime-change-class-style
 ;;              "verse" "border-left: 2px solid gray; padding-left: 4px;")))
 
 (defun org-mime-file (ext path id)
@@ -234,17 +234,17 @@ OPTS is export options."
   (when org-mime-debug (message "org-mime-file called => %s %s %s" ext path 
id))
   (cl-case org-mime-library
     (mml (format (concat "<#part type=\"%s\" filename=\"%s\" "
-                        "disposition=inline id=\"<%s>\">\n<#/part>\n")
-                ext path id))
+       "disposition=inline id=\"<%s>\">\n<#/part>\n")
+     ext path id))
     (semi (concat
-          (format (concat "--[[%s\nContent-Disposition: "
-                          "inline;\nContent-ID: <%s>][base64]]\n")
-                  ext id)
-          (base64-encode-string
-           (with-temp-buffer
-             (set-buffer-multibyte nil)
-             (insert-file-contents-literally path)
-             (buffer-string)))))
+     (format (concat "--[[%s\nContent-Disposition: "
+         "inline;\nContent-ID: <%s>][base64]]\n")
+       ext id)
+     (base64-encode-string
+      (with-temp-buffer
+        (set-buffer-multibyte nil)
+        (insert-file-contents-literally path)
+        (buffer-string)))))
     (vm "?")))
 
 (defun org-mime-encode-quoted-mail-body ()
@@ -309,7 +309,7 @@ HTML is the body of the message."
             (let (retval)
               (condition-case ex
                   (setq info (org-mime-encode-quoted-mail-body))
-               (setq retval info)
+    (setq retval info)
                 ('error (setq info nil)))
               retval))
         (cond
@@ -338,10 +338,10 @@ If html portion of message includes IMAGES they are 
wrapped in multipart/related
     (semi (concat
             "--" "<<alternative>>-{\n"
             "--" "[[text/plain]]\n" plain
-           (when images (concat "--" "<<alternative>>-{\n"))
+      (when images (concat "--" "<<alternative>>-{\n"))
             "--" "[[text/html]]\n"  html
-           images
-           (when images (concat "--" "}-<<alternative>>\n"))
+      images
+      (when images (concat "--" "}-<<alternative>>\n"))
             "--" "}-<<alternative>>\n"))
     (vm "?")))
 
@@ -354,17 +354,17 @@ CURRENT-FILE is used to calculate full path of images."
      (replace-regexp-in-string ;; replace images in html
       "src=\"\\([^\"]+\\)\""
       (lambda (text)
-       (format
-        "src=\"cid:%s\""
-        (let* ((url (and (string-match "src=\"\\([^\"]+\\)\"" text)
-                         (match-string 1 text)))
-               (path (if (string-match-p "^file:///" url) 
(replace-regexp-in-string "^file://" "" url)
-                       (expand-file-name url (file-name-directory 
current-file))))
-               (ext (file-name-extension path))
-               (id (replace-regexp-in-string "[\/\\\\]" "_" path)))
-          (add-to-list 'html-images
-                       (org-mime-file (concat "image/" ext) path id))
-          id)))
+  (format
+   "src=\"cid:%s\""
+   (let* ((url (and (string-match "src=\"\\([^\"]+\\)\"" text)
+        (match-string 1 text)))
+    (path (if (string-match-p "^file:///" url) (replace-regexp-in-string 
"^file://" "" url)
+      (expand-file-name url (file-name-directory current-file))))
+    (ext (file-name-extension path))
+    (id (replace-regexp-in-string "[\/\\\\]" "_" path)))
+     (add-to-list 'html-images
+      (org-mime-file (concat "image/" ext) path id))
+     id)))
       str)
      html-images)))
 
@@ -414,7 +414,7 @@ If ARG is not nil, use `org-mime-fixedwith-wrap' to wrap 
the exported text."
     (save-excursion
       (goto-char html-start)
       (insert (org-mime-multipart
-              body html (mapconcat 'identity html-images "\n"))))))
+         body html (mapconcat 'identity html-images "\n"))))))
 
 (defun org-mime-apply-html-hook (html)
   "Apply HTML hook."
@@ -516,4 +516,9 @@ alternatives."
         (org-mime-compose body file to subject other-headers opts)))))
 
 (provide 'org-mime)
+;; Local Variables:
+;; coding: utf-8
+;; tab-width: 2
+;; indent-tabs-mode: nil
+;; End:
 ;;; org-mime.el ends here



reply via email to

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