branch: elpa/org-mime
commit ad30f199cb1d91b7e3778aea44ee2b011c093943
Author: Chen Bin <[email protected]>
Commit: Chen Bin <[email protected]>

    provide org-mime-find-html-start callback
---
 README.org  | 13 ++++++++++++-
 org-mime.el | 23 +++++++++++++++--------
 2 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/README.org b/README.org
index 58948a2cc4..61112311a2 100644
--- a/README.org
+++ b/README.org
@@ -1,4 +1,4 @@
-* org-mime v0.0.9
+* org-mime v0.1.0
 org-mime can be used to send HTML email using Org-mode HTML export.
 
 This approximates a WYSiWYG HTML mail editor from within Emacs, and can be 
useful for sending tables, fontified source code, and inline images in email.
@@ -51,6 +51,7 @@ MAIL_TO, MAIL_CC, and MAIL_BCC. Here is the sample of subtree:
  :END:
 content ...
 #+end_example
+* Tips
 ** Embed image into mail body
 Use below syntax,
 #+begin_example
@@ -97,6 +98,16 @@ To avoid exporting TOC, you can setup 
`org-mime-export-options',
 Or just setup your export options in org buffer/subtree.
 
 `org-mime-export-options' will override your export options if it's NOT nil.
+** Keep gpg signatures outside of multipart
+=org-mime-find-html-start= gives user a chance to tweak the region beginning 
to htmlize,
+#+begin_src lisp
+(setq org-mime-find-html-start
+      (lambda (start)
+        (save-excursion
+          (goto-char start)
+          (search-forward "<#secure method=pgpmime mode=sign>")
+          (+ (point) 1))))
+#+end_src
 * Development
 - Patches are always welcomed
 - You can =(setq org-mime-debug t)= to enable the log
diff --git a/org-mime.el b/org-mime.el
index 776273b979..c6047e0507 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.9
+;; Version: 0.1.0
 ;; Package-Requires: ((emacs "24.3") (cl-lib "0.5"))
 
 ;; This file is not part of GNU Emacs.
@@ -92,7 +92,7 @@
 ;;               (while (re-search-forward "@\\([^@]*\\)@" nil t)
 ;;                 (replace-match "<span style=\"color:red\">\\1</span>"))))
 ;;
-;; 3. Since v0.0.9, the quoted mail uses modern style (like Gmail).
+;; 3. Now the quoted mail uses modern style (like Gmail).
 ;; So replyed mail looks clean and modern. If you prefer old style, please set
 ;; `org-mime-beautify-quoted-mail' to nil.
 
@@ -134,6 +134,11 @@ And ensure first line isn't assumed to be a title line."
   :group 'org-mime
   :type 'string)
 
+(defvar org-mime-find-html-start 'identity
+  "Call back to search the new HTML start for htmlize in message buffer."
+  :group 'org-mime
+  :type 'sexp)
+
 (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,
@@ -345,18 +350,20 @@ CURRENT-FILE is used to calculate full path of images."
       str)
      html-images)))
 
+;;;###autoload
 (defun org-mime-htmlize (arg)
   "Export a portion of an email to html using `org-mode'.
 If called with an active region only export that region, otherwise entire body.
-If ARG is not NIL, use `org-mime-fixedwith-wrap' to wrap the exported text."
+If ARG is not nil, use `org-mime-fixedwith-wrap' to wrap the exported text."
   (interactive "P")
   (if org-mime-debug (message "org-mime-htmlize called"))
   (let* ((region-p (org-region-active-p))
-         (html-start (or (and region-p (region-beginning))
-                         (save-excursion
-                           (goto-char (point-min))
-                           (search-forward mail-header-separator)
-                           (+ (point) 1))))
+         (html-start (funcall org-mime-find-html-start
+                              (or (and region-p (region-beginning))
+                                  (save-excursion
+                                    (goto-char (point-min))
+                                    (search-forward mail-header-separator)
+                                    (+ (point) 1)))))
          (html-end (or (and region-p (region-end))
                        ;; TODO: should catch signature...
                        (point-max)))

Reply via email to