emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org 3aac00e45d: lisp/org-indent.el: Add hook to run aft


From: ELPA Syncer
Subject: [elpa] externals/org 3aac00e45d: lisp/org-indent.el: Add hook to run after it initializes a buffer
Date: Wed, 3 Jan 2024 12:58:30 -0500 (EST)

branch: externals/org
commit 3aac00e45dc917c9174d1ecb1a80ffa41a3d2199
Author: Alexandre Avanian <git@alexandre.avanian.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    lisp/org-indent.el: Add hook to run after it initializes a buffer
    
    * lisp/org-indent.el (org-indent-initialize-buffer): Define and call
    hook after it initializes a buffer.
    * etc/ORG-NEWS: Announce new custom option.
    
    This will allow to enrich org-indent properties without requiring
    hacks to detect initialization.
    See 
https://list.orgmode.org/orgmode/5f4cdb77-8f43-4f2d-91a7-bc4ce57df8ad@app.fastmail.com/#r
    
    TINYCHANGE
---
 etc/ORG-NEWS       |  5 +++++
 lisp/org-indent.el | 11 ++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 7d0822faf4..a906d116f9 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 62ebd6be0b..c402aec723 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]