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

    feat: add org-transclusion-append-fringe-to-prefix helper
    
    Add helper function to append fringe indicators to existing line-prefix
    or wrap-prefix text properties. This function preserves org-indent-mode's
    per-line indentation while adding visual transclusion indicators.
    
    * org-transclusion.el (org-transclusion-append-fringe-to-prefix): New
    function. Takes existing prefix string and appends fringe indicator,
    handling both graphical and terminal display modes. Returns concatenated
    string suitable for line-prefix or wrap-prefix properties.
    
    The function checks display-graphic-p to determine whether to use
    left-fringe bitmap or fallback text indicator. When existing-prefix is
    nil, returns just the fringe indicator. When existing-prefix is non-nil,
    concatenates it with the fringe to preserve org-indent's indentation.
---
 org-transclusion.el | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/org-transclusion.el b/org-transclusion.el
index 0b97a62680..a3f06bd746 100644
--- a/org-transclusion.el
+++ b/org-transclusion.el
@@ -1305,6 +1305,20 @@ is non-nil."
 ;;-----------------------------------------------------------------------------
 ;;; Utility Functions
 
+(defun org-transclusion-append-fringe-to-prefix (existing-prefix face)
+  "Append fringe indicator to EXISTING-PREFIX, preserving it.
+FACE determines the fringe color (org-transclusion-source-fringe or
+org-transclusion-fringe).
+Returns concatenated string suitable for `line-prefix' or `wrap-prefix'."
+  (let ((fringe-indicator
+         (if (display-graphic-p)
+             (propertize "x" 'display
+                         `(left-fringe org-transclusion-fringe-bitmap ,face))
+           (propertize "| " 'face face))))
+    (if existing-prefix
+        (concat existing-prefix fringe-indicator)
+      fringe-indicator)))
+
 (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