[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnorb 9f13881 067/449: First whack at gnorb-gnus-messag
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnorb 9f13881 067/449: First whack at gnorb-gnus-message-trigger-todo |
Date: |
Fri, 27 Nov 2020 23:15:10 -0500 (EST) |
branch: externals/gnorb
commit 9f1388124b8b66cbe581274234314dca432893f1
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>
First whack at gnorb-gnus-message-trigger-todo
* gnorb-gnus.el: new function
This works fine as it is, but it's not that exciting yet.
---
lisp/gnorb-gnus.el | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/lisp/gnorb-gnus.el b/lisp/gnorb-gnus.el
index 18c74ab..371c8c9 100644
--- a/lisp/gnorb-gnus.el
+++ b/lisp/gnorb-gnus.el
@@ -239,5 +239,47 @@ current message; multiple header values returned as a
string."
(add-hook 'message-send-hook 'gnorb-gnus-check-org-header)
+;;; If an incoming message should trigger state-change for a Org todo,
+;;; call this function on it.
+
+(defcustom gnorb-gnus-message-trigger-default 'note
+ "What default action should be taken when triggering TODO
+ state-change from a message? Valid values are the symbols note
+ and todo. Whatever the default is, giving the command a prefix
+ argument will do the opposite."
+ :group 'gnorb-gnus
+ :type '(choice (const note)
+ (const todo)))
+
+(defun gnorb-gnus-message-trigger-todo (arg &optional heading)
+ "Call this function from a received gnus message to store a
+link to the message, prompt for a related Org heading, visit the
+heading, and either add a note or trigger a TODO state change.
+Set `gnorb-gnus-message-trigger-default' to either 'note or
+'todo; you can get the non-default behavior by calling this
+function with a prefix argument."
+ ;; this whole function isn't even going to be that awesome until we
+ ;; teach it how to guess the relevant org heading using message-ids
+ ;; from the References or In-Reply-To headers of the incoming
+ ;; message.
+ (interactive "P")
+ (if (not (memq major-mode '(gnus-summary-mode gnus-article-mode)))
+ (error "Only works in gnus summary or article mode")
+ (org-store-link)
+ (let* ((action (if (not arg)
+ gnorb-gnus-message-trigger-default
+ (if (eq gnorb-gnus-message-trigger-default 'todo)
+ 'note
+ 'todo)))
+ (targ (or heading
+ (org-refile-get-location
+ (format "Trigger heading (%s): " action) nil t))))
+ (find-file (nth 1 org-heading))
+ (goto-char (nth 3 org-heading))
+ (call-interactively
+ (if (eq action 'todo)
+ 'org-todo
+ 'org-add-note)))))
+
(provide 'gnorb-gnus)
;;; gnorb-gnus.el ends here
- [elpa] externals/gnorb 3a95a07 049/449: First go at `gnorb-org-agenda-popup-bbdb', (continued)
- [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
- [elpa] externals/gnorb 89b57f0 066/449: Whoops., Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 9f13881 067/449: First whack at gnorb-gnus-message-trigger-todo,
Stefan Monnier <=
- [elpa] externals/gnorb e472348 073/449: New hook gnorb-org-after-message-setup-hook, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb a165584 041/449: Handle return from mail sending better, Stefan Monnier, 2020/11/27
- [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