浏览代码

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
Dan Davison 14 年之前
父节点
当前提交
798a78fe06
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      lisp/ob.el

+ 3 - 3
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)