emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH] ob-core.el: fix confirm before eval when using a function


From: Richard Hansen
Subject: [O] [PATCH] ob-core.el: fix confirm before eval when using a function
Date: Mon, 1 Jul 2013 14:57:19 -0400

* lisp/ob-core.el: (org-babel-check-confirm-evaluate): Fix handling of
  `org-confirm-babel-evaluate' when it is a function.

When `org-confirm-babel-evaluate' is a function, this construct:

    (or (when (functionp org-confirm-babel-evaluate)
          (funcall org-confirm-babel-evaluate lang block-body))
        org-confirm-babel-evaluate)

will always be true -- if the function evaluates to nil, the `or' will
evaluate to the value of `org-confirm-babel-evaluate', which is
non-nil.

Change the `when' to an `if' and move a closing parenthesis so that
when `org-confirm-babel-evaluate' is a function its return value will
always be used, even if nil.

TINYCHANGE
---
 lisp/ob-core.el | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 16a122e..bde9553 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -301,10 +301,10 @@ name of the code block."
            (noeval          (or ,eval-no ,eval-no-export))
            (query           (or (equal ,eval "query")
                                 (and ,export (equal ,eval "query-export"))
-                                (when (functionp org-confirm-babel-evaluate)
-                                  (funcall org-confirm-babel-evaluate
-                                           ,lang ,block-body))
-                                org-confirm-babel-evaluate))
+                                (if (functionp org-confirm-babel-evaluate)
+                                    (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) " ")))
        ,@body)))
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]