Commit 087231c59d1b
Changed files (1)
dots
.config
emacs
dots/.config/emacs/init.el
@@ -1921,8 +1921,26 @@ minibuffer, even without explicitly focusing it."
(add-to-list 'org-capture-templates
`("mr" "Read Later" entry
(file ,org-inbox-file)
- "* TODO Read %:subject\nSCHEDULED:%t\nDEADLINE: %(org-insert-time-stamp (org-read-date nil t \"+2d\"))\n\n%a\n\n%i" :immediate-finish t)
+ "* TODO Read %:subject\nSCHEDULED:%t\nDEADLINE: %(org-insert-time-stamp (org-read-date nil t \"+2d\"))\n\n%a\n\n%i" :immediate-finish t)
t)
+ (add-to-list 'org-capture-templates
+ `("mt" "Task from email" entry
+ (file ,org-inbox-file)
+ "* TODO %:subject :email:\n:PROPERTIES:\n:CREATED:\t%U\n:END:\n\nFrom: %:from\nEmail: %a\n\n%?"
+ :empty-lines 1)
+ t)
+
+ (defvar vde/org-capture-refile-templates '("mt")
+ "List of capture template keys that should trigger refile after capture.")
+
+ (defun vde/org-capture-refile-if-needed ()
+ "Refile the captured entry if the template key is in `vde/org-capture-refile-templates'."
+ (when (and (not org-note-abort)
+ (member (plist-get org-capture-plist :key) vde/org-capture-refile-templates))
+ (org-capture-goto-last-stored)
+ (call-interactively 'org-refile)))
+
+ (add-hook 'org-capture-after-finalize-hook #'vde/org-capture-refile-if-needed)
(add-to-list 'org-capture-templates
`("J" "๐ Journal (antidated) entry" item
(file+datetree+prompt ,org-journal-file)