* [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
* Re: [PATCH] ob-core.el: fix confirm before eval when using a function
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
0 siblings, 0 replies; 2+ messages in thread
From: Achim Gratz @ 2013-07-01 20:26 UTC (permalink / raw)
To: emacs-orgmode
Richard Hansen writes:
> 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.
Indeed, thanks for catching it. This had actually been fixed before in
exactly the same way, then replaced by a cond form and then replaced
again (wrongly) with an or form… I should have looked at the history of
that code more closely.
Fixed in maint and master.
Regards,
Achim.
--
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
Wavetables for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldUserWavetables
^ permalink raw reply [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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.