mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 19:37:52 +00:00
org-src: Raise an error when source buffer is unreachable
* lisp/org-src.el (org-edit-src-exit): Raise an error when source buffer is unreachable.
This commit is contained in:
parent
51b743fc29
commit
3b8037f316
|
@ -1065,8 +1065,10 @@ Throw an error if there is no such buffer."
|
|||
(code (and write-back (org-src--contents-for-write-back))))
|
||||
(set-buffer-modified-p nil)
|
||||
;; Switch to source buffer. Kill sub-editing buffer.
|
||||
(let ((edit-buffer (current-buffer)))
|
||||
(org-src-switch-to-buffer (marker-buffer beg) 'exit)
|
||||
(let ((edit-buffer (current-buffer))
|
||||
(source-buffer (marker-buffer beg)))
|
||||
(unless source-buffer (error "Source buffer disappeared. Aborting"))
|
||||
(org-src-switch-to-buffer source-buffer 'exit)
|
||||
(kill-buffer edit-buffer))
|
||||
;; Insert modified code. Ensure it ends with a newline character.
|
||||
(org-with-wide-buffer
|
||||
|
@ -1085,7 +1087,7 @@ Throw an error if there is no such buffer."
|
|||
(cond
|
||||
;; Block is hidden; move at start of block.
|
||||
((cl-some (lambda (o) (eq (overlay-get o 'invisible) 'org-hide-block))
|
||||
(overlays-at (point)))
|
||||
(overlays-at (point)))
|
||||
(beginning-of-line 0))
|
||||
(write-back (org-src--goto-coordinates coordinates beg end))))
|
||||
;; Clean up left-over markers and restore window configuration.
|
||||
|
|
Loading…
Reference in a new issue