From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Hansen Subject: [PATCH] ob-core.el: fix confirm before eval when using a function Date: Mon, 1 Jul 2013 14:57:19 -0400 Message-ID: <1372705039-19522-1-git-send-email-rhansen@bbn.com> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34174) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtjIX-0005iP-Nb for emacs-orgmode@gnu.org; Mon, 01 Jul 2013 14:58:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UtjIT-00033O-2T for emacs-orgmode@gnu.org; Mon, 01 Jul 2013 14:58:01 -0400 Received: from smtp.bbn.com ([128.33.1.81]:24044) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtjIS-0002oX-U9 for emacs-orgmode@gnu.org; Mon, 01 Jul 2013 14:57:56 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cc: Richard Hansen * 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