[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnorb ee8b595 036/449: Merge gnorb-org-handle-mail func
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnorb ee8b595 036/449: Merge gnorb-org-handle-mail functions |
Date: |
Fri, 27 Nov 2020 23:15:03 -0500 (EST) |
branch: externals/gnorb
commit ee8b59594995ea45ba9903d826e8dd7d4d5d54b2
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>
Merge gnorb-org-handle-mail functions
gnorb.org.el: There used to be two separate functions for agenda and
non-agenda use. No reason for that...
---
README.org | 50 ++++++++++++++++++++++++++++----------------------
lisp/gnorb-org.el | 29 +++++++++++++----------------
2 files changed, 41 insertions(+), 38 deletions(-)
diff --git a/README.org b/README.org
index 5b9a46e..f248abf 100644
--- a/README.org
+++ b/README.org
@@ -50,37 +50,43 @@ Prompt for a BBDB record and insert a string of the type
"Bob Smith
**** gnorb-org-contact-link
Prompt for a BBDB record and insert a link to that record at
point.
-**** gnorb-org-handle-mail(-agenda)
-Call these functions on a headline containing links to Gnus messages,
-or mailto links, or BBDB links. Either start a reply to the linked
-message, or a new message, with the linked addresses in the "To"
-field. When the message is sent, return to the original Org buffer. If
-the TODO keyword is a member of `gnorb-org-mail-todos' (by default,
-"MAIL" and "REPLY"), then call `org-agenda-todo' and prompt to mark
-the TODO as done.
+**** gnorb-org-handle-mail
+This function does its best to interpret the heading under point as an
+email action.
-This works best with a matching capture template: if the template
-stores a link to the message under point within the headline text,
-this command will reply to that message in a DWIM style.
+If the heading text contains a link to a Gnus message then start a
+reply to that message, otherwise start composing a new message. If the
+heading contains mailto links or BBDB links, put those addresses in
+the "To" field of the new message (or reply). If the heading has
+org-attach'ed attachments, prompt to attach them to the outgoing
+message.
+
+When the message is sent, return to the original Org buffer. If the
+heading's TODO keyword is a member of `gnorb-org-mail-todos' (by
+default, "MAIL" and "REPLY"), then call `org-agenda-todo' and prompt
+to mark the TODO as done. Set that option to nil to prompt for all
+TODO keywords.
+
+This works best with a matching capture template: the template stores
+a link to the message under point within the headline text, and this
+command replies to that message in a DWIM style.
-If the heading has org-attach'ed attachments, prompt to attach them to
-the outgoing message.
**** gnorb-org-email-subtree
Call on a Org subtree to export the subtree as either text or a file.
Then compose a message with the text in the message body, or the file
attached to the message.
There's a little overlap with org-mime, but this function allows for
-attaching files, and does not compose an HTML message. I may look into
-integrating it a bit with org-mime later.
+exporting the subtree as a file, and does not compose a MIME-multipart
+HTML message. I may look into integrating it a bit with org-mime
+later.
-This function is also a bit similar to
-`gnorb-org-handle-mail(-agenda)': it will also collect email address
-links from the heading and put them in the "To" field of the message,
-and also prompt to send org-attach'ed attachments along with the
-email.
+This function is also overlaps with `gnorb-org-handle-mail':
+it will also collect email address links from the heading and put them
+in the "To" field of the message, and also prompts to send
+org-attach'ed attachments along with the email.
-What's the difference, then? Use `gnorb-org-handle-mail(-agenda)' when
+What's the difference, then? Use `gnorb-org-handle-mail' when
the primary purpose of the heading is as a TODO reminding you to send
or reply to an email. Any text under the heading will be disregarded.
@@ -98,7 +104,7 @@ more distinct.
(org-defkey org-mode-map (kbd "C-c H") 'gnorb-org-handle-mail)
(org-defkey org-mode-map (kbd "C-c E") 'gnorb-org-email-subtree)
(eval-after-load "org-agenda"
- '(org-defkey org-agenda-mode-map (kbd "H")
'gnorb-org-handle-mail-agenda))))
+ '(org-defkey org-agenda-mode-map (kbd "H") 'gnorb-org-handle-mail))))
#+END_SRC
** Gnorb-Gnus
*** Functions
diff --git a/lisp/gnorb-org.el b/lisp/gnorb-org.el
index 373f6e7..df9825c 100644
--- a/lisp/gnorb-org.el
+++ b/lisp/gnorb-org.el
@@ -106,14 +106,22 @@ point."
(org-attach-file-list attach-dir))))
files)))
-(defun gnorb-org-handle-mail (&optional from-agenda)
+(defun gnorb-org-handle-mail ()
"Handle mail-related links for current headline."
(interactive)
+ (setq gnorb-org-window-conf (current-window-configuration))
+ (when (eq major-mode 'org-agenda-mode)
+ (org-agenda-check-type t 'agenda 'timeline 'todo 'tags)
+ (org-agenda-check-no-diary)
+ (let* ((marker (or (org-get-at-bol 'org-hd-marker)
+ (org-agenda-error)))
+ (buffer (marker-buffer marker))
+ (pos (marker-position marker)))
+ (switch-to-buffer buffer)
+ (widen)
+ (goto-char pos)))
(unless (org-back-to-heading t)
(error "Not in an org item"))
- (unless from-agenda
- ;; window conf should return to the agenda.
- (setq gnorb-org-window-conf (current-window-configuration)))
(let ((mail-stuff (gnorb-org-extract-mail-stuff))
(attachments (gnorb-org-attachment-list)))
(gnorb-org-setup-message (first mail-stuff) (second mail-stuff))
@@ -131,18 +139,7 @@ point."
(defun gnorb-org-handle-mail-agenda ()
"Examine item at point for mail-related links, and handle them."
- (interactive)
- (org-agenda-check-type t 'agenda 'timeline 'todo 'tags)
- (org-agenda-check-no-diary)
- (let* ((marker (or (org-get-at-bol 'org-hd-marker)
- (org-agenda-error)))
- (buffer (marker-buffer marker))
- (pos (marker-position marker)))
- (setq gnorb-org-window-conf (current-window-configuration))
- (with-current-buffer buffer
- (widen)
- (goto-char pos)
- (gnorb-org-handle-mail t))))
+ (interactive))
;;; Email subtree
- [elpa] externals/gnorb a680c42 058/449: Moving the mail header stuff to a different file, (continued)
- [elpa] externals/gnorb a680c42 058/449: Moving the mail header stuff to a different file, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 8519593 060/449: Rework Org BBDB popups, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 97c0d41 045/449: Place point somewhere useful after setting up message, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb c9e4dfb 056/449: Limit to TODOs only in BBDB tag searches, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 210851e 065/449: That's not broken anymore., Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 72a98bd 020/449: README.org: Document new capture attachment thingy., Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb e2617e0 030/449: gnorb-org.el: That's not how return-actions look, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb c5e3459 033/449: README.org: Fixed keybinding for mime map, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 0e75c71 035/449: Note future mail-search-from-agenda function, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 1024a81 037/449: New gnorb-org-capture-collect-link-p option, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb ee8b595 036/449: Merge gnorb-org-handle-mail functions,
Stefan Monnier <=
- [elpa] externals/gnorb 5b9e163 047/449: Allow attaching in all captures., Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 3a95a07 049/449: First go at `gnorb-org-agenda-popup-bbdb', Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb cf975f5 048/449: Refactor gnorb-org mail-related stuff., Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb ac3a4d2 050/449: Change README.org wording, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 78f625b 052/449: Documentation and whitespace changes, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb ac392c0 053/449: Leave point in body of message replies, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb e05fafe 054/449: `gnorb-org-popup-agenda-popup-bbdb' keybinding, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 32a88b8 061/449: Wishlist item for outgoing messages, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 5ba5ce4 062/449: Rework gnorb-org-restore-after-send, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 8246cd4 064/449: Restore from mails more reliably, Stefan Monnier, 2020/11/27