emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Bug in org-table-convert-region?


From: Sebastien Vauban
Subject: Re: [O] Bug in org-table-convert-region?
Date: Tue, 28 May 2013 11:28:20 +0200
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3 (windows-nt)

Thorsten,

Thorsten Jolitz wrote:
> "Sebastien Vauban" <address@hidden> writes:
>>>
>>> ,-----------------------------------------------------------------------
>>> | (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
>>> `-----------------------------------------------------------------------
>>> Looks like a bug in the argument handling?
>>
>> I don't have an answer, but one extra question (which popped up when
>> reading your analysis): how does Emacs see the difference between `C-u' and
>> `C-u 4'?
>>
>> That is, how to differentiate "Use the comma as a field separator" from
>> "Use 4 spaces as field separator"?
>
> The answer is here:
>
>>> and from the elisp manual:
>>>
>>> ,-----------------------------------------------------------------------
>>> | Here are the results of calling display-prefix with various raw prefix
>>> | arguments:
>>> |
>>> |      C-u     M-x display-prefix  -| (4)
>>> |      C-u C-u M-x display-prefix  -| (16)
>>> |      C-u 3   M-x display-prefix  -| 3
>>> `-----------------------------------------------------------------------

OK. I now understand that:

- `C-u' gives an list argument of '(4)
- `C-u 4' gives a numeric argument of 4

So, that's the way to distinguish them.

> ,---------------------------------------------------------
> | (org-table-convert-region BEG0 END0 &optional SEPARATOR)
> `---------------------------------------------------------
>
> with C-u M-x org-table-convert-region should be e.g.
>
> ,----------------------------------------
> | (org-table-convert-region 38  456 '(4))
> `----------------------------------------
>
> and C-u 3 M-x org-table-convert-region should be
>
> ,----------------------------------------
> | (org-table-convert-region 38  456 3)
> `----------------------------------------
>
> but I checked with edebug, its actually 
>
> ,----------------------------------------
> | (org-table-convert-region 38  456 nil)
> `----------------------------------------
>
> and "When nil, the command tries to be smart and figure out [itself]"
>
> So the problem seems to be that 'C-u 3' doesn't work as expected in my
> case. Could you check if it works for you?

I've considered the following table:

test a b c
test  a  b  c
test   a   b   c
test    a    b    c
test     a     b     c
test      a      b      c

and tried to convert it with various configs:

- M-x org-table-convert-region
- C-u M-x org-table-convert-region
- C-u 4 M-x org-table-convert-region
- C-u 3 M-x org-table-convert-region

In all cases, when evaluating `separator' under edebug, it showed me `nil',
and always converted the table into this:

| test | a | b | c |
| test | a | b | c |
| test | a | b | c |
| test | a | b | c |
| test | a | b | c |
| test | a | b | c |

So, `separator' seems never to get a correct value, and to be constantly be
equal to `nil'. Dunno why, though.

Do you confirm this as well?

Best regards,
  Seb

-- 
Sebastien Vauban




reply via email to

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