org-babel-execute-src-block: Handle code block moving point

* lisp/ob-core.el (org-babel-execute-src-block): Make sure that point
remain on src block after evaluation.  The function logic later
implicitly assumes that the point is on the block that has been
evaluated.
This commit is contained in:
Ihor Radchenko 2024-06-12 12:47:48 +02:00
parent 3e4c89e556
commit a0950e9432
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 5 additions and 1 deletions

View File

@ -893,7 +893,11 @@ guess will be made."
(format "at position %S" (nth 5 info)))))
(setq exec-start-time (current-time)
result
(let ((r (save-current-buffer (funcall cmd body params))))
(let ((r
;; Code block may move point in the buffer.
;; Make sure that the point remains on the
;; code block.
(save-excursion (funcall cmd body params))))
(if (and (eq (cdr (assq :result-type params)) 'value)
(or (member "vector" result-params)
(member "table" result-params))