From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: [Babel] No output returned if just one command is failing Date: Thu, 02 Dec 2010 07:35:34 -0700 Message-ID: <87fwug9r8y.fsf@gmail.com> References: <80eia1ondv.fsf@missioncriticalit.com> <87r5e1ftxl.fsf@gmail.com> <80sjyhjz0b.fsf@missioncriticalit.com> <87d3pkialo.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=52529 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1POAHD-00010G-3o for emacs-orgmode@gnu.org; Thu, 02 Dec 2010 09:37:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1POAGR-0005VX-W1 for emacs-orgmode@gnu.org; Thu, 02 Dec 2010 09:36:49 -0500 Received: from mail-gw0-f41.google.com ([74.125.83.41]:50121) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1POAGR-0005VM-Sh for emacs-orgmode@gnu.org; Thu, 02 Dec 2010 09:36:03 -0500 Received: by gwj22 with SMTP id 22so2441171gwj.0 for ; Thu, 02 Dec 2010 06:36:03 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Dan Davison Cc: mailing list emacs, =?utf-8?Q?S=C3=A9bastien?= Vauban Hi, You both make good points in favor of this behavior, and I had no idea this would be as easy as Dan's patch below, I was thinking that some sort of intermediate results return would be required. I would be open to either of Dan's suggested changes 1. return partial results for ":results output" 2. return partial results controlled by some new header argument I am worried by the prospect of partial results being used by another code block in chained code block execution. Perhaps some special care should be taken to ensure that this will not happen, or perhaps this should happen only in case two above where the user has explicitly specified that partial results are OK. Thoughts? -- Eric Dan Davison writes: > Hi Seb, I definitely have some sympathy with your request. On two > occasions I've had to manually make this change just to carry on > working. The change I made is straightforward if you need it as a > temporary hack: > > diff --git a/lisp/ob-eval.el b/lisp/ob-eval.el > index 8832d91..1cce003 100644 > --- a/lisp/ob-eval.el > +++ b/lisp/ob-eval.el > @@ -57,7 +57,7 @@ STDERR with `org-babel-eval-error-notify'." > (progn > (with-current-buffer err-buff > (org-babel-eval-error-notify exit-code (buffer-string))) > - nil) > + (buffer-string)) > (buffer-string))))) >=20=20 > (defun org-babel-eval-read-file (file) > > But do we actually change babel in this direction? It's important to > distinguish between :results output and :results value here. The change > that seems superficially attractive is to allow :results output to > output the contents of standard output, even if there has been an > error. After all, stdout might contain some useful data, and currently > babel refuses point blank to give it to you if there's been an > error. And as you say, this is the behavior we are used to in the > shell. This hypothetical change would leave the default :results value > alone (so the above patch would need modification). > > The thing is that babel currently has a clear, simple, rule which says: > if there's an error, the result is the elisp value nil. > > Eric and I have discussed in the past whether there should be any change > in this direction. The idea of a :debug header arg has been floated, > that would allow this behavior. Or tacking stdout on to the error > output. I tend to think that the behavior you request does need to be > made available, somehow, whether by default or not. > > Dan > > S=C3=A9bastien Vauban > writes: > >> Hi Eric, >> >> "Eric Schulte" wrote: >>> I don't forsee adding partial results insertion both because >>> >>> - it would add a good deal of complexity to the code to insert results >>> part-way through a run >> >> I can't comment on this, of course. >> >>> - the current behavior of only inserting results on a fully successful >>> run is reasonable and is probably more obvious (at least to me) than >>> inserting partial results >> >> Being fond of Babel, I'm using it always, everywhere. I prefer: >> >> 1. typing my shell commands in an Org buffer, >> 2. evaluate the block, >> 3. get the results automagically inserted in the buffer, >> 4. (eventually, version the whole file for later comparisons when updati= ng the >> code), >> 5. export the whole to HTML and/or PDF. >> >> The current behavior, even if totally respectable and defendable, inhibi= ts >> such a way of working: if you write (or update) a shell code, and don't = see >> (more or less) the same things as the ones you would see in a shell buff= er, >> then you can't use such an Org buffer -- as long as one command fails. >> >> I don't especially want you to change your position, but I'm explaining = the >> "negative" consequences for me. >> >> Thanks! >> >> Best regards, >> Seb