[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/org-mime a0b82a6c1a 024/118: better export format (not TOC
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/org-mime a0b82a6c1a 024/118: better export format (not TOC, etc) and bug fix |
Date: |
Wed, 5 Jan 2022 07:58:44 -0500 (EST) |
branch: elpa/org-mime
commit a0b82a6c1a0dbcf5b7bebfe2e5817d54a1cd3cc8
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: Chen Bin <chenbin.sh@gmail.com>
better export format (not TOC, etc) and bug fix
---
README.org | 28 +++++++++++++++++++---------
org-mime.el | 41 +++++++++++++++++++++++++++++++++--------
2 files changed, 52 insertions(+), 17 deletions(-)
diff --git a/README.org b/README.org
index 17e2ef1996..cca1fc77d9 100644
--- a/README.org
+++ b/README.org
@@ -41,16 +41,16 @@ The following key bindings are suggested, which bind the
C-c M-o key sequence to
=org-mime-org-subtree-htmlize= is similar to =org-mime-org-buffer-htmlize=
but works on subtree. It can also read subtree properties MAIL_SUBJECT,
MAIL_TO, MAIL_CC, and MAIL_BCC. Here is the sample of subtree:
-#+begin_src org
+#+begin_example
* mail one
- :PROPERTIES:
- :MAIL_SUBJECT: mail title
- :MAIL_TO: person1@gmail.com
- :MAIL_CC: person2@gmail.com
- :MAIL_BCC: person3@gmail.com
- :END:
+ :PROPERTIES:
+ :MAIL_SUBJECT: mail title
+ :MAIL_TO: person1@gmail.com
+ :MAIL_CC: person2@gmail.com
+ :MAIL_BCC: person3@gmail.com
+ :END:
content ...
-#+end_src
+#+end_example
** CSS style customization
Email clients will often strip all global CSS from email messages. In the case
of web-based email readers this is essential in order to protect the CSS of the
containing web site. To ensure that your CSS styles are rendered correctly they
must be included in the actual body of the elements to which they apply.
@@ -73,11 +73,21 @@ For those who use color themes with Dark backgrounds it is
useful to set a dark
#+end_src
For other customization options see the org-mime customization group.
+** Export options
+To avoid exporting TOC, you can setup `org-mime-export-options',
+#+begin_src elisp
+(setq org-mime-export-options '(:section-numbers nil
+ :with-author nil
+ :with-toc nil))
+#+end_src
+Or just setup your export options in org buffer/subtree which is overrided by
`org-mime-export-options' when it's NOT nil.
* Development
- Patches are always welcomed
- You can =(setq org-mime-debug t)= to enable the log
- Make sure your code has minimum dependency and works on Emacs versions we
support
* Credits
-org-mime was developed by Eric Schulte with much-appreciated help and
discussion from everyone on the
[[https://lists.gnu.org/archive/html/emacs-orgmode/2010-03/msg00500.html][using
orgmode to send html mail]] thread especially Eric S. Fraga for adding WL
support.
+- org-mime was developed by Eric Schulte with much-appreciated help and
discussion from everyone on the
[[https://lists.gnu.org/archive/html/emacs-orgmode/2010-03/msg00500.html][using
orgmode to send html mail]] thread especially Eric S. Fraga for adding WL
support.
+- [[https://github.com/acowley][Anthony Cowley]] fixed many bugs for exporting
and support more export options
+- [[https://github.com/titaniumbones][Matt Price]] improved handling of mail
headers (CC, BCC ...)
* Licence
Documentation from the http://orgmode.org/worg/ website (either in its HTML
format or in its Org format) is licensed under the
[[http://www.gnu.org/copyleft/fdl.html][GNU Free Documentation License version
1.3]] or later. The code examples and css style sheets are licensed under the
[[http://www.gnu.org/licenses/gpl.html][GNU General Public License v3 or
later]].
diff --git a/org-mime.el b/org-mime.el
index 65655629f0..ea5e0ed3dc 100644
--- a/org-mime.el
+++ b/org-mime.el
@@ -6,7 +6,7 @@
;; Maintainer: Chen Bin (redguardtoo)
;; Keywords: mime, mail, email, html
;; Homepage: http://github.com/org-mime/org-mime
-;; Version: 0.0.4
+;; Version: 0.0.5
;; Package-Requires: ((cl-lib "0.5"))
;; This file is not part of GNU Emacs.
@@ -53,6 +53,13 @@
;; :MAIL_BCC: person3@gmail.com
;; :END:
;;
+;; To avoid exporting TOC, you can setup `org-mime-export-options',
+;; (setq org-mime-export-options '(:section-numbers nil
+;; :with-author nil
+;; :with-toc nil))
+;; Or just setup your export options in org buffer/subtree which is overrided
+;; by `org-mime-export-options' when it's NOT nil.
+;;
;; Quick start:
;; Write mail in message-mode, make sure the mail body follows org format.
;; Before sending mail, `M-x org-mime-htmlize'
@@ -104,6 +111,11 @@ And ensure first line isn't assumed to be a title line."
:group 'org-mime
:type 'string)
+(defvar org-mime-export-options nil
+ "Default export options which may overrides org buffer/subtree options.
+You avoid exporting section-number/author/toc with below setup,
+`(setq org-mime-export-options '(:section-numbers nil :with-author nil
:with-toc nil))'")
+
(defvar org-mime-html-hook nil
"Hook to run over the html buffer before attachment to email.
This could be used for example to post-process html elements.")
@@ -121,9 +133,12 @@ buffer holding\nthe text to be exported.")
(defun org-mime--export-string (s &optional opts)
"Export string S into HTML format. OPTS is export options."
+ (if org-mime-debug (message "org-mime--export-string called => %s" opts))
+ ;; we won't export title from org file anyway
+ (if opts (setq opts (plist-put opts 'title nil)))
(if (fboundp 'org-export-string-as)
;; emacs24
- (org-export-string-as s 'html t opts)
+ (org-export-string-as s 'html t (if org-mime-export-options
org-mime-export-options opts))
;; emacs 23
(org-export-string s "html")))
@@ -149,7 +164,7 @@ buffer holding\nthe text to be exported.")
;; "verse" "border-left: 2px solid gray; padding-left: 4px;")))
(defun org-mime-file (ext path id)
- "Markup a file wth EXT, PATH and ID for attachment."
+ "Markup a file with EXT, PATH and ID for attachment."
(if 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\" "
@@ -239,7 +254,10 @@ If ARG is not NIL, use `org-mime-fixedwith-wrap' to wrap
the exported text."
;; to hold attachments for inline html images
(html-and-images
(org-mime-replace-images
- (org-mime--export-string body) tmp-file))
+ (org-mime--export-string body
+ (if (fboundp
'org-export--get-inbuffer-options)
+ (org-export--get-inbuffer-options)))
+ tmp-file))
(html-images (unless arg (cdr html-and-images)))
(html (org-mime-apply-html-hook
(if arg
@@ -272,7 +290,7 @@ If ARG is not NIL, use `org-mime-fixedwith-wrap' to wrap
the exported text."
(defun org-mime-compose (body file &optional to subject headers opts)
"Create mail BODY in FILE with SUBJECT, HEADERS and OPTS."
- (if org-mime-debug (message "org-mime-compose called => %s" file))
+ (if org-mime-debug (message "org-mime-compose called => %s %s" file opts))
(let* ((fmt 'html))
(unless (featurep 'message)
(require 'message))
@@ -293,7 +311,8 @@ If ARG is not NIL, use `org-mime-fixedwith-wrap' to wrap
the exported text."
(org-export-htmlize-output-type 'inline-css)
(html-and-images
(org-mime-replace-images
- (org-mime--export-string (bhook body 'html) opts) file))
+ (org-mime--export-string (bhook body 'html) opts)
+ file))
(images (cdr html-and-images))
(html (org-mime-apply-html-hook (car html-and-images))))
(insert (org-mime-multipart plain html)
@@ -315,7 +334,13 @@ If ARG is not NIL, use `org-mime-fixedwith-wrap' to wrap
the exported text."
(body-end (or (and region-p (region-end)) (point-max)))
(temp-body-file (make-temp-file "org-mime-export"))
(body (buffer-substring body-start body-end)))
- (org-mime-compose body file nil subject)))
+ (org-mime-compose body
+ file
+ nil ; TO
+ subject
+ nil ; HEADERS (CC, BCC ...)
+ (if (fboundp 'org-export--get-inbuffer-options)
+ (org-export--get-inbuffer-options)))))
;;;###autoload
(defun org-mime-org-subtree-htmlize ()
@@ -337,7 +362,7 @@ and in org formats as mime alternatives."
(cc `((cc . ,cc)))
(bcc `((bcc . ,bcc)))
(t nil)))
- (opts (org-export--get-subtree-options))
+ (opts (if (fboundp 'org-export--get-subtree-options)
(org-export--get-subtree-options)))
(body (org-get-entry)))
(org-mime-compose body file to subject other-headers opts)))))
- [nongnu] branch elpa/org-mime created (now 613969effc), ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime a1a7fb329f 003/118: clean doc, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 3c4f24c8d4 016/118: clean code. github organization created, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 2347595278 002/118: emacs24 use org-export-string instead of org-export-string-as, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime a0b82a6c1a 024/118: better export format (not TOC, etc) and bug fix,
ELPA Syncer <=
- [nongnu] elpa/org-mime 9d32b819f0 025/118: updated README, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime caa1f19d4b 009/118: Fix getting the subect, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 0311662889 017/118: Correct 'interactive' position, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime ffbf3e3e47 010/118: Support mime encoding current subtree, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime c49eb00fc6 021/118: can create email from org subtree, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime e554d8821d 020/118: Merge pull request #1 from syohex/fix-package, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 91d8f48775 023/118: can set org export options, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 7c3483b2b0 030/118: sample for advanced setup, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime e3329c7c4d 032/118: README, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 0a0aa9b110 034/118: README, ELPA Syncer, 2022/01/05