17
17
18
18
; ; Author: Noboru Ota <me@nobiot.com>
19
19
; ; Created: 10 October 2020
20
- ; ; Last modified: 31 December 2024
20
+ ; ; Last modified: 01 January 2025
21
21
22
22
; ; URL: https://github.com/nobiot/org-transclusion
23
23
; ; Keywords: org-mode, transclusion, writing
@@ -1796,9 +1796,6 @@ ensure the settings revert to the user's setting prior to
1796
1796
1797
1797
(defun org-transclusion-promote-adjust-after ()
1798
1798
" 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
1802
1799
(let* ((pos (next-property-change (point ) nil (line-end-position )))
1803
1800
(keyword-plist (get-text-property pos
1804
1801
'org-transclusion-orig-keyword ))
@@ -1815,17 +1812,17 @@ ensure the settings revert to the user's setting prior to
1815
1812
(defun org-transclusion-promote-or-demote-subtree (&optional demote )
1816
1813
" Promote or demote transcluded subtree.
1817
1814
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)))
1829
1826
1830
1827
; ;-----------------------------------------------------------------------------
1831
1828
; ;;; Functions to support Org-export
0 commit comments