From mboxrd@z Thu Jan 1 00:00:00 1970 From: Herbert Sitz Subject: Re: org-babel -- Improper syntax error in session mode? Date: Mon, 20 Jun 2011 17:27:39 -0700 Message-ID: References: <87k4chwgpa.fsf@gmail.com> <23747.1308539849@alphaville.dokosmarshall.org> <87ei2ouwxk.fsf@gmail.com> <87aadcxl05.fsf@gmail.com> <7366.1308614902@alphaville.americas.hpqcorp.net> Reply-To: hsitz@nwlink.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from eggs.gnu.org ([140.186.70.92]:41959) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYoog-0000qN-DC for emacs-orgmode@gnu.org; Mon, 20 Jun 2011 20:27:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QYoof-0005r8-BJ for emacs-orgmode@gnu.org; Mon, 20 Jun 2011 20:27:42 -0400 Received: from mail-ew0-f41.google.com ([209.85.215.41]:43959) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYoof-0005qy-6u for emacs-orgmode@gnu.org; Mon, 20 Jun 2011 20:27:41 -0400 Received: by ewy9 with SMTP id 9so1036199ewy.0 for ; Mon, 20 Jun 2011 17:27:40 -0700 (PDT) In-Reply-To: <7366.1308614902@alphaville.americas.hpqcorp.net> 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: nicholas.dokos@hp.com Cc: emacs-orgmode@gnu.org On Mon, Jun 20, 2011 at 5:08 PM, Nick Dokos wrote: > Herbert Sitz wrote: > >> ... (and, it turns out, _avoid_ blank lines in other cases) > > What are those cases? > > Nick > _Every_ spot where a blank line occurs that is followed by "unindented" line of (uncommented) code. By design, the blank line in interactive shell terminates a "highest-level" block and triggers its output. So you _can't_ have blank lines within a level-1 block, all lines in the block must have text. I just noticed, though, that you can include comments and that the indent of comments is irrelevant, so these blank lines could merely have a '# sign prepended to them to transform them into comments. (Existence of "unindented" comments needs to be taken into account for the regex that adds blank lines, though, since they're to be ignored for that purpose.) So this works fine in interactive shell with Eric's patch: -------------------------------------- #+begin_src python :results output :session mypy x = 1 y = 1 z = 1 for i in range(1,2): x = x + i print x # comment here for y in range(10,11): print y # comment here for z in range(5,6): print z while y > 0: print y y=y-1 print "Did it work?" #+end_src ------------------------------------- but this doesn't ----------------------------- #+begin_src python :results output :session mypy x = 1 y = 1 z = 1 for i in range(1,2): x = x + i print x for y in range(10,11): print y for z in range(5,6): print z while y > 0: print y y=y-1 print "Did it work?" #+end_src ------------------------------