1
0
Fork 0

[oni-org] Update all dynamic blocks on save

Skip any that are in archived files.
This commit is contained in:
Tom Willemse 2022-06-13 16:16:11 -07:00
parent df3396bd8f
commit 3a5ea16176

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org> ;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local ;; Keywords: local
;; Version: 2022.0602.214649 ;; Version: 2022.0612.162440
;; Package-Requires: (oni-yasnippet oni-alert oni-hydra org org-contrib org-bullets org-edna diminish all-the-icons olivetti mixed-pitch) ;; Package-Requires: (oni-yasnippet oni-alert oni-hydra org org-contrib org-bullets org-edna diminish all-the-icons olivetti mixed-pitch)
;; This program is free software; you can redistribute it and/or modify ;; This program is free software; you can redistribute it and/or modify
@ -474,6 +474,11 @@ also move point to the start of the heading."
(when (member org-state org-done-keywords) (when (member org-state org-done-keywords)
(outline-hide-body))) (outline-hide-body)))
(defun oni-org-update-all-dblocks-live ()
"Call org-update-all-dblocks if the current file isn't an archive file."
(if (not (string-suffix-p "_archive" (buffer-file-name)))
(org-update-all-dblocks)))
(setq org-todo-keywords (setq org-todo-keywords
'((sequence "TODO(t)" "WIP" "BLOCKED(b@)" "|" "DONE(d!)") '((sequence "TODO(t)" "WIP" "BLOCKED(b@)" "|" "DONE(d!)")
(sequence "READ(r)" "READING(!)" "|" "FINISHED(!)" "STOPPED(@)") (sequence "READ(r)" "READING(!)" "|" "FINISHED(!)" "STOPPED(@)")
@ -490,6 +495,7 @@ also move point to the start of the heading."
(add-to-list 'org-babel-load-languages '(java . t)) (add-to-list 'org-babel-load-languages '(java . t))
(add-hook 'before-save-hook #'oni-org-update-all-dblocks-live)
(add-hook 'org-mode-hook #'oni-org-set-tag-faces) (add-hook 'org-mode-hook #'oni-org-set-tag-faces)
(add-hook 'org-mode-hook #'oni-org-set-todo-keyword-faces) (add-hook 'org-mode-hook #'oni-org-set-todo-keyword-faces)
(add-hook 'org-mode-hook #'oni-org-set-yasnippet-condition) (add-hook 'org-mode-hook #'oni-org-set-yasnippet-condition)