lang/org: refactor & add org-clock config/keybinds

This commit is contained in:
Henrik Lissner 2018-05-18 01:43:37 +02:00
parent 84befc0303
commit 7db7aed52d
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -20,12 +20,6 @@
:commands toc-org-enable :commands toc-org-enable
:config (setq toc-org-hrefify-default "org")) :config (setq toc-org-hrefify-default "org"))
(def-package! org-crypt ; built-in
:commands org-crypt-use-before-save-magic
:config
(setq org-tags-exclude-from-inheritance '("crypt")
org-crypt-key user-mail-address))
(def-package! org-bullets (def-package! org-bullets
:commands org-bullets-mode) :commands org-bullets-mode)
@ -89,6 +83,7 @@ unfold to point on startup."
(defun +org|smartparens-compatibility-config () (defun +org|smartparens-compatibility-config ()
"Instruct `smartparens' not to impose itself in org-mode." "Instruct `smartparens' not to impose itself in org-mode."
(after! smartparens
(defun +org-sp-point-in-checkbox-p (_id action _context) (defun +org-sp-point-in-checkbox-p (_id action _context)
(and (eq action 'insert) (and (eq action 'insert)
(sp--looking-at-p "\\s-*]"))) (sp--looking-at-p "\\s-*]")))
@ -98,7 +93,6 @@ unfold to point on startup."
(sp--looking-back-p "^\\**" (line-beginning-position)))) (sp--looking-back-p "^\\**" (line-beginning-position))))
;; make delimiter auto-closing a little more conservative ;; make delimiter auto-closing a little more conservative
(after! smartparens
(sp-with-modes 'org-mode (sp-with-modes 'org-mode
(sp-local-pair "*" nil :unless '(:add sp-point-before-word-p +org-sp-point-at-bol-p)) (sp-local-pair "*" nil :unless '(:add sp-point-before-word-p +org-sp-point-at-bol-p))
(sp-local-pair "_" nil :unless '(:add sp-point-before-word-p)) (sp-local-pair "_" nil :unless '(:add sp-point-before-word-p))
@ -302,7 +296,17 @@ between the two."
:n "zm" (λ! (outline-hide-sublevels 1)) :n "zm" (λ! (outline-hide-sublevels 1))
:n "zo" #'outline-show-subtree :n "zo" #'outline-show-subtree
:n "zO" #'outline-show-all :n "zO" #'outline-show-all
:n "zr" #'outline-show-all)) :n "zr" #'outline-show-all
:localleader
:n "d" #'org-deadline
:n "t" #'org-todo
(:desc "clock" :prefix "c"
:n "c" #'org-clock-in
:n "C" #'org-clock-out
:n "g" #'org-clock-goto
:n "G" (λ! (org-clock-goto 'select))
:n "x" #'org-clock-cancel)))
(defun +org|setup-hacks () (defun +org|setup-hacks ()
"Getting org to behave." "Getting org to behave."
@ -330,6 +334,25 @@ between the two."
(advice-add #'org-get-agenda-file-buffer (advice-add #'org-get-agenda-file-buffer
:around #'+org*exclude-agenda-buffers-from-recentf)) :around #'+org*exclude-agenda-buffers-from-recentf))
;;
;; Built-in libraries
;;
(def-package! org-crypt ; built-in
:commands org-crypt-use-before-save-magic
:config
(setq org-tags-exclude-from-inheritance '("crypt")
org-crypt-key user-mail-address))
(def-package! org-clock
:commands org-clock-save
:hook (org-mode . org-clock-load)
:config
(setq org-clock-persist 'history
org-clock-persist-file (concat doom-etc-dir "org-clock-save.el"))
(add-hook 'kill-emacs-hook 'org-clock-save))
;; ;;
(when (featurep 'org) (when (featurep 'org)
(run-hooks 'org-load-hook)) (run-hooks 'org-load-hook))