Skip to content

Commit dabc4b9

Browse files
committed
fix: apply Inf-loop fix org-transclusion-promote-or-demote-subtree
Use of org-transclusion-beg-mkr still remained. Continuation of commit f6fd666.
1 parent d7b841f commit dabc4b9

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

org-transclusion.el

+12-15
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
;; Author: Noboru Ota <me@nobiot.com>
1919
;; Created: 10 October 2020
20-
;; Last modified: 31 December 2024
20+
;; Last modified: 01 January 2025
2121

2222
;; URL: https://github.com/nobiot/org-transclusion
2323
;; Keywords: org-mode, transclusion, writing
@@ -1796,9 +1796,6 @@ ensure the settings revert to the user's setting prior to
17961796

17971797
(defun org-transclusion-promote-adjust-after ()
17981798
"Adjust the level information after promote/demote."
1799-
;; find org-transclusion-beg-mkr. If the point is directly on the starts,
1800-
;; you need to find it in the headline title. Assume point at beginning of
1801-
;; the subtree after promote/demote
18021799
(let* ((pos (next-property-change (point) nil (line-end-position)))
18031800
(keyword-plist (get-text-property pos
18041801
'org-transclusion-orig-keyword))
@@ -1815,17 +1812,17 @@ ensure the settings revert to the user's setting prior to
18151812
(defun org-transclusion-promote-or-demote-subtree (&optional demote)
18161813
"Promote or demote transcluded subtree.
18171814
When DEMOTE is non-nil, demote."
1818-
(if (not (org-transclusion-within-transclusion-p))
1819-
(message "Not in a transcluded headline.")
1820-
(let ((inhibit-read-only t)
1821-
(beg (get-text-property (point) 'org-transclusion-beg-mkr)))
1822-
(let ((pos (point)))
1823-
(save-excursion
1824-
(goto-char beg)
1825-
(when (org-at-heading-p)
1826-
(if demote (org-demote-subtree) (org-promote-subtree))
1827-
(org-transclusion-promote-adjust-after)))
1828-
(goto-char pos)))))
1815+
(unless (org-transclusion-within-transclusion-p)
1816+
(user-error "Not in a transcluded headline."))
1817+
(let* ((inhibit-read-only t)
1818+
(beg (car (plist-get (org-transclusion-at-point) :location)))
1819+
(pos (point)))
1820+
(save-excursion
1821+
(goto-char beg)
1822+
(when (org-at-heading-p)
1823+
(if demote (org-demote-subtree) (org-promote-subtree))
1824+
(org-transclusion-promote-adjust-after)))
1825+
(goto-char pos)))
18291826

18301827
;;-----------------------------------------------------------------------------
18311828
;;;; Functions to support Org-export

0 commit comments

Comments
 (0)