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

    fix: restore fringe indicators in destination buffer with org-indent-mode
    
    * org-transclusion-indent-mode.el
    (org-transclusion-indent--add-properties-and-fringes): Rename from
    org-transclusion-indent--add-properties. Re-add call to
    org-transclusion-add-fringe-to-region for destination buffer after
    org-indent-add-properties. Update docstring to clarify function
    handles both org-indent properties and fringe preservation.
    (org-transclusion-indent-mode): Update docstring to clarify mode
    serves dual purpose for destination and source buffers.
    
    Previous commit incorrectly removed destination buffer fringes, adding
    them back to recover lost functionality.
    
    Source buffer fringe preservation (via org-transclusion-indent-mode
    minor mode with debounced re-application) remains unchanged and
    continues to work correctly.
---
 org-transclusion-indent-mode.el | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/org-transclusion-indent-mode.el b/org-transclusion-indent-mode.el
index 9037981951..c4d8a53bff 100644
--- a/org-transclusion-indent-mode.el
+++ b/org-transclusion-indent-mode.el
@@ -25,8 +25,9 @@
 ;;
 ;;  This extension ensures org-indent-mode properties are correctly
 ;;  applied to transcluded content and refreshed after transclusion
-;;  removal. It also preserves fringe indicators in source buffers
-;;  when org-indent-mode regenerates line-prefix properties.
+;;  removal. It also preserves fringe indicators in both source and
+;;  destination buffers when org-indent-mode regenerates line-prefix
+;;  properties.
 ;;
 ;;  The timing mechanism for synchronizing with org-indent's asynchronous
 ;;  initialization is copied from org-modern-indent.
@@ -164,11 +165,20 @@ Added to `post-command-hook' in `org-mode' buffers with 
`org-indent-mode'."
 
 ;;;; Destination Buffer Support
 
-(defun org-transclusion-indent--add-properties (beg end)
-  "Ensure org-indent properties exist in transcluded region.
-BEG and END are the transcluded region bounds."
+(defun org-transclusion-indent--add-properties-and-fringes (beg end)
+  "Ensure org-indent properties and fringe indicators in transcluded region.
+BEG and END are the transcluded region bounds.
+
+When org-indent-mode is active, `org-indent-add-properties' overwrites
+the uniform `line-prefix' and `wrap-prefix' properties set by the main
+package, removing fringe indicators. This function re-applies fringes
+by appending them to org-indent's indentation prefixes."
   (when org-indent-mode
-    (org-indent-add-properties beg end)))
+    ;; First ensure org-indent properties exist
+    (org-indent-add-properties beg end)
+    ;; Then re-apply fringe indicators to destination buffer
+    (org-transclusion-add-fringe-to-region
+     (current-buffer) beg end 'org-transclusion-fringe)))
 
 (defun org-transclusion-indent--refresh-source-region (src-buf src-beg src-end)
   "Refresh org-indent properties in source region after transclusion removal.
@@ -190,7 +200,7 @@ SRC-BUF is the source buffer, SRC-BEG and SRC-END are the 
region bounds."
 This mode serves two purposes:
 
 1. In destination buffers: ensures org-indent properties are applied
-   to transcluded content.
+   and fringe indicators are preserved when org-indent overwrites them.
 
 2. In source buffers: preserves fringe indicators when org-indent-mode
    regenerates `line-prefix' properties.
@@ -249,7 +259,7 @@ Adds `post-command-hook' to detect when source overlays 
appear."
 ;;;; Hook Registration
 
 (add-hook 'org-transclusion-after-add-functions
-          #'org-transclusion-indent--add-properties)
+          #'org-transclusion-indent--add-properties-and-fringes)
 (add-hook 'org-transclusion-after-remove-functions
           #'org-transclusion-indent--refresh-source-region)
 

Reply via email to