emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Achim Gratz <Stromeko@nexgo.de>
To: emacs-orgmode@gnu.org
Subject: Re: org-babel: two confirmations for org/HTML "macro"?
Date: Wed, 10 Apr 2013 20:43:12 +0200	[thread overview]
Message-ID: <87k3oaw7jz.fsf@Rainer.invalid> (raw)
In-Reply-To: 87sj2yed7d.fsf@bzg.ath.cx

[-- Attachment #1: Type: text/plain, Size: 850 bytes --]

Bastien writes:
>> I can understand the first question, but why the second?
> A mystery to me too, perhaps either Eric or Nicolas may explain.

That's because lob calls get wrapped internally in an anonymous
emacs-lisp source block that then feeds through the result from the
actual call as elisp.  The attached patch should suppress the
confirmation for the wrapper call.  To the best of my knowledge nothing
dangerous can happen with that evaluation and all confirmations for the
call stack down from there have already taken place according to the
users' setup.

Since the test suite doesn't really test confirmation at all, it would
be nice if someone with a good variety of Babel calls could check if the
number of confirmations stay the same with and without the patch.  I
don't think I have test cases that cover all possible combinations.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Babel-avoid-superfluous-confirmation-for-internal-wr.patch --]
[-- Type: text/x-patch, Size: 2190 bytes --]

From 7909cf5e52c2ab244c1b6ea67dada6e8a2eebb20 Mon Sep 17 00:00:00 2001
From: Achim Gratz <Stromeko@Stromeko.DE>
Date: Wed, 10 Apr 2013 20:28:31 +0200
Subject: [PATCH] Babel: avoid superfluous confirmation for internal wrapper

* lisp/ob-exp.el (org-babel-exp-results): Suppress user confirmation
  of the emacs-lisp wrapper execution around a lob call.

* lisp/ob-lob.el (org-babel-lob-execute): Suppress user confirmation
  of the emacs-lisp wrapper execution around a lob call.
 lisp/ob-exp.el | 3 ++-
 lisp/ob-lob.el | 7 +++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el
index 0d98690..3c70e92 100644
--- a/lisp/ob-exp.el
+++ b/lisp/ob-exp.el
@@ -411,7 +411,8 @@ (defun org-babel-exp-results (info type &optional silent hash)
 	   ((equal type 'lob)
 	      (re-search-backward org-babel-lob-one-liner-regexp nil t)
-	      (org-babel-execute-src-block nil info)))))))))
+	      (let (org-confirm-babel-evaluate)
+		(org-babel-execute-src-block nil info))))))))))
 (provide 'ob-exp)
diff --git a/lisp/ob-lob.el b/lisp/ob-lob.el
index 4c89485..5366989 100644
--- a/lisp/ob-lob.el
+++ b/lisp/ob-lob.el
@@ -116,6 +116,7 @@ (defun org-babel-lob-get-info ()
 	 (list (length (if (= (length (match-string 12)) 0)
 			   (match-string 2) (match-string 11)))))))))
+(defvar org-babel-default-header-args:emacs-lisp) ; dynamic binding from ob-emacs-lisp
 (defun org-babel-lob-execute (info)
   "Execute the lob call specified by INFO."
   (let* ((mkinfo (lambda (p) (list "emacs-lisp" "results" p nil nil (nth 2 info))))
@@ -136,8 +137,10 @@ (defun org-babel-lob-execute (info)
 	(save-excursion (goto-char (org-babel-where-is-src-block-result))
 			(forward-line 1)
 			(message "%S" (org-babel-read-result)))
-      (prog1 (org-babel-execute-src-block
-	      nil (funcall mkinfo (org-babel-process-params pre-params)))
+      (prog1 (let* ((proc-params (org-babel-process-params pre-params))
+		     org-confirm-babel-evaluate)
+	       (org-babel-execute-src-block
+		nil (funcall mkinfo proc-params)))
 	;; update the hash
 	(when new-hash (org-babel-set-current-result-hash new-hash))))))

[-- Attachment #3: Type: text/plain, Size: 186 bytes --]

+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Samples for the Waldorf Blofeld:

  reply	other threads:[~2013-04-10 18:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-28  9:35 org-babel: two confirmations for org/HTML "macro"? Stefan Vollmar
2013-04-10 12:53 ` Bastien
2013-04-10 18:43   ` Achim Gratz [this message]
2013-04-10 23:34     ` Bastien
2013-04-11  5:22       ` Achim Gratz
2013-04-11  8:41         ` Bastien
2013-04-12 22:37           ` Eric Schulte
2013-04-13  6:37             ` 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:

  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=87k3oaw7jz.fsf@Rainer.invalid \
    --to=stromeko@nexgo.de \
    --cc=emacs-orgmode@gnu.org \


* 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


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).