From e17b0f28bd659d09e5ccebc707843b2c5dd82801 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sat, 2 Jul 2022 14:20:37 -0700 Subject: feat(org): add a capture template for tasks related to mail By pressing "m" I can create a task related to the current opened email. Change-Id: I63b7cc69cd6ba4fe66e9fbb526e073f75e0a7b3b Reviewed-on: https://cl.fcuny.net/c/emacs.d/+/605 Tested-by: CI Reviewed-by: Franck Cuny --- emacs/custom/my-org.el | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'emacs') diff --git a/emacs/custom/my-org.el b/emacs/custom/my-org.el index 77d428c..55cf707 100644 --- a/emacs/custom/my-org.el +++ b/emacs/custom/my-org.el @@ -8,6 +8,7 @@ (require 'org-archive) (require 'ox) (require 'ox-md) +(require 'notmuch) (defvar my/org-directory (if (memq window-system '(mac ns)) @@ -96,6 +97,12 @@ ((org-agenda-overriding-header "Not yet started") (org-agenda-skip-function '(org-agenda-skip-entry-if 'deadline 'scheduled))))))) +(defun my/mail-todo-format-string () + "Create todo format string from mail contents." + (let ((from (notmuch-show-get-from)) + (subject (notmuch-show-get-subject))) + (format "* TODO [#B] %s %s %%?\n:PROPERTIES:\n:CREATED: %%U\n:END:\n" from subject))) + (setq org-capture-templates `(("t" "Todo" entry (file "inbox.org") "* TODO [#D] %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n") @@ -108,6 +115,9 @@ ":PROPERTIES:\n:CREATED: %T\n:END:\n" "%a\n")) + ("m" "mail" entry (file "inbox.org") + (function my/mail-todo-format-string)) + ("j" "Journal" entry (file+olp+datetree "journal.org") "* %?\n:PROPERTIES:\n:CREATED: %T\n:END:\n" :tree-type day))) -- cgit 1.4.1