org-babel-do-in-edit-buffer: When editing fails, do not throw an error

* lisp/ob-core.el (org-babel-do-in-edit-buffer): Avoid throwing an
error when something is not right with the code block.  We already
ignore errors when major mode fails to load and we generally don't
want this macro to fail as it is used during indentation.

Link: https://list.orgmode.org/orgmode/87wmqo3it5.fsf@localhost/
This commit is contained in:
Ihor Radchenko 2024-02-29 15:01:00 +03:00
parent ac49228040
commit a3ebd8c669
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 5 additions and 2 deletions

View File

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