emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Extraneous output from Python code blocks using :session option


From: Nicolas Goaziou
Subject: Re: [O] Extraneous output from Python code blocks using :session option
Date: Sat, 14 Mar 2015 09:26:06 +0100

Kyle Meyer <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]