From 3a5ea16176841881cf974cc0cfa3c414931cd383 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 13 Jun 2022 16:16:11 -0700 Subject: [oni-org] Update all dynamic blocks on save Skip any that are in archived files. --- oni-org/oni-org.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'oni-org') 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 ;; 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) -- cgit v1.2.3-54-g00ecf