From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Berry, Charles" Subject: Re: Babel eval w/ C-c C-c but not (org-babel-execute-buffer) Date: Thu, 10 Oct 2019 16:22:51 +0000 Message-ID: <31702816-69D2-450B-88A0-D6F7375C014C@ucsd.edu> References: <87o8yyj2oe.fsf@gmail.com> <877e5d3zmu.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:42710) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iIbE2-0003kv-Lk for emacs-orgmode@gnu.org; Thu, 10 Oct 2019 12:23:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iIbE1-0003f3-0u for emacs-orgmode@gnu.org; Thu, 10 Oct 2019 12:23:38 -0400 Received: from mx0b-00395d01.pphosted.com ([148.163.137.170]:12354) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iIbDy-0003eV-LM for emacs-orgmode@gnu.org; Thu, 10 Oct 2019 12:23:36 -0400 In-Reply-To: <877e5d3zmu.fsf@gmail.com> Content-Language: en-US Content-ID: 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" To: Ken Mankoff Cc: "emacs-orgmode@gnu.org" , John Kitchin > On Oct 9, 2019, at 11:04 PM, Ken Mankoff wrote: >=20 > Hello, >=20 > I think that even when ":eval no" is set, eval should happen if the user = explicitly requests it. If the language mode you use supports of evaluation of the src edit buffer= (e.g. ESS[R], Python), you can issue C-c C-v v C-c C-b for ESS[R] or C-c C-v v C-c C-c for Python (I think) The commands will expand :var args and noweb declarations, then execute the= corresponding 'send-buffer' command regardless of :eval.=20 >=20 > The use case is that I have code that takes an unreasonable amount of com= pute time to run it in Emacs (e.g. a full day of compute time). I think eve= n with :async this type of code should be run outside of emacs, so I tangle= it and run the python or bash scripts in a terminal. >=20 > Elsewhere in the project (Org file) I have babel blocks that I want to up= date throughout the file. I do this by cleaning all result blocks with =3DC= -u C-c C-v k=3D or (org-babel-remove-result-one-or-many), then executing al= l blocks (without =3D:eval no=3D) using =3DC-c C-v C-b=3D or (org-babel-exe= cute-buffer). >=20 > In order to not spend days of compute time when I eval (org-babel-execute= -buffer), I set :eval no to the computationally heavy babel blocks. But dur= ing development it would be nice to run these... hence the conflict with th= e current Org behavior and my desire for a new feature. >=20 Why not use something like this :eval (ok2run) where `ok2run' consults a property to decide whether to eval the block?=20 > The two-line change at the bottom implements the following behavior: >=20 > When the prefix arg is passed to org-babel-execute-src-block, the block i= s evaluated regardless of the :eval flag. >=20 > Note that this doubles up on the prefix arg behavior, which is already se= t according to the documentation: >=20 >> With prefix argument ARG, force re-execution even if an existing >> result cached in the buffer would otherwise have been returned. >=20 > Questions for the list: >=20 > Is this feature something that makes sense? >=20 > If yes, then do you also think that tangling should occur when explicitly= requested (i.e. C-u C-c C-v C-t), even if :tangle no is set? >=20 > Suggestions for a better implementation? >=20 > Thanks, >=20 > -k. >=20 >=20 > diff --git a/lisp/ob-core.el b/lisp/ob-core.el > index 572f97919..9f9add334 100644 > --- a/lisp/ob-core.el > +++ b/lisp/ob-core.el > @@ -646,7 +646,7 @@ block." > ;; Merge PARAMS with INFO before considering source block > ;; evaluation since both could disagree. > (cl-callf org-babel-merge-params (nth 2 info) params) > - (when (org-babel-check-evaluate info) > + (when (or arg (org-babel-check-evaluate info)) > (cl-callf org-babel-process-params (nth 2 info)) > (let* ((params (nth 2 info)) > (cache (let ((c (cdr (assq :cache params)))) > @@ -663,7 +663,7 @@ block." > (let ((result (org-babel-read-result))) > (message (replace-regexp-in-string "%" "%%" (format "%S" result))) > result))) > - ((org-babel-confirm-evaluate info) > + ((or arg (org-babel-confirm-evaluate info)) > (let* ((lang (nth 0 info)) > (result-params (cdr (assq :result-params params))) > ;; Expand noweb references in BODY and remove any >=20 >=20 >=20