From: Herbert Sitz <hesitz@gmail.com>
To: nicholas.dokos@hp.com
Cc: emacs-orgmode@gnu.org
Subject: Re: org-babel -- Improper syntax error in session mode?
Date: Mon, 20 Jun 2011 17:27:39 -0700 [thread overview]
Message-ID: <BANLkTikA2p5kDEE_-dqERtoBJYTpWPHGZQ@mail.gmail.com> (raw)
In-Reply-To: <7366.1308614902@alphaville.americas.hpqcorp.net>
On Mon, Jun 20, 2011 at 5:08 PM, Nick Dokos <nicholas.dokos@hp.com> wrote:
> Herbert Sitz <hsitz@nwlink.com> 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
------------------------------
next prev parent reply other threads:[~2011-06-21 0:27 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-19 21:54 org-babel -- Improper syntax error in session mode? Herbert Sitz
2011-06-19 23:21 ` Eric Schulte
2011-06-20 1:59 ` Herbert Sitz
2011-06-20 2:12 ` Herbert Sitz
2011-06-20 3:17 ` Nick Dokos
2011-06-20 3:46 ` Herbert Sitz
2011-06-20 19:23 ` Eric Schulte
2011-06-20 20:45 ` Herbert Sitz
2011-06-20 21:15 ` Eric Schulte
2011-06-20 23:16 ` Herbert Sitz
2011-06-21 0:08 ` Nick Dokos
2011-06-21 0:27 ` Herbert Sitz [this message]
[not found] ` <hesitz@gmail.com>
2011-06-21 1:17 ` Nick Dokos
2011-06-21 2:19 ` Eric Schulte
2011-06-21 5:13 ` Herbert Sitz
2011-06-21 7:15 ` Thomas S. Dye
2011-06-21 15:35 ` Herbert Sitz
2011-06-21 16:27 ` Thomas S. Dye
2011-06-21 17:42 ` Eric Schulte
2011-06-21 17:51 ` Herbert Sitz
2011-06-21 17:52 ` Eric Schulte
2011-06-27 18:09 ` Herbert Sitz
2011-06-21 17:26 ` Eric Schulte
2011-06-27 18:22 ` Herbert Sitz
2011-06-20 21:18 ` Jambunathan K
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BANLkTikA2p5kDEE_-dqERtoBJYTpWPHGZQ@mail.gmail.com \
--to=hesitz@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=hsitz@nwlink.com \
--cc=nicholas.dokos@hp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).