* [PATCH] ob-core.el: fix confirm before eval when using a function
@ 2013-07-01 18:57 Richard Hansen
2013-07-01 20:26 ` Achim Gratz
0 siblings, 1 reply; 2+ messages in thread
From: Richard Hansen @ 2013-07-01 18:57 UTC (permalink / raw)
To: emacs-orgmode; +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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-07-01 20:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-01 18:57 [PATCH] ob-core.el: fix confirm before eval when using a function Richard Hansen
2013-07-01 20:26 ` Achim Gratz
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).