diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 7d0822faf..a906d116f 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -581,6 +581,11 @@ The main change will be for users who did not configure ~ob-python~ will now start interactive sessions in a more consistent manner with ~run-python~. +*** New hook option ~org-indent-post-buffer-init-functions~ + +This allows to run functions after ~org-indent~ intializes a buffer to +enrich its properties. + ** New features *** =ob-plantuml.el=: Support tikz file format output diff --git a/lisp/org-indent.el b/lisp/org-indent.el index 62ebd6be0..c402aec72 100644 --- a/lisp/org-indent.el +++ b/lisp/org-indent.el @@ -103,6 +103,14 @@ For details see the variable `org-adapt-indentation'." :group 'org-indent :type 'integer) +(defcustom org-indent-post-buffer-init-functions nil + "Hook run after org-indent finishes initializing a buffer. +The function(s) in in this hook must accept a single argument representing +the initialized buffer." + :group 'org-indent + :package-version '(Org . "9.7") + :type 'hook) + (defface org-indent '((t (:inherit org-hide))) "Face for outline indentation. The default is to make it look like whitespace. But you may find it @@ -290,7 +298,8 @@ a time value." ;; Job is complete: un-agentize buffer. (unless interruptp (setq org-indent-agentized-buffers - (delq buffer org-indent-agentized-buffers)))))))) + (delq buffer org-indent-agentized-buffers)) + (run-hook-with-args 'org-indent-post-buffer-init-functions buffer))))))) (defun org-indent-set-line-properties (level indentation &optional heading) "Set prefix properties on current line an move to next one.