[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnorb d254f39 140/449: Merge and simplify handle-mail a
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnorb d254f39 140/449: Merge and simplify handle-mail and email-subtree |
Date: |
Fri, 27 Nov 2020 23:15:26 -0500 (EST) |
branch: externals/gnorb
commit d254f39fa6ca49254518408507598069cafd2af5
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>
Merge and simplify handle-mail and email-subtree
lisp/gnorb-org.el: (gnorb-org-handle-mail, gnorb-org-email-subtree)
Finally have `gnorb-org-emial-subtree' simply call
`gnorb-org-handle-mail' once it's done. Along the way
simplified how BBDB contacts are handled in the link
collection process, and fixed a bug from 9ecb0e2.
lisp/gnorb-utils.el: (gnorb-bbdb-link-to-mail) Deleted function, no
longer necessary.
---
lisp/gnorb-org.el | 54 +++++++++++++++++++----------------------------------
lisp/gnorb-utils.el | 8 --------
2 files changed, 19 insertions(+), 43 deletions(-)
diff --git a/lisp/gnorb-org.el b/lisp/gnorb-org.el
index b900716..7f79916 100644
--- a/lisp/gnorb-org.el
+++ b/lisp/gnorb-org.el
@@ -464,7 +464,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)
(if (not messages)
(message-goto-subject)
@@ -484,7 +484,7 @@ current heading."
(org-attach-file-list attach-dir))))
files)))
-(defun gnorb-org-handle-mail (&optional arg)
+(defun gnorb-org-handle-mail (&optional arg text file)
"Handle current headline as a mail TODO."
(interactive "P")
(setq gnorb-org-window-conf (current-window-configuration))
@@ -527,9 +527,20 @@ current heading."
(org-id (org-id-get-create))
(recs (plist-get links :bbdb))
mails)
+ (when file
+ (cons g file attachments))
+ (when recs
+ (setq recs
+ (delete nil
+ (mapcar
+ (lambda (r)
+ (car (bbdb-message-search
+ (org-link-unescape r)
+ nil)))
+ recs))))
(when recs
(dolist (r recs)
- (push (gnorb-bbdb-link-to-mail r) mails)))
+ (push (bbdb-mail-address r) mails)))
(when (and gnorb-bbdb-posting-styles
recs)
(add-hook 'message-mode-hook
@@ -537,10 +548,10 @@ current heading."
(gnorb-bbdb-configure-posting-styles (cdr recs))
(gnorb-bbdb-configure-posting-styles (list (car
recs))))))
(gnorb-org-setup-message
- (plist-get links :gnus) ; gnus links
+ (plist-get links :gnus)
(append mails (plist-get links :mail))
from cc bcc
- attachments nil org-id))))))
+ attachments text org-id))))))
(defun gnorb-org-add-id-hash-entry (msg-id &optional marker)
(org-with-point-at (or marker (point))
@@ -693,39 +704,12 @@ default set of parameters."
t gnorb-tmp-dir)
,@opts
,gnorb-org-email-subtree-file-parameters))))
- (strategy (cond
- ((null arg)
- (car gnorb-org-mail-scan-strategies))
- ((equal '(4) arg)
- (nth 1 gnorb-org-mail-scan-strategies))
- ((equal '(16) arg)
- (nth 2 gnorb-org-mail-scan-strategies))))
- (links (gnorb-org-extract-mail-stuff strategy))
- (attachments (gnorb-org-attachment-list))
- (org-id (org-id-get-create))
- (recs (plist-get links :bbdb))
- text mails )
- ;; this should just go into a call to `org-handle-mail', passing
- ;; the results of the export as an argument
+ text file)
(setq gnorb-org-window-conf (current-window-configuration))
(if (bufferp result)
(setq text result)
- (push result attachments))
- (when recs
- (dolist (r recs)
- (push (gnorb-bbdb-link-to-mail r) mails)))
- (when (and gnorb-bbdb-posting-styles
- recs)
- (add-hook 'message-mode-hook
- (lambda ()
- (gnorb-bbdb-configure-posting-styles (cdr recs))
- (gnorb-bbdb-configure-posting-styles (list (car recs))))))
- (gnorb-org-setup-message
- (plist-get links :gnus)
- (append mails (plist-get links :mails))
- nil nil nil ;; when this calls into `org-handle-mail' all this
- ;; will be sorted
- attachments text org-id)))
+ (setq file result))
+ (gnorb-org-handle-mail arg text file)))
(defcustom gnorb-org-capture-collect-link-p t
"Should the capture process store a link to the gnus message or
diff --git a/lisp/gnorb-utils.el b/lisp/gnorb-utils.el
index 7e26cf3..ce40b28 100644
--- a/lisp/gnorb-utils.el
+++ b/lisp/gnorb-utils.el
@@ -158,14 +158,6 @@ the prefix arg."
(call-interactively note-func)
(call-interactively todo-func)))))
-(defsubst gnorb-bbdb-link-to-mail (link)
- (with-current-buffer bbdb-buffer-name
- (let ((recs bbdb-records))
- (org-open-link-from-string (concat "[[bbdb:" link "]]"))
- (let ((mail (bbdb-mail-address (bbdb-current-record))))
- (bbdb-display-records recs)
- mail))))
-
(defun gnorb-scan-links (bound &rest types)
;; this function could be refactored somewhat -- lots of code
;; repetition. It also should be a little faster for when we're
- [elpa] externals/gnorb ec32255 231/449: Use org-reveal when restoring/triggering, (continued)
- [elpa] externals/gnorb ec32255 231/449: Use org-reveal when restoring/triggering, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 4da19b0 232/449: Get rid of gnorb-org-mail-todos, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 01f0a31 235/449: Move all *.el files out of lisp/ to top directory, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb eab79ec 241/449: Allow attachment transfers in nngnorb summary buffers, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 20de4ee 104/449: Caching of msg-id to org-id correlations, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb edab89d 110/449: Be more careful about cleaning up attachments, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 6375f83 112/449: And append doesn't modify destructively..., Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb f7b93f2 115/449: Whitespace/indentation cleanup, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb e86d24a 119/449: Robustification of nngnorb nnir message viewing, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb e089d66 129/449: Documenting recent additions in the README, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb d254f39 140/449: Merge and simplify handle-mail and email-subtree,
Stefan Monnier <=
- [elpa] externals/gnorb de3a512 244/449: Releasing version 1, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 4b8a6da 255/449: New function for removing message/heading association, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb aaf8556 261/449: Be a good citizen about the cl package, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb de3182e 263/449: Shift location of org-reveal during trigger process, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 6246244 106/449: Hinting for potentially-relevant incoming messages, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb a79cf72 126/449: Unwrap "if" from around function, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 0255247 133/449: Only notice records on message receipt, not sending, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb b70d845 168/449: Handle nil group values in registry entries, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 880afd6 158/449: Register sent messages so we can view them later, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 25aa0f1 173/449: Use a marker in conjunction with window conf, Stefan Monnier, 2020/11/27