diff --git a/oni-org/Cask b/oni-org/Cask index 77fe170..e92ff13 100644 --- a/oni-org/Cask +++ b/oni-org/Cask @@ -6,4 +6,5 @@ (files "*.el" ("snippets" "./snippets/*") - ("icons" "./icons/*")) + ("icons" "./icons/*") + ("capture-templates" "./capture-templates/*")) diff --git a/oni-org/capture-templates/appointment.org b/oni-org/capture-templates/appointment.org new file mode 100644 index 0000000..a29f899 --- /dev/null +++ b/oni-org/capture-templates/appointment.org @@ -0,0 +1,2 @@ +* TODO %i%? +%U diff --git a/oni-org/capture-templates/clocked/code-note.org b/oni-org/capture-templates/clocked/code-note.org new file mode 100644 index 0000000..ee9489f --- /dev/null +++ b/oni-org/capture-templates/clocked/code-note.org @@ -0,0 +1,8 @@ +%U +- File: [[file:%F::%(number-to-string (with-current-buffer (get-buffer (find-file-noselect \"%F\")) (line-number-at-pos (region-beginning))))][%f]] + +%? + +#+BEGIN_SRC %(string-remove-suffix \"-mode\" (symbol-name (with-current-buffer (get-buffer (find-file-noselect \"%F\")) major-mode))) +%i +#+END_SRC" diff --git a/oni-org/capture-templates/clocked/code.org b/oni-org/capture-templates/clocked/code.org new file mode 100644 index 0000000..e8df773 --- /dev/null +++ b/oni-org/capture-templates/clocked/code.org @@ -0,0 +1,3 @@ +#+BEGIN_EXAMPLE +%i +#+END_EXAMPLE diff --git a/oni-org/capture-templates/clocked/item.org b/oni-org/capture-templates/clocked/item.org new file mode 100644 index 0000000..8b3f27b --- /dev/null +++ b/oni-org/capture-templates/clocked/item.org @@ -0,0 +1 @@ +%i%? diff --git a/oni-org/capture-templates/clocked/kill-ring.org b/oni-org/capture-templates/clocked/kill-ring.org new file mode 100644 index 0000000..4a883c8 --- /dev/null +++ b/oni-org/capture-templates/clocked/kill-ring.org @@ -0,0 +1 @@ +%c diff --git a/oni-org/capture-templates/clocked/note.org b/oni-org/capture-templates/clocked/note.org new file mode 100644 index 0000000..f3e8ce3 --- /dev/null +++ b/oni-org/capture-templates/clocked/note.org @@ -0,0 +1,3 @@ +%U + +%? diff --git a/oni-org/capture-templates/inbox-with-selection.org b/oni-org/capture-templates/inbox-with-selection.org new file mode 100644 index 0000000..9dc2f6e --- /dev/null +++ b/oni-org/capture-templates/inbox-with-selection.org @@ -0,0 +1,9 @@ +* %? +:PROPERTIES: +:CREATED: %U +:ORIGIN: %a +:END: + +#+begin_quote +%i +#+end_quote diff --git a/oni-org/capture-templates/inbox.org b/oni-org/capture-templates/inbox.org new file mode 100644 index 0000000..3c97b8a --- /dev/null +++ b/oni-org/capture-templates/inbox.org @@ -0,0 +1,5 @@ +* %? +:PROPERTIES: +:CREATED: %U +:ORIGIN: %a +:END: diff --git a/oni-org/capture-templates/journal.org b/oni-org/capture-templates/journal.org new file mode 100644 index 0000000..a809422 --- /dev/null +++ b/oni-org/capture-templates/journal.org @@ -0,0 +1,3 @@ +* %<%H:%M:%S> + +%? diff --git a/oni-org/capture-templates/reading-note.org b/oni-org/capture-templates/reading-note.org new file mode 100644 index 0000000..bbf1cf7 --- /dev/null +++ b/oni-org/capture-templates/reading-note.org @@ -0,0 +1,5 @@ +%? + +#+begin_quote +%i +#+end_quote diff --git a/oni-org/capture-templates/task.org b/oni-org/capture-templates/task.org new file mode 100644 index 0000000..20a4d69 --- /dev/null +++ b/oni-org/capture-templates/task.org @@ -0,0 +1,4 @@ +* TODO %i%? +:PROPERTIES: +:CREATED: %U +:END: diff --git a/oni-org/oni-org.el b/oni-org/oni-org.el index e40402d..249298a 100644 --- a/oni-org/oni-org.el +++ b/oni-org/oni-org.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2020.0921.182555 +;; Version: 2020.0921.184312 ;; Package-Requires: (oni-yasnippet oni-alert oni-hydra org-plus-contrib org-bullets org-edna diminish all-the-icons) ;; This program is free software; you can redistribute it and/or modify @@ -328,6 +328,10 @@ also move point to the start of the heading." (require 'org-capture) +(defconst oni-org-capture-template-directory + (expand-file-name "capture-templates" oni-org-root) + "Directory where the template files for ‘org-capture’ are located.") + (defun oni-org-delete-frame-once () "Run `delete-frame'. @@ -346,45 +350,43 @@ After running it once remove it from `org-capture-after-finalize-hook'." (setq org-capture-templates `(("i" "Inbox" entry (file "") - "* %?\n:PROPERTIES:\n:CREATED: %U\n:ORIGIN: %a\n:END:\n\n") + (file ,(expand-file-name "inbox.org" oni-org-capture-template-directory))) ("I" "Inbox (add selection)" entry (file "") - "* %?\n:PROPERTIES:\n:CREATED: %U\n:ORIGIN: %a\n:END:\n\n#+begin_quote\n%i\n#+end_quote") + (file ,(expand-file-name "inbox-with-selection.org" oni-org-capture-template-directory))) ("t" "Task" entry (file "") - "* TODO %i%?\n :PROPERTIES:\n :CREATED: %U\n :END:") + (file ,(expand-file-name "task.org" oni-org-capture-template-directory))) ("a" "Appointment" entry (file "") - "* TODO %i%?\n %U") + (file ,(expand-file-name "appointment.org" oni-org-capture-template-directory))) ("j" "Journal entry" entry (file+olp+datetree ,(oni-org-expand-to-home "documents/gtd/journal.org")) - "* %<%H:%M:%S>\n %?") + (file ,(expand-file-name "journal.org" oni-org-capture-template-directory))) ("n" "Reading note" item (function oni-org-reading-note) - "%?\n\n#+begin_quote\n%i\n#+end_quote" + (file ,(expand-file-name "reading-note.org" oni-org-capture-template-directory)) :empty-lines 1) ("c" "Add to currently clocked item") ("ca" "Note" plain (clock) - " %U\n\n %?" :empty-lines 1) + (file ,(expand-file-name "clocked/note.org" oni-org-capture-template-directory)) + :empty-lines 1) ("ci" "Item to current clocked task" item (clock) - " %i%?" :empty-lines 1) + (file ,(expand-file-name "clcoked/item.org" oni-org-capture-template-directory)) + :empty-lines 1) ("cc" "Marked code example with notes" plain (clock) - " %U - - File: [[file:%F::%(number-to-string (with-current-buffer (get-buffer (find-file-noselect \"%F\")) (line-number-at-pos (region-beginning))))][%f]] - - %? - - #+BEGIN_SRC %(string-remove-suffix \"-mode\" (symbol-name (with-current-buffer (get-buffer (find-file-noselect \"%F\")) major-mode))) - %i - #+END_SRC" + (file ,(expand-file-name "clocked/code-note.org" oni-org-capture-template-directory)) :empty-lines 1) ("cC" "Marked code example" plain (clock) - " #+BEGIN_EXAMPLE\n %i\n #+END_EXAMPLE" - :immediate-finish t :empty-lines 1) + (file ,(expand-file-name "clocked/code.org" oni-org-capture-template-directory)) + :immediate-finish t + :empty-lines 1) ("ck" "Kill-ring contents" plain (clock) - " %c" :immediate-finish t :empty-lines 1))) + (file ,(expand-file-name "clocked/kill-ring.org" oni-org-capture-template-directory)) + :immediate-finish t + :empty-lines 1))) (setq org-capture-templates-contexts '(("n" ((in-mode . "nov-mode")))))