branch: externals/org-transclusion
commit c872fe5f077f6e1439cd4a51ae6c3e4c651db0cd
Author: Noboru Ota <[email protected]>
Commit: Noboru Ota <[email protected]>
fix: indenting can lead to duplicating transclusion when remove
See the code. To repro the issue, set `org-adapt-indentation' to t, and
have a
\#+transclude: keyword in an indented paragraph. Then have two transclusions
side-by-side without space, add both of them, and remove the first one. You
will
see that it is not fully removed.
---
org-transclusion.el | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/org-transclusion.el b/org-transclusion.el
index 7a58f69146..f4fec85553 100644
--- a/org-transclusion.el
+++ b/org-transclusion.el
@@ -573,7 +573,12 @@ When success, return the beginning point of the keyword
re-inserted."
(org-transclusion-with-inhibit-read-only
(save-excursion
(delete-region beg end)
- (when (> indent 0) (indent-to indent))
+ (when (> indent 0) (indent-to indent)
+ ;; Going back to beg is required as point has moved to
+ ;; beg+indent; otherwise, there are cases where the remove
+ ;; does not fully remove the read-only transclusion content,
+ ;; leading to duplicating it.
+ (goto-char beg))
(insert-before-markers keyword)))
(goto-char beg))
(message "Nothing done. No transclusion exists here.") nil))