emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Kyle Meyer <kyle@kyleam.com>
Cc: Richard Stanton <stanton@haas.berkeley.edu>,
	emacs-orgmode@gnu.org, John Kitchin <jkitchin@andrew.cmu.edu>
Subject: Re: Extraneous output from Python code blocks using :session option
Date: Sat, 14 Mar 2015 09:26:06 +0100	[thread overview]
Message-ID: <87mw3g2dep.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <877fult0yy.fsf@kmlap.domain.org> (Kyle Meyer's message of "Fri, 13 Mar 2015 10:40:21 -0400")

Kyle Meyer <kyle@kyleam.com> writes:

> Thanks for your comments.  I've attached updated patches.

Thanks.

> Subject: [PATCH 1/2] ob-python.el: Allow indented code in sessions
>
> * lisp/ob-python.el (org-babel-python-evaluate-session): Recognize
> indented code in session and treat it differently to avoid syntax
> errors.

You also need to list new functions and variables in commit message,
e.g.,

  (org-babel-python-indented-lines-session-method): New variable.

> * lisp/ob-python.el (org-babel-python-evaluate-session): Strip extra leading
>   "..." and ">>>" from session output.

Ditto.

  (org-babel-python--strip-session-chars): New function.

> +(defun org-babel-python--strip-session-chars (string)
> +  "Remove leading '>>>' and '...' from STRING.
> +`org-babel-comint-with-output' splits the Python session output
> +by `comint-prompt-regexp' (which includes '>>>' and '...'), but,
> +in some situations, these still make it through at the start of
> +the output string."

Wouldn't it be better to find the situations above at the source? If may
be due to some indentation problem at the beginning of the string, in
which case an `org-trim' within `org-babel-comint-with-output' could
solve it.

WDYT?


Regards,

  reply	other threads:[~2015-03-14  8:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-11  3:38 Extraneous output from Python code blocks using :session option Richard Stanton
2015-03-11 18:29 ` Kyle Meyer
2015-03-11 18:54   ` Richard Stanton
2015-03-12 15:17   ` John Kitchin
2015-03-12 15:34     ` Richard Stanton
2015-03-12 21:23       ` Kyle Meyer
2015-03-13  6:58         ` Kyle Meyer
2015-03-13  8:21           ` Nicolas Goaziou
2015-03-13 14:40             ` Kyle Meyer
2015-03-14  8:26               ` Nicolas Goaziou [this message]
2015-03-16  0:40                 ` Kyle Meyer
2015-03-12 21:21     ` Kyle Meyer

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=87mw3g2dep.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=jkitchin@andrew.cmu.edu \
    --cc=kyle@kyleam.com \
    --cc=stanton@haas.berkeley.edu \
    /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).