From: Eric Schulte <schulte.eric@gmail.com>
To: Lennart Fricke <pge08aqw@studserv.uni-leipzig.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: Bug: python babel does not support hlines as mentioned in docs
Date: Tue, 30 Oct 2012 10:50:12 -0600 [thread overview]
Message-ID: <87a9v3aof0.fsf@gmail.com> (raw)
In-Reply-To: 874nlddvgl.fsf@tee.lan
Perhaps it would be better to provide two customization variables, e.g.,
;; -*- emacs-lisp -*-
(defcustom org-babel-python-hline-to "None"
"Replace hlines in incoming tables with this when translating to python.")
(defcustom org-babel-python-None-to "'hline"
"Replace 'None' in python tables with this before returning.")
That way users may exercise control over this translation process. I
know with R tables it is often desirable to replace missing values with
"" or 0.
Cheers,
Lennart Fricke <pge08aqw@studserv.uni-leipzig.de> writes:
> This patch makes None being treated as hline again.
>
> Best regards
> Lennart Fricke
>
> diff --git a/lisp/ob-python.el b/lisp/ob-python.el
> index 71adf73..a1f834f 100644
> --- a/lisp/ob-python.el
> +++ b/lisp/ob-python.el
> @@ -123,7 +123,11 @@ specifying a variable of the same value."
> "Convert RESULTS into an appropriate elisp value.
> If the results look like a list or tuple, then convert them into an
> Emacs-lisp table, otherwise return the results as a string."
> - (org-babel-script-escape results))
> + ((lambda (res)
> + (if (listp res)
> + (mapcar (lambda (el) (if (equal el 'None) 'hline el)) res)
> + res))
> + (org-babel-script-escape results)))
>
> (defvar org-babel-python-buffers '((:default . nil)))
>
--
Eric Schulte
http://cs.unm.edu/~eschulte
next prev parent reply other threads:[~2012-10-30 16:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-29 17:11 Bug: python babel does not support hlines as mentioned in docs [7.9.2 (release_7.9.2-499-ga29de0 @ /home/lennart/.emacs.d/site-lisp/org/lisp/)] Lennart Fricke
2012-10-29 17:44 ` Bug: python babel does not support hlines as mentioned in docs Lennart Fricke
2012-10-30 16:50 ` Eric Schulte [this message]
2012-10-30 18:03 ` Lennart Fricke
2012-10-31 0:07 ` Eric Schulte
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a9v3aof0.fsf@gmail.com \
--to=schulte.eric@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=pge08aqw@studserv.uni-leipzig.de \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.