From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?=C5=81ukasz?= Stelmach Subject: Re: [PATCH] quote the real csv separator Date: Mon, 25 Oct 2010 10:45:00 +0200 Message-ID: <87zku2mzjn.fsf@dasa3.iem.pw.edu.pl> References: <87mxq4wman.fsf@kotik.lan> <57E157F5-BDE7-4431-B15F-8EE52E571677@gmail.com> <871v7f8gfl.fsf@kotik.lan> <87tykbqd1v.fsf@gollum.intra.norang.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from [140.186.70.92] (port=36983 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PAIgK-0002WY-07 for emacs-orgmode@gnu.org; Mon, 25 Oct 2010 04:45:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PAIgC-00030B-7K for emacs-orgmode@gnu.org; Mon, 25 Oct 2010 04:45:22 -0400 Received: from lo.gmane.org ([80.91.229.12]:33692) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PAIgC-0002zo-1m for emacs-orgmode@gnu.org; Mon, 25 Oct 2010 04:45:20 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PAIg7-0001ho-0s for emacs-orgmode@gnu.org; Mon, 25 Oct 2010 10:45:15 +0200 Received: from dasa3.iem.pw.edu.pl ([194.29.147.110]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 25 Oct 2010 10:45:14 +0200 Received: from lukasz.stelmach by dasa3.iem.pw.edu.pl with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 25 Oct 2010 10:45:14 +0200 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: emacs-orgmode@gnu.org Bernt Hansen writes: > Łukasz Stelmach writes: >> Carsten Dominik writes: >>> What use case do you have in mind? [...] >> My bank lets me download monthly reports as CSV. In fact they let me >> choose the separator and the default value is the comma. But I choose >> '|' because then I can open the csv as org file and just do >> >> (replace-regexp "^" "|") >> >> to get a beautiful org-mode table. > > There is an easier org-mode way I think. Just get the comma delimited > data into your org file, select the region and C-c | to get your table. > > If you are inserting an external file with C-x i RET > then C-x C-x marks the region and C-c | converts it to a table. Cool :-) It works like charm. I'll have to check how to convert decimal commas to periods. I still like '|' more for my perl script, though, because it's enough to split '\|' and not care about quoted commas. But this is my problem. OK, I won't insist on keeping the patch but I would like to get a rationale of :sep parameter in orgtbl-to-generic without a choice of how to quote it. OR, if you think that CSV should stay as it is then I suggest such a rewrite: (defun orgtbl-to-csv (table params) (orgtbl-to-generic table (org-combine-plists params '(:sep "," :fmt org-quote-csv-field)))) to make CSV :sep and and :fmt mandatory (that's how this all have starded). -- Miłego dnia, Łukasz Stelmach