[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/org-mime e35c367e7d 048/118: clean code
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/org-mime e35c367e7d 048/118: clean code |
Date: |
Wed, 5 Jan 2022 07:58:46 -0500 (EST) |
branch: elpa/org-mime
commit e35c367e7dc1449e63916e424d4e7349c91f8c1d
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: Chen Bin <chenbin.sh@gmail.com>
clean code
---
org-mime.el | 62 ++++++++++++++++++++++++++++++-------------------------------
1 file changed, 30 insertions(+), 32 deletions(-)
diff --git a/org-mime.el b/org-mime.el
index 084bfe2922..abb77ac467 100644
--- a/org-mime.el
+++ b/org-mime.el
@@ -226,25 +226,23 @@ 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)
"Markup a file with EXT, PATH and ID for attachment."
(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))
+ (mml (format "<#part type=\"%s\" filename=\"%s\" 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 "--[[%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 +307,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
@@ -336,13 +334,13 @@ If html portion of message includes IMAGES they are
wrapped in multipart/related
(when images "<#/multipart>\n")
"<#/multipart>\n"))
(semi (concat
- "--" "<<alternative>>-{\n"
- "--" "[[text/plain]]\n" plain
- (when images (concat "--" "<<alternative>>-{\n"))
- "--" "[[text/html]]\n" html
- images
- (when images (concat "--" "}-<<alternative>>\n"))
- "--" "}-<<alternative>>\n"))
+ "--" "<<alternative>>-{\n"
+ "--" "[[text/plain]]\n" plain
+ (when images (concat "--" "<<alternative>>-{\n"))
+ "--" "[[text/html]]\n" html
+ images
+ (when images (concat "--" "}-<<alternative>>\n"))
+ "--" "}-<<alternative>>\n"))
(vm "?")))
(defun org-mime-replace-images (str current-file)
@@ -354,17 +352,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 +412,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."
- [nongnu] elpa/org-mime 04e6ce9db6 108/118: try fixing ci again, (continued)
- [nongnu] elpa/org-mime 04e6ce9db6 108/118: try fixing ci again, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime eb21c02ba8 109/118: fixed org subtree htmlize, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 21692f16ce 110/118: use buffer properties, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 59bf130c76 113/118: secure tag should be at the beginning of email body, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime df99e631c5 031/118: quoted mail use modern UI style, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime e5e4c59022 103/118: fixed some typo, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 3b119a22be 112/118: handle file url on Windows elegantly, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime f7a45f5573 115/118: Upgrade test file to GPLv3, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 77c3f07ce4 046/118: documentation, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime e5c68b1c66 044/118: minor changes to docstrings for readability and style changes., ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime e35c367e7d 048/118: clean code,
ELPA Syncer <=
- [nongnu] elpa/org-mime 41ea9818b4 050/118: fix cc, bcc compiling error, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 0db41d5b4e 065/118: emergency fix of broken 0.1.4, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 470808cc14 070/118: Added support for MAIL_FROM property, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 5132ec0586 089/118: Improve signature separator regex, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 744f5f3315 090/118: Merge pull request #49 from ahttraga/master, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime dc7ae1de85 094/118: Show individual paragraphs in gmail reply quotes, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 85c98739f3 001/118: import original org-mime, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 8d7797ea07 007/118: clean code according to org review, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime b33c96b2d0 015/118: embedded image could use absolute path, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime dd1b9881af 027/118: remove drawers when org-mime-htmlize-subtree at emacs 24.3, ELPA Syncer, 2022/01/05