Move org-capture settings to their own section
This commit is contained in:
parent
2eb1766496
commit
721fccc2ca
1 changed files with 66 additions and 63 deletions
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
;; Author: Tom Willemse <tom@ryuslash.org>
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
;; Keywords: local
|
;; Keywords: local
|
||||||
;; Version: 2020.0921.182344
|
;; Version: 2020.0921.182555
|
||||||
;; Package-Requires: (oni-yasnippet oni-alert oni-hydra org-plus-contrib org-bullets org-edna diminish all-the-icons)
|
;; 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
|
;; This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -33,7 +33,6 @@
|
||||||
(require 'ob)
|
(require 'ob)
|
||||||
(require 'ol-man)
|
(require 'ol-man)
|
||||||
(require 'org)
|
(require 'org)
|
||||||
(require 'org-capture)
|
|
||||||
(require 'org-clock)
|
(require 'org-clock)
|
||||||
(require 'org-edna)
|
(require 'org-edna)
|
||||||
(require 'org-element)
|
(require 'org-element)
|
||||||
|
@ -77,22 +76,6 @@ installs it will always be ~."
|
||||||
(add-to-list 'yas-snippet-dirs oni-org-snippets-dir t))
|
(add-to-list 'yas-snippet-dirs oni-org-snippets-dir t))
|
||||||
(yas-load-directory oni-org-snippets-dir))
|
(yas-load-directory oni-org-snippets-dir))
|
||||||
|
|
||||||
(defun oni-org-delete-frame-once ()
|
|
||||||
"Run `delete-frame'.
|
|
||||||
|
|
||||||
After running it once remove it from `org-capture-after-finalize-hook'."
|
|
||||||
(delete-frame)
|
|
||||||
(remove-hook 'org-capture-after-finalize-hook 'oni-org-delete-frame-once))
|
|
||||||
|
|
||||||
(defun oni-org-run-capture-in-dedicated-frame ()
|
|
||||||
"Run `org-capture' in a dedicated frame."
|
|
||||||
(with-selected-frame (make-frame '((minibuffer)))
|
|
||||||
(org-capture nil "t")
|
|
||||||
(delete-other-windows)
|
|
||||||
(setf (frame-width) 80)
|
|
||||||
(setf (frame-height) 24)
|
|
||||||
(add-hook 'org-capture-after-finalize-hook 'oni-org-delete-frame-once)))
|
|
||||||
|
|
||||||
(defun oni-org-maybe-change-todo-state (current-state)
|
(defun oni-org-maybe-change-todo-state (current-state)
|
||||||
"Change the state of the current task to in-progress CURRENT-STATE is todo."
|
"Change the state of the current task to in-progress CURRENT-STATE is todo."
|
||||||
(if (string= current-state "TODO")
|
(if (string= current-state "TODO")
|
||||||
|
@ -257,51 +240,6 @@ also move point to the start of the heading."
|
||||||
(oni-org-create-chapter-heading book-name chapter-name notes-file))
|
(oni-org-create-chapter-heading book-name chapter-name notes-file))
|
||||||
(oni-org-create-chapter-section chapter-name notes-file))))
|
(oni-org-create-chapter-section chapter-name notes-file))))
|
||||||
|
|
||||||
(setq org-capture-templates-contexts
|
|
||||||
'(("n" ((in-mode . "nov-mode")))))
|
|
||||||
|
|
||||||
(setq org-capture-templates
|
|
||||||
`(("i" "Inbox" entry (file "")
|
|
||||||
"* %?\n:PROPERTIES:\n:CREATED: %U\n:ORIGIN: %a\n:END:\n\n")
|
|
||||||
("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")
|
|
||||||
("t" "Task" entry (file "")
|
|
||||||
"* TODO %i%?\n :PROPERTIES:\n :CREATED: %U\n :END:")
|
|
||||||
("a" "Appointment" entry (file "")
|
|
||||||
"* TODO %i%?\n %U")
|
|
||||||
("j" "Journal entry" entry
|
|
||||||
(file+olp+datetree
|
|
||||||
,(oni-org-expand-to-home "documents/gtd/journal.org"))
|
|
||||||
"* %<%H:%M:%S>\n %?")
|
|
||||||
("n" "Reading note" item (function oni-org-reading-note)
|
|
||||||
"%?\n\n#+begin_quote\n%i\n#+end_quote"
|
|
||||||
:empty-lines 1)
|
|
||||||
("c" "Add to currently clocked item")
|
|
||||||
("ca" "Note" plain
|
|
||||||
(clock)
|
|
||||||
" %U\n\n %?" :empty-lines 1)
|
|
||||||
("ci" "Item to current clocked task" item
|
|
||||||
(clock)
|
|
||||||
" %i%?" :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"
|
|
||||||
:empty-lines 1)
|
|
||||||
("cC" "Marked code example" plain
|
|
||||||
(clock)
|
|
||||||
" #+BEGIN_EXAMPLE\n %i\n #+END_EXAMPLE"
|
|
||||||
:immediate-finish t :empty-lines 1)
|
|
||||||
("ck" "Kill-ring contents" plain
|
|
||||||
(clock)
|
|
||||||
" %c" :immediate-finish t :empty-lines 1)))
|
|
||||||
|
|
||||||
(setq org-todo-keywords
|
(setq org-todo-keywords
|
||||||
'((sequence "TODO(t)" "NEXT(n)" "BLOCKED(b@)" "IN-PROGRESS(p)"
|
'((sequence "TODO(t)" "NEXT(n)" "BLOCKED(b@)" "IN-PROGRESS(p)"
|
||||||
"|" "DONE(d!)" "CANCELLED(c@)")))
|
"|" "DONE(d!)" "CANCELLED(c@)")))
|
||||||
|
@ -386,5 +324,70 @@ also move point to the start of the heading."
|
||||||
|
|
||||||
(add-hook 'org-mode-hook #'oni-org-initialize-agenda-category-icons)
|
(add-hook 'org-mode-hook #'oni-org-initialize-agenda-category-icons)
|
||||||
|
|
||||||
|
;;;; Capture
|
||||||
|
|
||||||
|
(require 'org-capture)
|
||||||
|
|
||||||
|
(defun oni-org-delete-frame-once ()
|
||||||
|
"Run `delete-frame'.
|
||||||
|
|
||||||
|
After running it once remove it from `org-capture-after-finalize-hook'."
|
||||||
|
(delete-frame)
|
||||||
|
(remove-hook 'org-capture-after-finalize-hook 'oni-org-delete-frame-once))
|
||||||
|
|
||||||
|
(defun oni-org-run-capture-in-dedicated-frame ()
|
||||||
|
"Run `org-capture' in a dedicated frame."
|
||||||
|
(with-selected-frame (make-frame '((minibuffer)))
|
||||||
|
(org-capture nil "t")
|
||||||
|
(delete-other-windows)
|
||||||
|
(setf (frame-width) 80)
|
||||||
|
(setf (frame-height) 24)
|
||||||
|
(add-hook 'org-capture-after-finalize-hook 'oni-org-delete-frame-once)))
|
||||||
|
|
||||||
|
(setq org-capture-templates
|
||||||
|
`(("i" "Inbox" entry (file "")
|
||||||
|
"* %?\n:PROPERTIES:\n:CREATED: %U\n:ORIGIN: %a\n:END:\n\n")
|
||||||
|
("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")
|
||||||
|
("t" "Task" entry (file "")
|
||||||
|
"* TODO %i%?\n :PROPERTIES:\n :CREATED: %U\n :END:")
|
||||||
|
("a" "Appointment" entry (file "")
|
||||||
|
"* TODO %i%?\n %U")
|
||||||
|
("j" "Journal entry" entry
|
||||||
|
(file+olp+datetree
|
||||||
|
,(oni-org-expand-to-home "documents/gtd/journal.org"))
|
||||||
|
"* %<%H:%M:%S>\n %?")
|
||||||
|
("n" "Reading note" item (function oni-org-reading-note)
|
||||||
|
"%?\n\n#+begin_quote\n%i\n#+end_quote"
|
||||||
|
:empty-lines 1)
|
||||||
|
("c" "Add to currently clocked item")
|
||||||
|
("ca" "Note" plain
|
||||||
|
(clock)
|
||||||
|
" %U\n\n %?" :empty-lines 1)
|
||||||
|
("ci" "Item to current clocked task" item
|
||||||
|
(clock)
|
||||||
|
" %i%?" :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"
|
||||||
|
:empty-lines 1)
|
||||||
|
("cC" "Marked code example" plain
|
||||||
|
(clock)
|
||||||
|
" #+BEGIN_EXAMPLE\n %i\n #+END_EXAMPLE"
|
||||||
|
:immediate-finish t :empty-lines 1)
|
||||||
|
("ck" "Kill-ring contents" plain
|
||||||
|
(clock)
|
||||||
|
" %c" :immediate-finish t :empty-lines 1)))
|
||||||
|
|
||||||
|
(setq org-capture-templates-contexts
|
||||||
|
'(("n" ((in-mode . "nov-mode")))))
|
||||||
|
|
||||||
(provide 'oni-org)
|
(provide 'oni-org)
|
||||||
;;; oni-org.el ends here
|
;;; oni-org.el ends here
|
||||||
|
|
Loading…
Reference in a new issue