summary refs log tree commit diff
path: root/emacs/custom
diff options
context:
space:
mode:
Diffstat (limited to 'emacs/custom')
-rw-r--r--emacs/custom/my-org.el10
1 files changed, 10 insertions, 0 deletions
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)))