From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: [Babel] Reporting 2 problems of code execution Date: Mon, 29 Nov 2010 19:49:19 +0000 Message-ID: <87fwujoqps.fsf@gmail.com> References: <80wrnxi59j.fsf@missioncriticalit.com> <80pqtoijrw.fsf@missioncriticalit.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=49476 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PN9jy-00032I-Bj for emacs-orgmode@gnu.org; Mon, 29 Nov 2010 14:50:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PN9jw-0000qd-Eu for emacs-orgmode@gnu.org; Mon, 29 Nov 2010 14:50:22 -0500 Received: from plane.gmane.org ([80.91.229.3]:37427) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PN9jw-0000qQ-3K for emacs-orgmode@gnu.org; Mon, 29 Nov 2010 14:50:20 -0500 Received: from public by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1PN9jr-0007ZI-IK for emacs-orgmode@gnu.org; Mon, 29 Nov 2010 20:50:15 +0100 In-Reply-To: <80pqtoijrw.fsf@missioncriticalit.com> (=?utf-8?Q?=22S=C3=A9b?= =?utf-8?Q?astien?= Vauban"'s message of "Mon, 29 Nov 2010 10:03:31 +0100") 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: =?utf-8?Q?S=C3=A9bastien?= Vauban Cc: public-emacs-orgmode-mXXj517/zsQ@plane.gmane.org S=C3=A9bastien Vauban writes: > Hi Charles, > > Thanks a lot for taking a look at this, too... > > "Charles C. Berry" wrote: >> On Sun, 28 Nov 2010, S=C3=A9bastien Vauban wrote: >>> Hi Eric and Dan, >>> >>> * Abstract >>> >>> Reporting two problems: >> >> Did you mean to include ":results output" in the headers? > > You're right that could be it. I often forget about adding that setting, = even > though it's more or less mandatory for the sh blocks -- at least, in many= sh > blocks I write... > > >> When I do that in eaco of the src blocks I get what I think you were >> expecting. > > I still don't. See below. > > >>> 1. parsing problem of unescaped text from a shell block >>> 2. end marker repeated upon execution of elisp block >>> >>> Note that I added the RESULT thing in my default headers. >>> >>> * Data >>> >>> Let's say I want to grep trough arbitrary text, such as: >>> >>> #+results:a-couple-of-lines >>> : He said "I'll do it" >>> : but that cannot be echo'ed! >>> >>> ... or to let it scanned by AWK for post-processing (like generating so= me >>> DOT representation). >>> >>> But, first, as errors are popping up, let's say I can just output it as= is. >>> >>> * Shell code >>> >>> #+begin_src sh :var data=3Da-couple-of-lines :exports both >>> echo "$data" >>> #+end_src >>> >>> #+results: >>> #+BEGIN_RESULT >>> #+END_RESULT >> >> #+begin_src sh :results output :var data=3Da-couple-of-lines :exports bo= th >> echo "$data" >> #+end_src >> >> #+results: >> : He said "I'll do it" >> : but that cannot be echo'ed! > > It does not work for me. With the above, I (still) get: > > #+results: > #+BEGIN_RESULT > #+END_RESULT > > > for results, and, in the *Org-Babel Error Output*: > > sh: line 3: unexpected EOF while looking for matching `'' > sh: line 7: syntax error: unexpected end of file Hi Seb, Just to say that these blocks with embedded quotes are outputting OK for me on linux, but I do see the second bug you mention (repeatedly adding new lines on each execution). I'm guessing that the first one is a difference in shell quoting behaviour between out operating systems. Dan > > >>> The data is impossible (*for me*, as is) to print out from a shell code. >>> Though, it is in Emacs-Lisp... without any change. >>> >>> Note that it's the second *single quote* only that's causing a problem,= not >>> the first one... >>> >>> * Emacs-Lisp code >>> >>> Executing this: >>> >>> #+begin_src emacs-lisp :var data=3Da-couple-of-lines :exports both >>> (prin1-to-string data) >>> #+end_src >>> >>> #+results: >>> #+BEGIN_RESULT >>> #+begin_example >>> "He said \"I'll do it\" >>> but that cannot be echoed!" >>> #+END_RESULT#+end_example >>> #+end_example >>> #+end_example >>> #+end_example >>> #+end_example >>> #+end_example >>> #+end_example >>> #+end_example >>> #+end_example >>> >>> works, but the *end marker is repeated* as long as we re-execute the bl= ock. >> >> #+begin_src emacs-lisp results output :var data=3Da-couple-of-lines :exp= orts both >> (prin1-to-string data) >> #+end_src >> >> #+results: >> : "He said \"I'll do it\" >> : but that cannot be echo'ed!" > > With or without the ":results output" (BTW, notice you've forgotten the c= olon > in front of results), the result is the same. But, if you evaluate the bl= ock > multiple times, in my case, the end marker (end_example) is still repeate= d... > > Best regards, > Seb