1
0
Fork 0

Move all capture templates into their own files

This commit is contained in:
Tom Willemse 2020-09-21 18:46:26 -07:00
parent 721fccc2ca
commit 45658a0bfa
13 changed files with 68 additions and 21 deletions

View file

@ -6,4 +6,5 @@
(files
"*.el"
("snippets" "./snippets/*")
("icons" "./icons/*"))
("icons" "./icons/*")
("capture-templates" "./capture-templates/*"))

View file

@ -0,0 +1,2 @@
* TODO %i%?
%U

View file

@ -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"

View file

@ -0,0 +1,3 @@
#+BEGIN_EXAMPLE
%i
#+END_EXAMPLE

View file

@ -0,0 +1 @@
%i%?

View file

@ -0,0 +1 @@
%c

View file

@ -0,0 +1,3 @@
%U
%?

View file

@ -0,0 +1,9 @@
* %?
:PROPERTIES:
:CREATED: %U
:ORIGIN: %a
:END:
#+begin_quote
%i
#+end_quote

View file

@ -0,0 +1,5 @@
* %?
:PROPERTIES:
:CREATED: %U
:ORIGIN: %a
:END:

View file

@ -0,0 +1,3 @@
* %<%H:%M:%S>
%?

View file

@ -0,0 +1,5 @@
%?
#+begin_quote
%i
#+end_quote

View file

@ -0,0 +1,4 @@
* TODO %i%?
:PROPERTIES:
:CREATED: %U
:END:

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; 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")))))