org-babel-do-in-edit-buffer: Fix when opening src edit buffer fails

* lisp/ob-core.el (org-babel-do-in-edit-buffer): When opening src edit
buffer fails, do not leave point inside that buffer.

Reported-by: gerard.vermeulen@posteo.net
Link: https://orgmode.org/list/5bf6832d2485f0aa6be2e5ea2eba37d2@posteo.net
This commit is contained in:
Ihor Radchenko 2024-03-04 13:10:17 +03:00
parent 8ac99c33f0
commit 5f5db3d353
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 4 additions and 2 deletions

View File

@ -1198,7 +1198,9 @@ Return t if a code block was found at point, nil otherwise."
(when (and (org-babel-where-is-src-block-head element)
(condition-case nil
(org-edit-src-code)
(t (when outside-position (goto-char outside-position))
(t
(org-edit-src-exit)
(when outside-position (goto-char outside-position))
nil)))
(unwind-protect (progn ,@body)
(org-edit-src-exit)