diff options
| author | jao <jao@gnu.org> | 2025-12-02 11:38:26 +0000 |
|---|---|---|
| committer | jao <jao@gnu.org> | 2025-12-07 13:51:45 +0000 |
| commit | 82065ce784427e6bbfd4e1c344beee3c614979d9 (patch) | |
| tree | a162fb92d7256307094a64b4548a635e1412b17d /custom/jao-custom-org.el | |
| parent | 7e499b45894f65a8e6323b816451aa4f45f63de2 (diff) | |
| download | elibs-82065ce784427e6bbfd4e1c344beee3c614979d9.tar.gz elibs-82065ce784427e6bbfd4e1c344beee3c614979d9.tar.bz2 | |
org capture templates for darwin
Diffstat (limited to 'custom/jao-custom-org.el')
| -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 |
