Fix template copy mechanism when template is in other buffer
Forgot to switch buffer when marker in other buffer is given.
This commit is contained in:
parent
12b001221c
commit
bc3ab8b901
@ -924,6 +924,7 @@ it. Adds newline before and after the template."
|
|||||||
(save-mark-and-excursion
|
(save-mark-and-excursion
|
||||||
(let ((template-element (org-with-point-at pom
|
(let ((template-element (org-with-point-at pom
|
||||||
(org-element-at-point))))
|
(org-element-at-point))))
|
||||||
|
(with-current-buffer (if (markerp pom) (marker-buffer pom) (current-buffer))
|
||||||
(let ((content-end (org-element-property :contents-end template-element))
|
(let ((content-end (org-element-property :contents-end template-element))
|
||||||
current-element
|
current-element
|
||||||
content-begin)
|
content-begin)
|
||||||
@ -942,7 +943,7 @@ it. Adds newline before and after the template."
|
|||||||
(< content-begin content-end))
|
(< content-begin content-end))
|
||||||
(user-error "Cannot find content in template, or content is empty"))
|
(user-error "Cannot find content in template, or content is empty"))
|
||||||
(string-trim-right
|
(string-trim-right
|
||||||
(buffer-substring-no-properties content-begin content-end))))))))
|
(buffer-substring-no-properties content-begin content-end)))))))))
|
||||||
(insert "\n")
|
(insert "\n")
|
||||||
(insert body)
|
(insert body)
|
||||||
(insert "\n")
|
(insert "\n")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user