summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Davison <davison@stats.ox.ac.uk>2010-09-04 13:36:48 -0400
committerDan Davison <davison@stats.ox.ac.uk>2010-09-04 13:36:48 -0400
commit798a78fe06daf75bdbc2031a8f49edadd30612e1 (patch)
treecf701fd40578990ed59c0d1655497cde4209292e
parentc881fa076060e647fc9f24ce68bd1aea5853016d (diff)
downloadorg-mode-798a78fe06daf75bdbc2031a8f49edadd30612e1.tar.gz
Protect against errors when operating in temporary code edit buffer
* ob.el (org-babel-do-in-edit-buffer): Use unwind-protect to ensure that edit buffer is exited
-rw-r--r--lisp/ob.el6
1 files changed, 3 insertions, 3 deletions
diff --git a/lisp/ob.el b/lisp/ob.el
index f35eaef..20b0c9a 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -511,9 +511,9 @@ with a prefix argument then this is passed on to
Return t if a code block was found at point, nil otherwise."
`(let ((org-src-window-setup 'switch-invisibly))
(when (org-edit-src-code nil nil nil 'quietly)
- ,@body
- (if (org-bound-and-true-p org-edit-src-from-org-mode)
- (org-edit-src-exit))
+ (unwind-protect (progn ,@body)
+ (if (org-bound-and-true-p org-edit-src-from-org-mode)
+ (org-edit-src-exit)))
t)))
(defun org-babel-do-key-sequence-in-edit-buffer (key)