From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: [babel] double quotes in tables Date: Fri, 18 Dec 2009 10:03:45 -0700 Message-ID: <87bphwp632.fsf@gmail.com> References: <87iqc9a5rd.fsf@missioncriticalit.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NLgFI-0002Xg-GU for emacs-orgmode@gnu.org; Fri, 18 Dec 2009 12:04:04 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NLgFC-0002SO-VY for emacs-orgmode@gnu.org; Fri, 18 Dec 2009 12:04:03 -0500 Received: from [199.232.76.173] (port=48521 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NLgFC-0002SI-QH for emacs-orgmode@gnu.org; Fri, 18 Dec 2009 12:03:58 -0500 Received: from mail-bw0-f215.google.com ([209.85.218.215]:49938) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NLgFB-0007uP-KU for emacs-orgmode@gnu.org; Fri, 18 Dec 2009 12:03:58 -0500 Received: by bwz7 with SMTP id 7so2431944bwz.26 for ; Fri, 18 Dec 2009 09:03:56 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Francesco Pizzolante Cc: mailing-list-org-mode Hi Francesco, Thanks for bringing this up. I'm thinking that a more aggressive version of your patch should be applied here. It seems that org-babel should not change the values of tables which pass through it. I'm leaning towards applying the following lines of your patch - '(:fmt (lambda (cell) (format "%S" cell)))) "\n")) + '(:fmt (lambda (cell) (format outputformat cell)))) "\n")) That change doesn't seem to break any of our unit tests. Can anyone think of a reason not to make this change? Thanks -- Eric Francesco Pizzolante writes: > Hi, > > Often, I find useful that babel could generate result tables without the > double quotes (") enclosing all the text values in the cells. > > In order to do that, I added a 'noquotes` option to the :results header > argument. > > Here's my patch. As I'm not an elisp expert, please tell me if there's a > better/safer way to do that or maybe that it already exists an option to do > that... > > diff --git a/contrib/babel/lisp/org-babel.el b/contrib/babel/lisp/org-babel.el > index 4c9bff5..13c8237 100644 > --- a/contrib/babel/lisp/org-babel.el > +++ b/contrib/babel/lisp/org-babel.el > @@ -706,6 +706,9 @@ code ---- the results are extracted in the syntax of the source > code of the language being evaluated and are added > inside of a #+BEGIN_SRC block with the source-code > language set appropriately." > + (setq outputformat "%S") > + (if (member "noquotes" result-params) > + (setq outputformat "%s")) > (if (stringp result) > (progn > (setq result (org-babel-clean-text-properties result)) > @@ -739,7 +742,7 @@ code ---- the results are extracted in the syntax of the source > (if (and (listp (car result)) > (listp (cdr (car result)))) > result (list result)) > - '(:fmt (lambda (cell) (format "%S" cell)))) "\n")) > + '(:fmt (lambda (cell) (format outputformat cell)))) "\n")) > (forward-line -1) (org-cycle)) > ((member "file" result-params) > (insert result)) > @@ -827,7 +830,8 @@ parameters when merging lists." > (let ((results-exclusive-groups > '(("file" "vector" "table" "scalar" "raw" "org" "html" "latex" "code" "pp") > ("replace" "silent") > - ("output" "value"))) > + ("output" "value") > + ("noquotes"))) > (exports-exclusive-groups > '(("code" "results" "both" "none"))) > params results exports tangle cache vars var ref) > > Thanks, > Francesco > > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode