diff options
Diffstat (limited to 'custom')
| -rw-r--r-- | custom/jao-custom-org.el | 54 |
1 files changed, 41 insertions, 13 deletions
diff --git a/custom/jao-custom-org.el b/custom/jao-custom-org.el index cbab422..45c2aee 100644 --- a/custom/jao-custom-org.el +++ b/custom/jao-custom-org.el @@ -114,19 +114,47 @@ ;; (window-parameters (mode-line-format . none)))) ;;; Capture templates -(setq org-capture-templates - '(("t" "TODO" entry - (file+headline "inbox.org" "Todo") - "* TODO %?\n %i%a" :prepend t) - ("r" "REPLY" entry - (file+headline "inbox.org" "Todo") - "* REPLY %a\n %t\n %?" :prepend t) - ("a" "Appointment" entry - (file+olp "inbox.org" "Appointments") - "* %^T %?\n %a" :time-prompt t) - ("i" "Inbox note" entry (file+headline "inbox.org" "Notes") - "* %a\n %i%?(added on: %u)" :prepend t))) -;; (org-capture-upgrade-templates org-capture-templates) +(jao-when-darwin + (defun jao-org--safari-tmpl (&optional prefix) + (format "%s%s \n %%?" + (or prefix "* TOREAD ") + (org-mac-link-safari-get-frontmost-url))) + + (defun jao-org--safari-note-tmpl () (jao-org--safari-tmpl "- ")) + + (defun jao-org--mail-tmpl () + (format "* TODO %s \n %%?" (org-mac-link-mail-get-links)))) + +(defun jao-org--set-tmpl (k tmpl) + (setf (alist-get k org-capture-templates nil nil #'string=) tmpl)) + +(defun jao-org-capture-templates (target) + (jao-org--set-tmpl "t" + `("todo" entry (file+headline ,target "Tasks") + "* TODO %?\n %i%a" :prepend t)) + (jao-org--set-tmpl "i" + `("inbox note" entry (file+headline ,target "Notes") + "* %a\n %i%?(added on: %u)" :prepend t)) + (jao-org--set-tmpl "a" + `("appointment" entry (file+olp ,target "Appointments") + "* %^T %?\n %a" :time-prompt t)) + (jao-when-darwin + (jao-org--set-tmpl "s" + `("safari" entry (file+headline ,target "Tasks") + (function jao-org--safari-tmpl) + :after-finalize jao-org-after-capture-hook)) + + (jao-org--set-tmpl "S" + '("safari note" plain (file jao-org-notes-create) + (function jao-org--safari-note-tmpl) + :after-finalize jao-org-after-capture-hook)) + (jao-org--set-tmpl "m" + `("mail" entry (file+headline ,target "Tasks") + (function jao-org--mail-tmpl) + :after-finalize jao-org-after-capture-hook))) + (org-capture-upgrade-templates org-capture-templates)) + +(jao-org-capture-templates "inbox.org") ;;; MIME and file apps (setq org-file-apps |
