branch: externals/org-transclusion
commit 9a4d8315ddea7e65d9dc5ce10e295fc75fd9e8af
Author: gggion <[email protected]>
Commit: gggion <[email protected]>

    feat: add org-transclusion-source-overlay-modified hook
    
    Add modification hook to source overlays that updates fringe indicators
    when org-indent-mode dynamically recomputes indentation. This ensures
    fringe indicators remain synchronized with org-indent's text properties
    after buffer modifications.
    
    * org-transclusion.el (org-transclusion-source-overlay-modified): New
    function. Called by overlay modification-hooks property after buffer
    changes. Checks overlay validity and whether modification has completed
    (after-p is t), then re-applies fringe indicators to the overlay's
    region using org-transclusion-add-fringe-to-region.
    
    org-indent-mode updates line-prefix and wrap-prefix properties
    dynamically as the user edits. Without this hook, those updates would
    remove our fringe indicators. The hook re-appends fringes after
    org-indent's updates complete.
---
 org-transclusion.el | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/org-transclusion.el b/org-transclusion.el
index 7284402165..3e910e5805 100644
--- a/org-transclusion.el
+++ b/org-transclusion.el
@@ -1348,6 +1348,17 @@ Only operates when `org-indent-mode' is active in 
BUFFER."
                                     existing-wrap-prefix face))))
             (forward-line 1)))))))
 
+(defun org-transclusion-source-overlay-modified (ov after-p _beg _end 
&optional _len)
+  "Update source overlay OV indentation after modification.
+Called by overlay modification hooks. AFTER-P is t after modification.
+This ensures fringe indicators stay synchronized with org-indent-mode's
+dynamic updates."
+  (when (and after-p (overlay-buffer ov))
+    (let ((ov-beg (overlay-start ov))
+          (ov-end (overlay-end ov)))
+      (org-transclusion-add-fringe-to-region
+       (overlay-buffer ov) ov-beg ov-end 'org-transclusion-source-fringe))))
+
 (defun org-transclusion-find-source-marker (beg end)
   "Return marker that points to source begin point for transclusion.
 It works on the transclusion region at point.  BEG and END are

Reply via email to