From mboxrd@z Thu Jan 1 00:00:00 1970 From: Achim Gratz Subject: Re: org-babel: two confirmations for org/HTML "macro"? Date: Wed, 10 Apr 2013 20:43:12 +0200 Message-ID: <87k3oaw7jz.fsf@Rainer.invalid> References: <890A187B-1139-49F9-AF3C-581B5DA49BED@nf.mpg.de> <87sj2yed7d.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:33897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPzzX-0008Lb-5d for emacs-orgmode@gnu.org; Wed, 10 Apr 2013 14:43:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPzzV-0007pz-R4 for emacs-orgmode@gnu.org; Wed, 10 Apr 2013 14:43:31 -0400 Received: from plane.gmane.org ([80.91.229.3]:59445) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPzzV-0007pj-Je for emacs-orgmode@gnu.org; Wed, 10 Apr 2013 14:43:29 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UPzzQ-0004Iv-9U for emacs-orgmode@gnu.org; Wed, 10 Apr 2013 20:43:24 +0200 Received: from pd9eb2b1c.dip.t-dialin.net ([217.235.43.28]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 10 Apr 2013 20:43:24 +0200 Received: from Stromeko by pd9eb2b1c.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 10 Apr 2013 20:43:24 +0200 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 --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Babel-avoid-superfluous-confirmation-for-internal-wr.patch >From 7909cf5e52c2ab244c1b6ea67dada6e8a2eebb20 Mon Sep 17 00:00:00 2001 From: Achim Gratz 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) (save-excursion (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)))))) -- 1.8.2.1 --=-=-= Content-Type: text/plain Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ Samples for the Waldorf Blofeld: http://Synth.Stromeko.net/Downloads.html#BlofeldSamplesExtra --=-=-=--