`org-babel-do-in-edit-buffer': more lightweight test of context

* ob.el (org-babel-do-in-edit-buffer): Use
	`org-babel-where-is-src-block-head' to test for source block
	at point.
This commit is contained in:
Dan Davison 2010-09-08 13:25:56 -04:00
parent ad1ab9d419
commit 0e1ff9ddbc
1 changed files with 2 additions and 1 deletions

View File

@ -510,7 +510,8 @@ with a prefix argument then this is passed on to
"Evaluate BODY in edit buffer if there is a code block at point.
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)
(when (and (org-babel-where-is-src-block-head)
(org-edit-src-code nil nil nil 'quietly))
(unwind-protect (progn ,@body)
(if (org-bound-and-true-p org-edit-src-from-org-mode)
(org-edit-src-exit)))