branch: externals/org-transclusion commit fb947f5a83e99810777a1f32bf81c78b0089b425 Author: Noboru Ota <m...@nobiot.com> Commit: Noboru Ota <m...@nobiot.com>
fix: conditions in org-transclusion-add-src-lines The conditions commented during the development were put back in. Treating an org-id target as a normal text buffer means that even when the ID points to an Org headline, the ending of the transclusion will be dictated by the `:lines` or `:end` properties, not the end of headline. This means that if the `:lines` property is set to ":line 0-", the resultant transclusion will be from the initial line of the headline to the end of the buffer, going beyond the boundary of the headline. --- org-transclusion-src-lines.el | 6 +++--- test/test-2.1-lines.org | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/org-transclusion-src-lines.el b/org-transclusion-src-lines.el index f22ab37a57..eeae4f716c 100644 --- a/org-transclusion-src-lines.el +++ b/org-transclusion-src-lines.el @@ -73,11 +73,11 @@ Return nil if PLIST does not contain \":src\" or \":lines\" properties." (org-transclusion-content-src-lines link plist))) ;; :lines needs to be the last condition to check because :src INCLUDE :lines ((or (plist-get plist :lines) - (plist-get plist :end)) + (plist-get plist :end) ;; Link contains a search-option ::<string> ;; and NOT for an Org file -;; (and (org-element-property :search-option link) -;; (not (org-transclusion-org-file-p (org-element-property :path link))))) + (and (org-element-property :search-option link) + (not (org-transclusion-org-file-p (org-element-property :path link))))) (append '(:tc-type "lines") (org-transclusion-content-range-of-lines link plist))))) diff --git a/test/test-2.1-lines.org b/test/test-2.1-lines.org index 144e9ba7c6..49d8820017 100644 --- a/test/test-2.1-lines.org +++ b/test/test-2.1-lines.org @@ -6,7 +6,10 @@ Including lines of source code [[file:./paragraph.org::/Lorem/]] -#+transclude: [[id:2022-06-26T141859]] +#+transclude: [[id:2022-06-26T141859]] +#+transclude: [[file:./paragraph.org]] :lines 1-5 +#+transclude: [[id:2022-06-26T141859]] :lines 0-5 +#+transclude: [[id:2022-06-26T141859]] :end "Heading 1" #+name: source code 1 #+transclude: [[file:../org-transclusion-src-lines.el]] :lines 1-10 :src elisp