summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2013-10-14 13:21:59 (GMT)
committer Eric Schulte <schulte.eric@gmail.com>2013-10-14 13:23:39 (GMT)
commit2eef1b45495432f14520d42902bd0d246305efe3 (patch)
treef595896592dc776c43fa8674d43ed4a3deffe439
parent8f8c8cbed026fb8208579b640bb5c25422e3b878 (diff)
downloadorg-mode-2eef1b45495432f14520d42902bd0d246305efe3.zip
org-mode-2eef1b45495432f14520d42902bd0d246305efe3.tar.gz
call org-confirm-babel-evaluate from code block
Always call org-confirm-babel-evaluate from the head of the code block being evaluated so that the info may be found with e.g., (org-babel-get-src-block-info 'light) * lisp/ob-core.el (org-babel-check-confirm-evaluate): Call org-confirm-babel-evaluate from code block head.
-rw-r--r--lisp/ob-core.el9
1 files changed, 6 insertions, 3 deletions
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index b0911ae..8fafd4b 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -287,11 +287,12 @@ hold the language of the code block, and BLOCK-NAME will hold the
name of the code block."
(declare (indent defun))
(org-with-gensyms
- (lang block-body headers name eval eval-no export eval-no-export)
+ (lang block-body headers name head eval eval-no export eval-no-export)
`(let* ((,lang (nth 0 ,info))
(,block-body (nth 1 ,info))
(,headers (nth 2 ,info))
(,name (nth 4 ,info))
+ (,head (nth 6 ,info))
(,eval (or (cdr (assoc :eval ,headers))
(when (assoc :noeval ,headers) "no")))
(,eval-no (or (equal ,eval "no")
@@ -303,8 +304,10 @@ name of the code block."
(query (or (equal ,eval "query")
(and ,export (equal ,eval "query-export"))
(if (functionp org-confirm-babel-evaluate)
- (funcall org-confirm-babel-evaluate
- ,lang ,block-body)
+ (save-excursion
+ (goto-char ,head)
+ (funcall org-confirm-babel-evaluate
+ ,lang ,block-body))
org-confirm-babel-evaluate)))
(code-block (if ,info (format " %s " ,lang) " "))
(block-name (if ,name (format " (%s) " ,name) " ")))