org-element--generate-copy-script: Copy all the overlay properties

* lisp/org-element.el (org-element--generate-copy-script): In buffer
copy, copy over all the overlay properties, not just 'invisible.  This
is needed to copy folding overlays correctly - they use more than just
'invisible property.
This commit is contained in:
Ihor Radchenko 2024-02-26 15:50:30 +03:00
parent 407a55c1c0
commit 655e97208c
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 5 additions and 3 deletions

View File

@ -592,7 +592,7 @@ The function assumes BUFFER's major mode is `org-mode'."
(let ((invis-prop (overlay-get ov 'invisible)))
(when invis-prop
(push (list (overlay-start ov) (overlay-end ov)
invis-prop)
(overlay-properties ov))
ov-set))))
ov-set))))
(lambda ()
@ -618,8 +618,10 @@ The function assumes BUFFER's major mode is `org-mode'."
;; Current position of point.
(goto-char pos)
;; Overlays with invisible property.
(pcase-dolist (`(,start ,end ,invis) ols)
(overlay-put (make-overlay start end) 'invisible invis))
(pcase-dolist (`(,start ,end ,props) ols)
(let ((ov (make-overlay start end)))
(while props
(overlay-put ov (pop props) (pop props)))))
;; Never write the buffer copy to disk, despite
;; `buffer-file-name' not being nil.
(setq write-contents-functions (list (lambda (&rest _) t))))))))