From: Richard Hansen <rhansen@bbn.com>
To: emacs-orgmode@gnu.org
Cc: Richard Hansen <rhansen@bbn.com>
Subject: [PATCH] ob-core.el: fix confirm before eval when using a function
Date: Mon, 1 Jul 2013 14:57:19 -0400 [thread overview]
Message-ID: <1372705039-19522-1-git-send-email-rhansen@bbn.com> (raw)
* 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
next reply other threads:[~2013-07-01 18:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-01 18:57 Richard Hansen [this message]
2013-07-01 20:26 ` [PATCH] ob-core.el: fix confirm before eval when using a function Achim Gratz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1372705039-19522-1-git-send-email-rhansen@bbn.com \
--to=rhansen@bbn.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).