[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnorb 92354d0 082/449: Allow use of some org-mime prope
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnorb 92354d0 082/449: Allow use of some org-mime properties |
Date: |
Fri, 27 Nov 2020 23:15:13 -0500 (EST) |
branch: externals/gnorb
commit 92354d0eca9cf7a4a19cb1bb9cc0d32715d7117a
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>
Allow use of some org-mime properties
lisp/gnorb-org.el: gnorb-org-setup-message now accepts from, cc, and bcc
arguments. gnorb-org-handle-mail picks these up from
properties in the style of org-mime: MAIL_FROM,
MAIL_CC, and MAIL_BCC. Property inheritance currently
hardcoded to t. gnorb-org-email-subtree doesn't
extract these, because it's becoming increasingly
obvious that that function should simply call
gnorb-org-handle-mail directly when it's done. That's
the next step.
---
lisp/gnorb-org.el | 44 ++++++++++++++++++++++++++++++++------------
1 file changed, 32 insertions(+), 12 deletions(-)
diff --git a/lisp/gnorb-org.el b/lisp/gnorb-org.el
index 1515749..f7970d7 100644
--- a/lisp/gnorb-org.el
+++ b/lisp/gnorb-org.el
@@ -271,7 +271,8 @@ heading text will be scanned for message and mail links."
(scan-for-links end))
(list message mails)))))
-(defun gnorb-org-setup-message (&optional messages mails attachments text ids)
+(defun gnorb-org-setup-message
+ (&optional messages mails from cc bcc attachments text ids)
"Common message setup routine for other gnorb-org commands.
MESSAGES is a list of gnus links pointing to messages -- we
currently only use the first of the list. MAILS is a list of
@@ -282,9 +283,9 @@ Org heading ids, associating the outgoing message with those
headings."
(require 'gnorb-gnus)
(if (not messages)
- ; either compose new message...
+ ;; either compose new message...
(compose-mail (mapconcat 'identity mails ", "))
- ; ...or follow link and start reply
+ ;; ...or follow link and start reply
(condition-case nil
(progn
(org-gnus-open (org-link-unescape (car messages)))
@@ -299,13 +300,25 @@ headings."
;; return us after message is sent
(add-to-list 'message-exit-actions
'gnorb-org-restore-after-send t)
- ; attach ATTACHMENTS
+ ;; set headers from MAIL_* properties (from, cc, and bcc)
+ (cl-flet ((sh (h)
+ (when (cdr h)
+ (funcall (intern (format "message-goto-%s" (car h))))
+ (let ((message-beginning-of-line t)
+ (show-trailing-whitespace t))
+ (message-beginning-of-line)
+ (unless (bolp)
+ (kill-line))
+ (insert (cdr h))))))
+ (dolist (h `((from . ,from) (cc . ,cc) (bcc . ,bcc)))
+ (sh h)))
+ ;; attach ATTACHMENTS
(map-y-or-n-p
(lambda (a) (format "Attach %s to outgoing message? "
(file-name-nondirectory a)))
(lambda (a)
(mml-attach-file a (mm-default-file-encoding a)
- nil "attachment"))
+ nil "attachment"))
attachments
'("file" "files" "attach"))
;; insert text, if any
@@ -328,7 +341,7 @@ headings."
;; this function hardly does anything
(message-insert-header
(intern gnorb-mail-header) i)))))
- ; put point somewhere reasonable
+ ; put point somewhere reasonable
(if (or mails messages)
(message-goto-body)
(message-goto-to))
@@ -362,12 +375,17 @@ current heading."
(goto-char pos)))
(unless (org-back-to-heading t)
(error "Not in an org item"))
- (let ((mail-stuff (funcall gnorb-org-mail-scan-function))
- (attachments (gnorb-org-attachment-list))
- (org-id (org-id-get-create)))
- (gnorb-org-setup-message
- (first mail-stuff) (second mail-stuff)
- attachments nil org-id)))
+ (cl-flet ((mp (p) (org-entry-get (point) p t)))
+ (let* ((mail-stuff (funcall gnorb-org-mail-scan-function))
+ (attachments (gnorb-org-attachment-list))
+ (from (mp "MAIL_FROM"))
+ (cc (mp "MAIL_CC"))
+ (bcc (mp "MAIL_BCC"))
+ (org-id (org-id-get-create)))
+ (gnorb-org-setup-message
+ (first mail-stuff) (second mail-stuff)
+ from cc bcc
+ attachments nil org-id))))
(defun gnorb-org-find-visit-candidates (ids)
"For all message-ids in IDS (which should be a list of
@@ -525,6 +543,8 @@ default set of parameters."
(push result attachments))
(gnorb-org-setup-message
(first mail-stuff) (second mail-stuff)
+ nil nil nil ;; when this calls into `org-handle-mail' all this
+ ;; will be sorted
attachments text org-id)))
(defcustom gnorb-org-capture-collect-link-p t
- [elpa] externals/gnorb 7ffc885 043/449: Commenting out my re-implementation of map-y-or-n-p, (continued)
- [elpa] externals/gnorb 7ffc885 043/449: Commenting out my re-implementation of map-y-or-n-p, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 6152e85 059/449: Comments on editing messages, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb d786b81 063/449: Random comment edits and indenting changes., Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 77698aa 071/449: Split 'gnorb-org-email-subtree-parameters', Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 3a2cd3b 072/449: Improve scanning of headings for mail actions, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb bb21414 075/449: Provide more escapes for outgoing capture templates, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb cd1f289 076/449: Guess which Org TODO is related to this message, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 856da2b 077/449: Improve `gnorb-gnus-outgoing-make-todo', Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 5812648 078/449: FUNCTION RENAMING, I'M VERY SORRY, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 582c111 080/449: Let gnorb-gnus-check-outgoing-headers handle news, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 92354d0 082/449: Allow use of some org-mime properties,
Stefan Monnier <=
- [elpa] externals/gnorb b81f3e2 083/449: Don't assume any ID references on incoming messages, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 1cdec4b 086/449: New option gnorb-org-find-candidates-match, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb c2a3793 087/449: Don't prompt for action if todo is not possible, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 78e1e2b 090/449: Use custom refile targets in re-attaching files, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 7950d3a 091/449: Comment and indentation changes only, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb f5d451e 092/449: New nngnorb mail backend, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb e62587f 095/449: Yeesh, assigning to global variable by accident, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 8fef972 097/449: Gnorb nnir engine doesn't take extra criteria, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 7f67221 098/449: Allow for more "query" types in nnir-run-gnorb, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb d394ed3 099/449: Let nnir-run-gnorb handle gnus version 5.13, Stefan Monnier, 2020/11/27