branch: externals/org-transclusion commit 35ea92647734beaf49fb27b8d199de20acad7674 Merge: 2cb719e80f ff722826ce Author: devcarbon-com <118597387+devcarbon-...@users.noreply.github.com> Commit: GitHub <nore...@github.com>
Merge branch 'main' into feature--things-at-point --- NEWS | 72 +++++++++++++++++++++-- docs/org-transclusion-manual.org | 72 +++++++++++++++++------ org-transclusion-font-lock.el | 6 +- org-transclusion-indent-mode.el | 4 +- org-transclusion-src-lines.el | 6 +- org-transclusion.el | 122 ++++++++++++++++++++++----------------- test/test-2.0.org | 6 +- test/test-2.1-lines.org | 6 +- text-clone.el | 4 +- 9 files changed, 207 insertions(+), 91 deletions(-) diff --git a/NEWS b/NEWS index 511cd6d07a..9e28ffd263 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,68 @@ +* Current development version + - feat: add org-transclusion-detach + + - New command 'org-transclusion-detach' can be used on the transclusion + at point. It turns it into a normal, edtitable text content. + + You can undo this operation. + + In addition, you can press 'C-d' directly on the transclusion at point + to detach it. This is because the command is bound to 'C-d' by + default in 'org-transclusion-map'. + + - 'org-transclusion-refresh' now accepts universal argument such as + 'C-u M-x org-transclusion-refresh' and detaches the transclusion at + point. + + You can undo this operation. + + - 'org-transclusion-add' now accepts universal argument such as 'C-u M-x + org-transclusion-add' and copies the source content rather than + transclude it. + + You can undo this operation. + + - Limitation: Undo detach does not add the overlay back on the + source. This should not break any feature. You can safely refresh the + transclusion and recover the source overlay. You can also safely open + or moved to the source. + +* 1.3.2 + + - fix: Delete superfluous trailing space on remove + + Before the fix, function 'org-transclusion-keyword-plist-to-string' + would add a superfluous trailing space when converting #+transclude + keyword's properties back to the string. This does not cause any + harm in normal circumstances. + + The issue would occur with a rare combination of the case where: + + + You have a buffer with a large number of transclusions activated, + around 50 or more + + + You set a 'whitespace-cleanup' in 'before-save' hook + + + You have 'auto-save-visited-mode' or similar that automatically saves + a buffer + + If you had combination, and then saved the buffer with the + transclusions, you might get an error mid-way of the save + operation. You would not lose any data in the buffer, but the buffer + would not re-activate all the transclusions that had been active + before buffer-save. + + This was because of the superfluous trailing spaces and automatic + removal of them, which caused the mismatch of the point of each + transclusion that Org-transclusion remembered during the save + operation. + +* Version 1.3.1 + + - build: fix #154 missing org-transclusion-pkg.el + + Nix requires -pkg.el. It was in ‘.elpaignore’. No functional change. + * Version 1.3.0 - Feature :: @@ -6,7 +71,7 @@ use :expand-links per transclusion - Fix :: - + - fix: #131. For non-Org files, now the transcluded text respects the indent level of the #+transclude keyword. This does not affect Org files. @@ -53,7 +118,7 @@ - Other :: - README, Info doc user manual, online user manual - + * Version 1.0.1 - Add .elpaignore @@ -77,8 +142,7 @@ - =org-transclusion-before-kill= now checks if the buffer to be killed contains any transclusion AND it is visting a file before saving. This - fixes some issues related to temp buffers, etc. + fixes some issues related to temp buffers, etc. - fix: search options for src-lines extension for =:lines=, =:src=, and =:end= properties † Changes before Version 1.0.0 are in CHANGELOG file. - diff --git a/docs/org-transclusion-manual.org b/docs/org-transclusion-manual.org index b9854f919b..72da9d5b36 100644 --- a/docs/org-transclusion-manual.org +++ b/docs/org-transclusion-manual.org @@ -1,7 +1,7 @@ #+title: Org-transclusion User Manual #+author: Noboru Ota <m...@nobiot.com> #+macro: version 1.3.x -#+macro: modified 12 June 2022 +#+macro: modified 04 March 2023 #+language: en #+export_file_name: org-transclusion.texi @@ -21,7 +21,7 @@ This manual is for Org-transclusion version {{{version}}}. Last updated: {{{modified}}}. -#+transclude: [[../README.org::whatis]] +#+transclude: [[../README.org::whatis]] #+texinfo: @insertcopying @@ -46,11 +46,11 @@ modify this GNU manual.” * Example Use Cases & Main Features -#+transclude: [[../README.org::#use-cases]] :only-contents +#+transclude: [[../README.org::#use-cases]] :only-contents * Installation -#+transclude: [[../README.org::*Installation]] :only-contents +#+transclude: [[../README.org::*Installation]] :only-contents * Getting Started :PROPERTIES: @@ -112,6 +112,7 @@ D org-transclusion-demote-subtree O org-transclusion-move-to-source P org-transclusion-promote-subtree d org-transclusion-remove +C-d org-transclusion-detach e org-transclusion-live-sync-start g org-transclusion-refresh o org-transclusion-open-source @@ -222,7 +223,7 @@ Other ways to control include the following. Promote transcluded subtree at point. Mapped to "P" (capital "p") by default in ~org-transclusion-map~ - ~org-transclusion-demote-subtree~ :: - Demote transcluded subtree at point. Mapped to "D" (capital "D") by default in ~org-transclusion-map~ + Demote transcluded subtree at point. Mapped to "D" (capital "d") by default in ~org-transclusion-map~ ** Filter Org elements per transclusion :PROPERTIES: @@ -239,13 +240,13 @@ You can control what elements to include in many different ways with using vario The following two customizable variables are applicable to all transclusions globally. You can think of them as the global default. - =org-transclusion-exclude-elements= :: - + This customizable variable globally defines the exclusion filter for elements. It is a list of symbols; the acceptable values can be seen by inspecting =org-element-all-elements=. The default is to exclude =property-drawer=. Refer also to the [[#customizable-filter-to-exclude-certain-org-elements][sub-section on this user option]]. - =org-transclusion-include-first-section= :: - + This customizing variable globally defines whether or not to include the first section of the source Org file. The first section is the part before the first headline -- that's the section that typically contains =#+title=, =#+author=, and so on. Many people also write notes in it without adding any headlines. Note that this user option's default is now =t= (changed from =nil= as users seem to spend time to "correct" this issue). Turn it to =t= if you wish to transclude the content fro [...] Refer also to the [[#include-the-section-before-the-first-headline-org-file-only][sub-section on this user option]]. @@ -273,7 +274,7 @@ In addition to the global user options above, you can fine-tune the default excl You can combine =:only-contents= and =:exclude-elements= to control how you transclude a subtree. With these properties, you can really have great control over what to include and exclude. It might be a little overwhelming at a time but the changes via properties are easy to change -- simply press =d= to remove the transclusion, change the properties, and transclude again to see a new result. - =:expand-links= :: - This property lets you expand the file names in links to absolute file names. + This property lets you expand the file names in links to absolute file names. You can use the property in the following way. @@ -310,6 +311,37 @@ If you are transcluding only one subtree, this should be intuitive. If you trans Content of Headline #+end_example +** Detach transclusion and copy source buffer +:PROPERTIES: +:CUSTOM_ID: detach +:END: + +#+cindex: Detach transclusion +#+findex: org-transclusion-detach + +Detach is added to the current development version and is planned to be part of release version 1.4.0, and thus available only in GNU-devel ELPA. If you are using GNU ELPA, it will be available with the release of 1.4.0. + + - New command ~org-transclusion-detach~ can be used on the transclusion + at point. It turns it into a normal, edtitable text content. + + You can undo this operation. + + In addition, you can press ~C-d~ directly on the transclusion at point + to detach it. This is because the command is bound to ~C-d~ by + default in 'org-transclusion-map'. + + - ~org-transclusion-refresh~ now accepts universal argument such as + ~C-u M-x org-transclusion-refresh~ and detaches the transclusion at + point. + + You can undo this operation. + + - ~org-transclusion-add~ now accepts universal argument such as 'C-u M-x + org-transclusion-add' and copies the source content rather than + transclude it. + + You can undo this operation. + ** Live-sync edit :PROPERTIES: :CUSTOM_ID: live-sync-edit @@ -360,7 +392,7 @@ In the live-sync edit region, the normal ~yank~ command (~C-y~) is replaced with #+cindex: Property - :src #+cindex: Property - :rest -This feature is provided as an [[#extensions][extension]] (default on). +This feature is provided as an [[#extensions][extension]] (default on). You can transclude a source file into an Org's src block. Use the =:src= property and specify the language you would like to use like this: @@ -394,7 +426,7 @@ The source block will have the additional properties: #+cindex: Transclude range of lines -This feature is provided as an [[#extensions][extension]] (default on). +This feature is provided as an [[#extensions][extension]] (default on). When you transclude text files other than Org files, you can use following properties to specify a range of lines to transclude. @@ -459,7 +491,7 @@ Example 3: #+cindex: Extension - org-transclusion-src-lines #+cindex: Extension - org-transclusion-font-lock -Org-transclusion provides a simple extension framework, where you can use ~customize~ to selectively add new features. +Org-transclusion provides a simple extension framework, where you can use ~customize~ to selectively add new features. If you use ~customize~, the features are loaded automatically. Note that it does not "unload" the feature until you relaunch Emacs. @@ -474,7 +506,7 @@ If you do not use ~customize~ (e.g. Doom), you may need to explicitly require an #+END_SRC Currently, the following extensions are available. - + - (off by default) ~org-transclusion-indent-mode~ :: Support org-indent-mode. Known limitation: when transcluded, the source will temporarily lose the indentation. When the transclusion is removed, the source will regain the indentation. @@ -523,7 +555,7 @@ You can customize settings in the customization group `org-transclusion'. transclusion content has been added. The hook runs after the content and the read-only text property have been added so it is not supposed to manipulate the content but to add further text properties. For example, it is used by - the `org-transclusion-indent-mode' extension to support `org-indent-mode'. + the `org-transclusion-indent-mode' extension to support `org-indent-mode'. The functions are called with arguments beg and end, pointing to the beginning and end of the transcluded content. @@ -574,7 +606,7 @@ You can include the first section (section before the first headline) of an Org *** Face for the =#+transclude= keyword -This feature is provided as an [[#extensions][extension]] (default on). +This feature is provided as an [[#extensions][extension]] (default on). - ~org-transclusion-keyword~ :: @@ -611,10 +643,10 @@ Other faces: #+vindex: org-transclusion-live-sync-map - ~org-transclusion-map~ -#+transclude: [[./org-transclusion-manual.org::org-transclusion-map]] +#+transclude: [[./org-transclusion-manual.org::org-transclusion-map]] - ~org-transclusion-live-sync-map~ -#+transclude: [[./org-transclusion-manual.org::org-transclusion-live-sync-map]] +#+transclude: [[./org-transclusion-manual.org::org-transclusion-live-sync-map]] * Known Limitations @@ -634,8 +666,7 @@ Note this section is still incomplete, not exhaustive for "known" limitations. Work is in progress to lift this limitation but I'm still experimenting different ideas. - ~org-indent-mode~ may not work well with Org-transclusion :: - A new extension has been added to support ~org-indent-mode~ - Refer to [[#extensions][this section]]. + A new extension has been added to support ~org-indent-mode~ Refer to [[#extensions][this section]]. - Doom's customization may interfere with Org-transclusion :: Refer to issue [[https://github.com/nobiot/org-transclusion/issues/52][#52]]. The symptom is that in Doom you get an error message that includes this: "progn: ‘recenter’ing a window that does not display current-buffer." Adding this in your configuration has been reported to fix the issue: @@ -647,6 +678,9 @@ Note this section is still incomplete, not exhaustive for "known" limitations. - Org refile does not work "properly" on the transcluded headlines :: Refer to issue [[https://github.com/nobiot/org-transclusion/issues/20][#20]]. I don't intend to support this -- refile the source, not the transcluded copy. +- Undo detach does not add the overlay back on the source :: + This should not break any feature. You can safely refresh the transclusion and recover the source overlay. You can also safely open or moved to the source while the source overlay is not present. + * Credits ** Original idea by John Kitchin :PROPERTIES: @@ -679,7 +713,7 @@ It seems like this could work well for headlines, and named tables, src blocks, * Contributing -#+transclude: [[../README.org::*Contributing]] :only-contents +#+transclude: [[../README.org::*Contributing]] :only-contents * Index - Features :PROPERTIES: diff --git a/org-transclusion-font-lock.el b/org-transclusion-font-lock.el index 2e9d65dc8a..713565c489 100644 --- a/org-transclusion-font-lock.el +++ b/org-transclusion-font-lock.el @@ -1,6 +1,6 @@ ;;; org-transclusion-font-lock.el --- font-lock for Org-transclusion -*- lexical-binding: t; -*- -;; Copyright (C) 2021 Free Software Foundation, Inc. +;; Copyright (C) 2021-2023 Free Software Foundation, Inc. ;; This program is free software: you can redistribute it and/or modify it ;; under the terms of the GNU General Public License as published by the @@ -17,7 +17,7 @@ ;; Author: Noboru Ota <m...@nobiot.com> ;; Created: 22 August 2021 -;; Last modified: 4 December 2021 +;; Last modified: 08 February 2023 ;;; Commentary: ;; This file is part of Org-transclusion @@ -55,7 +55,7 @@ This function does the following: Argument LIMIT is to limit scope of `re-search-forward'; it's the same with `org-fontify-meta-lines-and-blocks'." (let ((case-fold-search t) - (regexp "\\(^[ ]*#\\+TRANSCLUDE:\\)\\(.*]]\\)?\\(.*$\\)") + (regexp "\\(^[ ]*#\\+TRANSCLUDE:\\)\\(.*]]\\)?\\(.*$\\)") (beg)(end)(keyword-end)(prop-beg)(prop-end)) (when (re-search-forward regexp limit t) (setq beg (match-beginning 0)) diff --git a/org-transclusion-indent-mode.el b/org-transclusion-indent-mode.el index d86565fce5..ef291b5709 100644 --- a/org-transclusion-indent-mode.el +++ b/org-transclusion-indent-mode.el @@ -1,6 +1,6 @@ ;;; org-transclusion-indent-mode.el --- support org-indent-mode -*- lexical-binding: t; -*- -;; Copyright (C) 2021 Free Software Foundation, Inc. +;; Copyright (C) 2021-2023 Free Software Foundation, Inc. ;; This program is free software: you can redistribute it and/or modify it ;; under the terms of the GNU General Public License as published by the @@ -17,7 +17,7 @@ ;; Author: Noboru Ota <m...@nobiot.com> ;; Created: 22 August 2021 -;; Last modified: 07 January 2022 +;; Last modified: 08 February 2023 ;;; Commentary: ;; This file is part of Org-transclusion diff --git a/org-transclusion-src-lines.el b/org-transclusion-src-lines.el index a46566eb8b..bbd4d31db1 100644 --- a/org-transclusion-src-lines.el +++ b/org-transclusion-src-lines.el @@ -1,6 +1,6 @@ ;;; org-transclusion-src-lines.el --- Extension -*- lexical-binding: t; -*- -;; Copyright (C) 2021 Free Software Foundation, Inc. +;; Copyright (C) 2021-2023 Free Software Foundation, Inc. ;; This program is free software: you can redistribute it and/or modify it ;; under the terms of the GNU General Public License as published by the @@ -17,7 +17,7 @@ ;; Author: Noboru Ota <m...@nobiot.com> ;; Created: 24 May 2021 -;; Last modified: 05 September 2022 +;; Last modified: 08 February 2023 ;;; Commentary: ;; This is an extension to `org-transclusion'. When active, it adds features @@ -97,7 +97,7 @@ Return nil if PLIST does not contain \":src\" or \":lines\" properties." ;; 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))))) + (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/org-transclusion.el b/org-transclusion.el index cf10393a8c..e53f275f62 100644 --- a/org-transclusion.el +++ b/org-transclusion.el @@ -1,6 +1,6 @@ ;;; org-transclusion.el --- Transclude text content via links -*- lexical-binding: t; -*- -;; Copyright (C) 2021-2022 Free Software Foundation, Inc. +;; Copyright (C) 2021-2023 Free Software Foundation, Inc. ;; This program is free software: you can redistribute it and/or modify it ;; under the terms of the GNU General Public License as published by the @@ -17,12 +17,12 @@ ;; Author: Noboru Ota <m...@nobiot.com> ;; Created: 10 October 2020 -;; Last modified: 9 November 2022 +;; Last modified: 05 March 2023 ;; URL: https://github.com/nobiot/org-transclusion ;; Keywords: org-mode, transclusion, writing -;; Version: 1.3.1 +;; Version: 1.3.2 ;; Package-Requires: ((emacs "27.1") (org "9.4")) ;; This file is not part of GNU Emacs. @@ -232,6 +232,7 @@ regexp from the string.") (define-key map (kbd "e") #'org-transclusion-live-sync-start) (define-key map (kbd "g") #'org-transclusion-refresh) (define-key map (kbd "d") #'org-transclusion-remove) + (define-key map (kbd "C-d") #'org-transclusion-detach) (define-key map (kbd "P") #'org-transclusion-promote-subtree) (define-key map (kbd "D") #'org-transclusion-demote-subtree) (define-key map (kbd "o") #'org-transclusion-open-source) @@ -347,21 +348,26 @@ automatically transcludes the text content; when it is inactive, it simply adds the \"#+transclude\" keyword before the link and inserts the whole line. +If you pass a `universal-argument', this function reverses this: +if the mode is active, the keyword gets inserted; if the mode is +inactive, the transclusion gets added. + You can pass a prefix argument (ARG) with using `digit-argument' (e.g. C-1 or C-2; or \\[universal-argument] 3, so on) or `universal-argument' (\\[universal-argument]). If you pass a positive number 1-9 with `digit-argument', this function automatically puts the :level property to the resultant -transclusion keyword. +transclusion keyword." -If you pass a `universal-argument', this function automatically -triggers transclusion by calling `org-transclusion-add' even when -`org-transclusion-mode' is inactive in the current buffer." (interactive "P") (let* ((context (org-element-lineage (org-element-context)'(link) t)) - (type (org-element-property :type context))) + (type (org-element-property :type context)) + (auto-transclude-p (if (or (not arg) (numberp arg)) org-transclusion-mode + ;; if `universal-argument' is passed, + ;; reverse nil/t when + (if org-transclusion-mode nil t)))) (when (or (string= type "file") (string= type "id")) (let* ((contents-beg (org-element-property :contents-begin context)) @@ -378,11 +384,10 @@ triggers transclusion by calling `org-transclusion-add' even when (<= arg 9)) (end-of-line) (insert (format " :level %d" arg))) - (when (or (equal arg '(4)) org-transclusion-mode) - (org-transclusion-add))))))) + (when auto-transclude-p (org-transclusion-add))))))) ;;;###autoload -(defun org-transclusion-add () +(defun org-transclusion-add (&optional copy) "Transclude text content for the #+transclude at point. When minor-mode `org-transclusion-mode' is inactive in the current buffer, this function toggles it on. @@ -413,7 +418,7 @@ TODO: that for transclusions of Org elements/buffer, live-sync does not support all the elements. \\{org-transclusion-map}" - (interactive) + (interactive "P") (when (org-transclusion-check-add) ;; Turn on the minor mode to load extensions before staring to add. (unless org-transclusion-mode @@ -445,7 +450,7 @@ does not support all the elements. (end-of-line) (insert-char ?\n) (org-transclusion-content-insert keyword-plist tc-type src-content - src-buf src-beg src-end) + src-buf src-beg src-end copy) (unless (eobp) (delete-char 1)) (setq end (point)) t) @@ -533,6 +538,13 @@ When success, return the beginning point of the keyword re-inserted." beg)) (message "Nothing done. No transclusion exists here.") nil)) +(defun org-transclusion-detach () + "Make the transcluded region normal text contentent." + (interactive) + ;; Make sure the translusion is removed first so that undo can be used + ;; to go back to the #+transclusion before detach. + (org-transclusion-refresh 'detach)) + (defun org-transclusion-remove-all (&optional narrowed) "Remove all transcluded text regions in the current buffer. Return the list of points for the transclusion keywords @@ -565,13 +577,13 @@ the rest of the buffer unchanged." (move-marker marker nil) ; point nowhere for GC list))) -(defun org-transclusion-refresh () +(defun org-transclusion-refresh (&optional detach) "Refresh the transcluded text at point." - (interactive) + (interactive "P") (when (org-transclusion-within-transclusion-p) (let ((pos (point))) (org-transclusion-remove) - (org-transclusion-add) + (org-transclusion-add detach) (goto-char pos)) t)) @@ -874,9 +886,10 @@ keyword. If not, returns nil." (setq custom-properties-string (dolist (fn org-transclusion-keyword-plist-to-string-functions custom-properties-string) - (when-let ((str (funcall fn plist))) - (setq custom-properties-string - (concat custom-properties-string " " str ))))) + (let ((str (funcall fn plist))) + (when (and str (not (string-empty-p str))) + (setq custom-properties-string + (concat custom-properties-string " " str )))))) (concat "#+transclude: " link (when level (format " :level %d" level)) @@ -936,7 +949,7 @@ Return nil if not found." ;;----------------------------------------------------------------------------- ;;;; Functions for inserting content -(defun org-transclusion-content-insert (keyword-values type content sbuf sbeg send) +(defun org-transclusion-content-insert (keyword-values type content sbuf sbeg send copy) "Insert CONTENT at point and put source overlay in SBUF. Return t when successful. @@ -992,37 +1005,38 @@ based on the following arguments: type content (plist-get keyword-values :current-indentation))) (setq end (point)) (setq end-mkr (set-marker (make-marker) end)) - (add-text-properties beg end - `(local-map ,org-transclusion-map - read-only t - front-sticky t - ;; rear-nonticky seems better for - ;; src-lines to add "#+result" after C-c - ;; C-c - rear-nonsticky t - org-transclusion-type ,type - org-transclusion-beg-mkr - ,beg-mkr - org-transclusion-end-mkr - ,end-mkr - org-transclusion-pair - ,tc-pair - org-transclusion-orig-keyword - ,keyword-values - ;; TODO Fringe is not supported for terminal - line-prefix - ,(org-transclusion-propertize-transclusion) - wrap-prefix - ,(org-transclusion-propertize-transclusion))) - ;; Put to the source overlay - (overlay-put ov-src 'org-transclusion-by beg-mkr) - (overlay-put ov-src 'evaporate t) - (overlay-put ov-src 'line-prefix (org-transclusion-propertize-source)) - (overlay-put ov-src 'wrap-prefix (org-transclusion-propertize-source)) - (overlay-put ov-src 'priority -50) - ;; TODO this should not be necessary, but it is at the moment - ;; live-sync-enclosing-element fails without tc-pair on source overlay - (overlay-put ov-src 'org-transclusion-pair tc-pair) + (unless copy + (add-text-properties beg end + `(local-map ,org-transclusion-map + read-only t + front-sticky t + ;; rear-nonticky seems better for + ;; src-lines to add "#+result" after C-c + ;; C-c + rear-nonsticky t + org-transclusion-type ,type + org-transclusion-beg-mkr + ,beg-mkr + org-transclusion-end-mkr + ,end-mkr + org-transclusion-pair + ,tc-pair + org-transclusion-orig-keyword + ,keyword-values + ;; TODO Fringe is not supported for terminal + line-prefix + ,(org-transclusion-propertize-transclusion) + wrap-prefix + ,(org-transclusion-propertize-transclusion))) + ;; Put to the source overlay + (overlay-put ov-src 'org-transclusion-by beg-mkr) + (overlay-put ov-src 'evaporate t) + (overlay-put ov-src 'line-prefix (org-transclusion-propertize-source)) + (overlay-put ov-src 'wrap-prefix (org-transclusion-propertize-source)) + (overlay-put ov-src 'priority -50) + ;; TODO this should not be necessary, but it is at the moment + ;; live-sync-enclosing-element fails without tc-pair on source overlay + (overlay-put ov-src 'org-transclusion-pair tc-pair)) t)) (defun org-transclusion-content-highest-org-headline () @@ -1188,12 +1202,12 @@ to LINK if the link is already absolute. The current buffer is assumed to be the source buffer for the transclusion." (when (string-equal "file" (org-element-property :type link)) - (let ((raw-link (org-element-property :raw-link link))) - (unless (file-name-absolute-p raw-link) + (let ((path (org-element-property :path link))) + (unless (file-name-absolute-p path) (org-element-put-property link :path (expand-file-name - raw-link + path (file-name-directory (buffer-file-name (current-buffer))))))))) (defun org-transclusion-content-filter-org-exclude-elements (data) diff --git a/test/test-2.0.org b/test/test-2.0.org index 2c3c31e5df..2a3ae35e23 100644 --- a/test/test-2.0.org +++ b/test/test-2.0.org @@ -2,7 +2,6 @@ ** make from link This is a link to a [[id:20210501T171427.051019][Bertrand Russell]] wikipedia excerpt #+transclude: [[id:20210501T171427.051019][Bertrand Russell]] - ** test empty file #+transclude: [[file:empty.txt::2][empty text file]] @@ -165,4 +164,9 @@ t/nil will be dropped after remove-at-point 2. Second item * Level two +* Test headlines only + +#+transclude: [[id:2022-06-26T141859]] :exclude-elements "paragraph" + +#+transclude: [[id:2022-06-26T141859]] diff --git a/test/test-2.1-lines.org b/test/test-2.1-lines.org index 9d86c6a1ec..5c9e18b4d5 100644 --- a/test/test-2.1-lines.org +++ b/test/test-2.1-lines.org @@ -8,17 +8,17 @@ 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" +#+transclude: [[id:2022-06-26T141859]] :end "Heading 1" #+name: source code 1 #+transclude: [[file:../org-transclusion-src-lines.el]] :lines 1-10 :src elisp #+transclude: [[file:test-src.el]] :lines 1- #+transclude: [[file:test-src.el]] :lines 2-4 :src elisp -#+transclude: [[file:python-2.py]] :src python +#+transclude: [[file:python-2.py]] :src python :rest "-n" #+transclude: [[file:python-1.py]] :src python :rest ":results file" diff --git a/text-clone.el b/text-clone.el index 0bbaa5d92d..966a449219 100644 --- a/text-clone.el +++ b/text-clone.el @@ -1,6 +1,6 @@ ;;; text-clone.el --- clone and live-sync text -*- lexical-binding: t; -*- -;; Copyright (C) 2021 Free Software Foundation, Inc. +;; Copyright (C) 2021-2023 Free Software Foundation, Inc. ;; This program is free software: you can redistribute it and/or modify it ;; under the terms of the GNU General Public License as published by the @@ -17,7 +17,7 @@ ;; Author: Noboru Ota <m...@nobiot.com> ;; Created: 22 May 2021 -;; Last modified: 4 December 2021 +;; Last modified: 08 February 2023 ;; Keywords: text-clone, transclusion, org-transclusion