branch: externals/org-transclusion
commit 525cd24aec32e7fd5cea73583a9525d121e02ad1
Author: Noboru Ota <[email protected]>
Commit: Noboru Ota <[email protected]>

    fix(src): Use the new org-transclusion-add-target-marker
---
 org-transclusion-src-lines.el | 11 +++++++----
 test/test-2.0.org             |  6 ++++++
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/org-transclusion-src-lines.el b/org-transclusion-src-lines.el
index 66d82100d0..cc443c0c7c 100644
--- a/org-transclusion-src-lines.el
+++ b/org-transclusion-src-lines.el
@@ -17,7 +17,7 @@
 
 ;; Author: Noboru Ota <[email protected]>
 ;; Created: 24 May 2021
-;; Last modified: 18 December 2025
+;; Last modified: 19 December 2025
 
 ;;; Commentary:
 ;;  This is an extension to `org-transclusion'.  When active, it adds features
@@ -134,17 +134,20 @@ One of the numbers can be omitted.  When the first number 
is
 omitted (e.g. -10), it means from the beginning of the file to
 line 10. Likewise, when the second number is omitted (e.g. 10-),
 it means from line 10 to the end of file."
-  (let* ((path (org-element-property :path link))
+  (let* ((src-mkr (org-transclusion-add-target-marker link))
+         (path (org-element-property :path link))
          (search-option (org-element-property :search-option link))
          (type (org-element-property :type link))
-         (entry-pos) (buf)
+         (entry-pos)
+         (buf (and src-mkr (marker-buffer src-mkr)))
          (lines (plist-get plist :lines))
          (end-search-op (plist-get plist :end))
          (noweb-chunk (plist-get plist :noweb-chunk))
          (thing-at-point (plist-get plist :thing-at-point))
          (thing-at-point (when thing-at-point
                            (make-symbol (cadr (split-string 
thing-at-point))))))
-    (if (not (string= type "id")) (setq buf (find-file-noselect path))
+    (if (not (string= type "id"))
+        buf
       (let ((filename-pos (org-id-find path)))
         (setq buf (find-file-noselect (car filename-pos)))
         (setq entry-pos (cdr filename-pos))))
diff --git a/test/test-2.0.org b/test/test-2.0.org
index 9091d2dd8d..47d9704d31 100644
--- a/test/test-2.0.org
+++ b/test/test-2.0.org
@@ -119,6 +119,12 @@ Temporarily set ~org-transclusion-include-first-section~ 
to nil
 
 #+transclude: [[file:test-no-first-section-negative.org]]
 
+* Orgit-file (link to git rev)
+
+  [[orgit-file:~/src/org-transclusion/::main::org-transclusion.el::Last 
modified][Orgit-file link to main]]
+#+transclude: 
[[orgit-file:~/src/org-transclusion/::main::org-transclusion.el::Last 
modified][Orgit-file link to main]]  :lines 1- :src emacs-lisp :end "URL"
+
+
 * Live-Sync
 ** center-block dynamic-block example-block export-block special-block 
verse-block
 

Reply via email to