Skip to content

Instantly share code, notes, and snippets.

@kaz-yos
Created November 14, 2017 03:07
Show Gist options
  • Save kaz-yos/0046fc2519d95f8a0fb800a4e925caa6 to your computer and use it in GitHub Desktop.
Save kaz-yos/0046fc2519d95f8a0fb800a4e925caa6 to your computer and use it in GitHub Desktop.
Offending functions in "Evaluation of this ipython code block is disabled."
;;; Issue reported by Brian
;; An ipython code snippet does not execute upon C-c C-c in org-mode.
;; "Evaluation of this ipython code block is disabled." is encountered.
;;; ob-core.el
;; This is the function showing the error message.
(defun org-babel-check-evaluate (info)
"Check if code block INFO should be evaluated.
Do not query the user, but do display an informative message if
evaluation is blocked. Returns non-nil if evaluation is not blocked."
(let ((confirmed (org-babel-check-confirm-evaluate info)))
(unless confirmed
(message "Evaluation of this %s code block%sis disabled."
(nth 0 info)
(let ((name (nth 4 info)))
(if name (format " (%s) " name) " "))))
confirmed))
;; This is then called to confirm if evaluation is allowed.
;; This function must be returning nil in this case, which means
;; the cond expression's noeval is non-nil.
;; This then means at least one of eval-no and eval-no-export are non-nil.
(defun org-babel-check-confirm-evaluate (info)
"Check whether INFO allows code block evaluation.
Returns nil if evaluation is disallowed, t if it is
unconditionally allowed, and the symbol `query' if the user
should be asked whether to allow evaluation."
(let* ((headers (nth 2 info))
(eval (or (cdr (assq :eval headers))
(when (assq :noeval headers) "no")))
(eval-no (member eval '("no" "never")))
(export org-babel-exp-reference-buffer)
(eval-no-export (and export (member eval '("no-export" "never-export"))))
(noeval (or eval-no eval-no-export))
(query (or (equal eval "query")
(and export (equal eval "query-export"))
(if (functionp org-confirm-babel-evaluate)
(funcall org-confirm-babel-evaluate
;; Language, code block body.
(nth 0 info) (nth 1 info))
org-confirm-babel-evaluate))))
(cond
(noeval nil)
(query 'query)
(t t))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment