From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: Bug: python babel does not support hlines as mentioned in docs Date: Tue, 30 Oct 2012 10:50:12 -0600 Message-ID: <87a9v3aof0.fsf@gmail.com> References: <87ehkhdx08.fsf@tee.lan> <874nlddvgl.fsf@tee.lan> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:41144) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTF7y-0002gf-Rx for emacs-orgmode@gnu.org; Tue, 30 Oct 2012 12:57:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TTF7r-0001Dv-KS for emacs-orgmode@gnu.org; Tue, 30 Oct 2012 12:57:22 -0400 Received: from mail-ia0-f169.google.com ([209.85.210.169]:51215) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTF7r-0001Dm-Fx for emacs-orgmode@gnu.org; Tue, 30 Oct 2012 12:57:15 -0400 Received: by mail-ia0-f169.google.com with SMTP id h37so430740iak.0 for ; Tue, 30 Oct 2012 09:57:14 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Lennart Fricke Cc: emacs-orgmode@gnu.org 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 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