[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/org-mime 3cbd663066 1/2: Added support for In-Reply-To hea
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/org-mime 3cbd663066 1/2: Added support for In-Reply-To header |
Date: |
Tue, 21 Mar 2023 20:03:51 -0400 (EDT) |
branch: elpa/org-mime
commit 3cbd663066c90a2953013d0a7e8e08b5c842d757
Author: Nick Anderson <nick@cmdln.org>
Commit: Nick Anderson <nick@cmdln.org>
Added support for In-Reply-To header
This change adds support for the In-Reply-To header.
This allows you to leverage a capture template when reading an email in
something like mu4e so that your response to an email thread is associated
with
the appropriate previous message.
---
README.org | 3 ++-
org-mime.el | 21 ++++++++++++++-------
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/README.org b/README.org
index 2330c65ceb..0a0d70e78b 100644
--- a/README.org
+++ b/README.org
@@ -50,7 +50,7 @@ The following key bindings are suggested, which bind the C-c
M-o key sequence to
** =M-x org-mime-org-subtree-htmlize=
=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:
+MAIL_TO, MAIL_CC, MAIL_BCC, and MAIL_IN_REPLY_TO. Here is the sample of
subtree:
#+begin_example
* mail one
:PROPERTIES:
@@ -58,6 +58,7 @@ MAIL_TO, MAIL_CC, and MAIL_BCC. Here is the sample of subtree:
:MAIL_TO: person1@gmail.com
:MAIL_CC: person2@gmail.com
:MAIL_BCC: person3@gmail.com
+ :MAIL_IN_REPLY_TO: <MESSAGE-ID>
:END:
some text here ...
#+end_example
diff --git a/org-mime.el b/org-mime.el
index c0154f4594..0187b987ad 100644
--- a/org-mime.el
+++ b/org-mime.el
@@ -43,7 +43,7 @@
;;
;; `org-mime-org-subtree-htmlize' is similar to `org-mime-org-buffer-htmlize'
;; but works on current subtree. It can read following subtree properties:
-;; MAIL_SUBJECT, MAIL_TO, MAIL_FROM, MAIL_CC, and MAIL_BCC.
+;; MAIL_SUBJECT, MAIL_TO, MAIL_FROM, MAIL_CC, and MAIL_BCC. MAIL_IN_REPLY_TO
;;
;; Here is the sample of a subtree:
;; * mail one
@@ -53,6 +53,7 @@
;; :MAIL_FROM: sender@gmail.com
;; :MAIL_CC: person2@gmail.com
;; :MAIL_BCC: person3@gmail.com
+;; :MAIL_IN_REPLY_TO: <MESSAGE_ID>
;; :END:
;;
;; To avoid exporting the table of contents, you can setup
@@ -625,7 +626,7 @@ If called with an active region only export that region,
otherwise entire body."
(org-element-map (org-element-parse-buffer) 'keyword
(lambda (keyword)
(when (and (string= (org-element-property :key keyword) "PROPERTY")
- (string-match "^MAIL_\\(TO\\|SUBJECT\\|CC\\|BCC\\|FROM\\) +"
+ (string-match
"^MAIL_\\(TO\\|SUBJECT\\|CC\\|BCC\\|IN_REPLY_TO\\|FROM\\) +"
(setq value (org-element-property :value
keyword)))
(setq key (concat "MAIL_" (match-string 1 value)))
(setq rlt
@@ -634,9 +635,9 @@ If called with an active region only export that region,
otherwise entire body."
(string-trim (replace-regexp-in-string key
"" value))))))))
rlt))
-(defun org-mime-build-mail-other-headers (cc bcc from)
- "Build mail header from CC, BCC, and FROM."
- (let* ((arr (list (cons "Cc" cc) (cons "Bcc" bcc) (cons "From" from )))
+(defun org-mime-build-mail-other-headers (cc bcc from in-reply-to)
+ "Build mail header from CC, BCC, IN_REPLY_TO and FROM."
+ (let* ((arr (list (cons "Cc" cc) (cons "Bcc" bcc) (cons "From" from ) (cons
"In-Reply-To" in-reply-to )))
rlt)
(dolist (e arr)
(when (cdr e)
@@ -655,6 +656,8 @@ The following file keywords can be used to control the
headers:
#+MAIL_CC: some2@some.place
#+MAIL_BCC: some3@some.place
#+MAIL_FROM: sender@some.place
+#+MAIL_FROM: sender@some.place
+#+MAIL_IN_REPLY_TO: <MESSAGE_ID>
The cursor ends in the TO field."
(interactive)
@@ -672,9 +675,11 @@ The cursor ends in the TO field."
(cc (plist-get props :MAIL_CC))
(bcc (plist-get props :MAIL_BCC))
(from (plist-get props :MAIL_FROM))
+ (in-reply-to (plist-get props :MAIL_IN_REPLY_TO))
(other-headers (org-mime-build-mail-other-headers cc
bcc
- from)))
+ from
+ in-reply-to)))
(org-mime-compose exported file to subject other-headers)
(message-goto-to)))
@@ -722,10 +727,12 @@ Following headline properties can determine the mail
headers.
(plist-get props :MAIL_CC)))
(bcc (or (org-mime-attr "MAIL_BCC")
(plist-get props :MAIL_BCC)))
+ (in-reply-to (or (org-mime-attr "MAIL_IN_REPLY_TO")
+ (plist-get props :MAIL_BCC)))
(from (or (org-mime-attr "MAIL_FROM")
(plist-get props :MAIL_FROM)))
;; Thanks to Matt Price improving handling of cc & bcc headers
- (other-headers (org-mime-build-mail-other-headers cc bcc from))
+ (other-headers (org-mime-build-mail-other-headers cc bcc from
in-reply-to))
(org-export-show-temporary-export-buffer nil)
(org-export-show-temporary-export-buffer nil)
;; I wrap these bodies in export blocks because in
org-mime-compose
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/org-mime 3cbd663066 1/2: Added support for In-Reply-To header,
ELPA Syncer <=