emacs-orgmode
[Top][All Lists]
Advanced

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

[O] Re: [babel] How to kill two birds with one stone?


From: Sébastien Vauban
Subject: [O] Re: [babel] How to kill two birds with one stone?
Date: Mon, 28 Feb 2011 14:59:39 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (windows-nt)

Hi Nick,

Nick Dokos wrote:
> Sébastien Vauban <address@hidden> wrote:
>> My code was a bit more complex... because I need to be able to correctly
>> take care of filenames containing spaces inside them (I'm on Windows, I
>> never do such a thing, but there are well spaces on the files I wanna
>> graph).
>> 
>> #+results: graph-files-seb
>> | dan   |         |
>> | eric  |         |
>> | other |         |
>> | "seb  | vauban" |
>
> I suspect that this is a losing battle: spaces in filenames are legal, they
> are common on Windows systems, but they are a PITA. The main reason is that
> a *lot* of tools (particularly Unix tools of a certain age) assume that
> spaces in filenames will not occur and break in mysterious and unexpected
> ways when presented with a directory structure that contains such.
>
> There are various workarounds (the most important of which, practically
> speaking, is the idiom
>
>    find ... -print0 | xargs -0 ....
>
> which causes ``find'' to use a null byte as a separator and ``xargs'' to
> search for same in order to split the list into its constituent components -
> null bytes being illegal in filenames), and there is a long, fairly
> exhaustive discusssion of such matters in David Wheeler's enlightening
> essay:
>
>    http://www.dwheeler.com/essays/fixing-unix-linux-filenames.html
>
> but none of these would help in this case, because the culprit here turns
> out to be org-table-convert-region:
>
> ,----
> | (org-table-convert-region BEG0 END0 &optional SEPARATOR)
> | 
> | Convert region to a table.
> | SEPARATOR specifies the field separator in the lines.  It can have the
> | following values:
> | 
> | '(4)     Use the comma as a field separator
> | '(16)    Use a TAB as field separator
> | integer  When a number, use that many spaces as field separator
> | nil      When nil, the command tries to be smart and figure out the
> |          separator in the following way:
> |          - when each line contains a TAB, assume TAB-separated material
> |          - when each line contains a comma, assume CSV material
> |          - else, assume one or more SPACE characters as separator.
> `----
>
> It is called with a nil separator so it uses its "smart" mode and counts one
> or more whitespace characters as the separator (I wonder what would happen
> with a filename that contains a comma :-)
>
> In any case, the region has the filenames one per line, so if
> org-table-convert-region could parse a newline-separated list (and if there
> was a way to specify the newline separator from higher levels) everything
> would be hunky dory; there might be a way to specify the separator using
> dynamic scoping, but org-table-convert-region would require some changes to
> take advantage of it.

If I follow you correctly, another approach would be to enhance
`org-table-convert-region' so that it could take `\0' as field separator?

Best regards,
  Seb

-- 
Sébastien Vauban




reply via email to

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