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

    fix: change fringe removal to be precise regardless of indent-mode
    
    * org-transclusion.el (org-transclusion-remove-fringe-from-region):
    Always use precise fringe removal regardless of org-indent-mode state.
    Previously, when org-indent-mode was inactive, this function removed
    line-prefix and wrap-prefix properties entirely, potentially destroying
    prefixes set by other packages or user code.  Now always calls
    org-transclusion-remove-fringe-from-prefix to strip only the fringe
    portion while preserving other content.
---
 org-transclusion.el | 45 ++++++++++++++++++---------------------------
 1 file changed, 18 insertions(+), 27 deletions(-)

diff --git a/org-transclusion.el b/org-transclusion.el
index 94ed56bdb7..588d38e012 100644
--- a/org-transclusion.el
+++ b/org-transclusion.el
@@ -1473,37 +1473,28 @@ Returns the cleaned prefix, or nil if prefix was only 
the fringe indicator."
 This restores `line-prefix' and `wrap-prefix' to their state before
 `org-transclusion-add-fringe-to-region' was called.
 
-When org-indent-mode is active, removes only the fringe portion while
-preserving indentation. When org-indent-mode is inactive, removes the
-properties entirely."
+Removes only the fringe portion while preserving any other prefix
+content, regardless of whether org-indent-mode is active."
   (with-current-buffer buffer
     (with-silent-modifications
       (save-excursion
         (goto-char beg)
-        (let ((org-indent-active-p (and (boundp 'org-indent-mode)
-                                        org-indent-mode)))
-          (while (< (point) end)
-            (let* ((line-beg (line-beginning-position))
-                   (line-end (min (1+ line-beg) end))
-                   (line-prefix (get-text-property line-beg 'line-prefix))
-                   (wrap-prefix (get-text-property line-beg 'wrap-prefix)))
-              
-              (if org-indent-active-p
-                  ;; org-indent-mode active: remove fringe, keep indentation
-                  (progn
-                    (when line-prefix
-                      (org-transclusion--update-line-prefix
-                       line-beg line-end 'line-prefix
-                       (org-transclusion-remove-fringe-from-prefix 
line-prefix)))
-                    (when wrap-prefix
-                      (org-transclusion--update-line-prefix
-                       line-beg line-end 'wrap-prefix
-                       (org-transclusion-remove-fringe-from-prefix 
wrap-prefix))))
-                
-                ;; org-indent-mode inactive: remove properties entirely
-                (org-transclusion--update-line-prefix line-beg line-end 
'line-prefix nil)
-                (org-transclusion--update-line-prefix line-beg line-end 
'wrap-prefix nil)))
-            (forward-line 1)))))))
+        (while (< (point) end)
+          (let* ((line-beg (line-beginning-position))
+                 (line-end (min (1+ line-beg) end))
+                 (line-prefix (get-text-property line-beg 'line-prefix))
+                 (wrap-prefix (get-text-property line-beg 'wrap-prefix)))
+
+            ;; Always strip fringes precisely, preserving other content
+            (when line-prefix
+              (org-transclusion--update-line-prefix
+               line-beg line-end 'line-prefix
+               (org-transclusion-remove-fringe-from-prefix line-prefix)))
+            (when wrap-prefix
+              (org-transclusion--update-line-prefix
+               line-beg line-end 'wrap-prefix
+               (org-transclusion-remove-fringe-from-prefix wrap-prefix))))
+          (forward-line 1))))))
 
 ;;;; Hook
 (defun org-transclusion-source-overlay-modified (ov after-p _beg _end 
&optional _len)

Reply via email to