aboutsummaryrefslogtreecommitdiffstats
path: root/oni-org
diff options
context:
space:
mode:
authorGravatar Tom Willemse2022-06-13 16:16:11 -0700
committerGravatar Tom Willemse2022-06-13 16:16:11 -0700
commit3a5ea16176841881cf974cc0cfa3c414931cd383 (patch)
treed6d145f69fa0c676c7f4d1a80e221e6e544726e7 /oni-org
parentdf3396bd8f98eca3bf63550410d33cacf514830f (diff)
downloademacs-config-3a5ea16176841881cf974cc0cfa3c414931cd383.tar.gz
emacs-config-3a5ea16176841881cf974cc0cfa3c414931cd383.zip
[oni-org] Update all dynamic blocks on save
Skip any that are in archived files.
Diffstat (limited to 'oni-org')
-rw-r--r--oni-org/oni-org.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/oni-org/oni-org.el b/oni-org/oni-org.el
index 9f5cfaf..122dfb6 100644
--- a/oni-org/oni-org.el
+++ b/oni-org/oni-org.el
@@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; 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)
;; 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)
(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
'((sequence "TODO(t)" "WIP" "BLOCKED(b@)" "|" "DONE(d!)")
(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-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-todo-keyword-faces)
(add-hook 'org-mode-hook #'oni-org-set-yasnippet-condition)