emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Bug: python babel does not support hlines as mentioned in docs


From: Eric Schulte
Subject: Re: [O] Bug: python babel does not support hlines as mentioned in docs
Date: Tue, 30 Oct 2012 10:50:12 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

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 <address@hidden> 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



reply via email to

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