[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] Re: [PATCH] quote the real csv separator
From: |
Carsten Dominik |
Subject: |
Re: [Orgmode] Re: [PATCH] quote the real csv separator |
Date: |
Mon, 25 Oct 2010 11:06:31 +0200 |
On Oct 25, 2010, at 10:45 AM, Łukasz Stelmach wrote:
Bernt Hansen <address@hidden> writes:
Łukasz Stelmach <address@hidden> writes:
Carsten Dominik <address@hidden> 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 <file> 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.
orgtbl-to-generic is, well, very generic. It is up to the caller that
when she/he specified :sep, to ensure the the separator does not show
up in fields, of to specify :fmt in a way that it will take care of
any necessary quoting. There is no generic way of quoting, sometimes
it is prepending a character, bu in other cases something completely
different might be needed.
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).
I don't understand, here is the current definition of orgtbl-to-csv:
(defun orgtbl-to-csv (table params)
"Convert the orgtbl-mode table to CSV material.
This does take care of the proper quoting of fields with comma or
quotes."
(orgtbl-to-generic table (org-combine-plists
'(:sep "," :fmt org-quote-csv-field)
params)))
so these are mandatory. I guess I do not understand what you are
saying.
Best wishes
- Carsten
[Orgmode] Re: [PATCH] quote the real csv separator, Sébastien Vauban, 2010/10/25