unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* auto incremental columns in table of org-mode?
@ 2008-03-17 19:11 poppyer
  2008-03-17 21:04 ` Stefan Reichör
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: poppyer @ 2008-03-17 19:11 UTC (permalink / raw)
  To: help-gnu-emacs

Hi, guys,


I am using orgtbl-mode minor mode, basically as following:

| k |   n | f(n,k) |
|---+-----+--------|
| 1 | 100 |        |
| 2 |     |        |
| 3 |     |        |
|   |     |        |
|   |     |        |
|   |     |        |

My question is how can I fill the k column when I add rows?

cheers,
poppyer

-- 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: auto incremental columns in table of org-mode?
  2008-03-17 19:11 auto incremental columns in table of org-mode? poppyer
@ 2008-03-17 21:04 ` Stefan Reichör
  2008-03-18 15:36 ` Bastien
       [not found] ` <mailman.9096.1205854612.18990.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 11+ messages in thread
From: Stefan Reichör @ 2008-03-17 21:04 UTC (permalink / raw)
  To: help-gnu-emacs

Hi poppyer!

> Hi, guys,
>
>
> I am using orgtbl-mode minor mode, basically as following:
>
> | k |   n | f(n,k) |
> |---+-----+--------|
> | 1 | 100 |        |
> | 2 |     |        |
> | 3 |     |        |
> |   |     |        |
> |   |     |        |
> |   |     |        |
>
> My question is how can I fill the k column when I add rows?

I would do it via cua rectangles:

C-RET               : start a rectangle
down, down,...      : extend the rectangle selection
M-n                 : run cua-sequence-rectangle
4 RET               : start with 4
RET                 : increment by 1 (default)
RET                 : use default format (%d)

done :-)


Stefan.

-- 
Posted via a free Usenet account from http://www.teranews.com



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: auto incremental columns in table of org-mode?
  2008-03-17 19:11 auto incremental columns in table of org-mode? poppyer
  2008-03-17 21:04 ` Stefan Reichör
@ 2008-03-18 15:36 ` Bastien
       [not found] ` <mailman.9096.1205854612.18990.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 11+ messages in thread
From: Bastien @ 2008-03-18 15:36 UTC (permalink / raw)
  To: poppyer; +Cc: help-gnu-emacs

poppyer <poppyer@gmail.com> writes:

> I am using orgtbl-mode minor mode, basically as following:
>
> | k |   n | f(n,k) |
> |---+-----+--------|
> | 1 | 100 |        |
> | 2 |     |        |
> | 3 |     |        |
> |   |     |        |
> |   |     |        |
> |   |     |        |
>
> My question is how can I fill the k column when I add rows?

I would define a formula for this table.

#+TBLFM: $1='(1+ @-1);N

This basically says: for the each cell in the first column, compute the
value of the cell by adding 1 to the value of the cell above.

Use C-c * or C-u C-c to re-compute the values in this column.

-- 
Bastien




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: auto incremental columns in table of org-mode?
       [not found] ` <mailman.9096.1205854612.18990.help-gnu-emacs@gnu.org>
@ 2008-03-18 20:57   ` poppyer
  2008-03-18 22:24     ` Bastien
                       ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: poppyer @ 2008-03-18 20:57 UTC (permalink / raw)
  To: help-gnu-emacs


Bastien <bzg@altern.org> writes:

> poppyer <poppyer@gmail.com> writes:
>
>> I am using orgtbl-mode minor mode, basically as following:
>>
>> | k |   n | f(n,k) |
>> |---+-----+--------|
>> | 1 | 100 |        |
>> | 2 |     |        |
>> | 3 |     |        |
>> |   |     |        |
>> |   |     |        |
>> |   |     |        |
>>
>> My question is how can I fill the k column when I add rows?
>
> I would define a formula for this table.
>
> #+TBLFM: $1='(1+ @-1);N
>
> This basically says: for the each cell in the first column, compute the
> value of the cell by adding 1 to the value of the cell above.

I am using similar $1=@-1+1;N
The problem is, it works at the first time. But every time you use C-u
C-c C-c to update the whole table. The whole $1 column increase by 1.
i.e. "1 2 3 ... " ===> "2 3 4 ..."
Any idea to exclude the first "1" without being updated?

Thanks,
poppyer

>
> Use C-c * or C-u C-c to re-compute the values in this column.

-- 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: auto incremental columns in table of org-mode?
  2008-03-18 20:57   ` poppyer
@ 2008-03-18 22:24     ` Bastien
       [not found]     ` <mailman.9111.1205879059.18990.help-gnu-emacs@gnu.org>
  2008-03-19  9:52     ` drostekirsten
  2 siblings, 0 replies; 11+ messages in thread
From: Bastien @ 2008-03-18 22:24 UTC (permalink / raw)
  To: poppyer; +Cc: help-gnu-emacs

poppyer <poppyer@gmail.com> writes:

>> This basically says: for the each cell in the first column, compute the
>> value of the cell by adding 1 to the value of the cell above.
>
> I am using similar $1=@-1+1;N
                             ^^

(The ;N is not required here, this is for Calc formulas only.)

> The problem is, it works at the first time. But every time you use C-u
> C-c C-c to update the whole table. The whole $1 column increase by 1.
> i.e. "1 2 3 ... " ===> "2 3 4 ..."

Yes, that's a problem.  This is because when looking for a relative
reference, if Org encounters a non-number row, it falls back on the next
row in the same column...  I'll send a bug report to Carsten for this.

> Any idea to exclude the first "1" without being updated?

If you don't really need to compute the first column you can always 
use a dummy macro like this one:

C-a f3 | C-xC-kC-i | | C-j f4

Then use it with C-x e e e e as many times as you want rows...  

HTH,

-- 
Bastien




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: auto incremental columns in table of org-mode?
       [not found]     ` <mailman.9111.1205879059.18990.help-gnu-emacs@gnu.org>
@ 2008-03-19  2:44       ` poppyer
  2008-03-19  3:44         ` Bastien
       [not found]         ` <mailman.9151.1205898289.18990.help-gnu-emacs@gnu.org>
  2008-03-19  9:55       ` drostekirsten
  1 sibling, 2 replies; 11+ messages in thread
From: poppyer @ 2008-03-19  2:44 UTC (permalink / raw)
  To: help-gnu-emacs


Bastien <bzg@altern.org> writes:

>> The problem is, it works at the first time. But every time you use C-u
>> C-c C-c to update the whole table. The whole $1 column increase by 1.
>> i.e. "1 2 3 ... " ===> "2 3 4 ..."
>
> Yes, that's a problem.  This is because when looking for a relative
> reference, if Org encounters a non-number row, it falls back on the next
> row in the same column...  I'll send a bug report to Carsten for this.
>

I see. Another related question is: can I set a "partial" column/row
formula? such as @2$1..$1=@-1+1 ? It is not working here.

cheers,
poppyer



-- 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: auto incremental columns in table of org-mode?
  2008-03-19  2:44       ` poppyer
@ 2008-03-19  3:44         ` Bastien
       [not found]         ` <mailman.9151.1205898289.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 11+ messages in thread
From: Bastien @ 2008-03-19  3:44 UTC (permalink / raw)
  To: help-gnu-emacs

poppyer <poppyer@gmail.com> writes:

> I see. Another related question is: can I set a "partial" column/row
> formula? such as @2$1..$1=@-1+1 ? It is not working here.

What is this supposed to do?

-- 
Bastien




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: auto incremental columns in table of org-mode?
       [not found]         ` <mailman.9151.1205898289.18990.help-gnu-emacs@gnu.org>
@ 2008-03-19  7:24           ` poppyer
  0 siblings, 0 replies; 11+ messages in thread
From: poppyer @ 2008-03-19  7:24 UTC (permalink / raw)
  To: help-gnu-emacs


Bastien <bzg@altern.org> writes:

> poppyer <poppyer@gmail.com> writes:
>
>> I see. Another related question is: can I set a "partial" column/row
>> formula? such as @2$1..$1=@-1+1 ? It is not working here.
>
> What is this supposed to do?

basically what i want is to set a formula for a "range" of cells,
say @2$1..@END$1, rather than for an entire column or row.

poppyer

-- 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: auto incremental columns in table of org-mode?
  2008-03-18 20:57   ` poppyer
  2008-03-18 22:24     ` Bastien
       [not found]     ` <mailman.9111.1205879059.18990.help-gnu-emacs@gnu.org>
@ 2008-03-19  9:52     ` drostekirsten
  2 siblings, 0 replies; 11+ messages in thread
From: drostekirsten @ 2008-03-19  9:52 UTC (permalink / raw)
  To: help-gnu-emacs

On Mar 18, 9:57 pm, poppyer <popp...@gmail.com> wrote:
> Bastien <b...@altern.org> writes:
> > poppyer <popp...@gmail.com> writes:
>
> >> I am using orgtbl-mode minor mode, basically as following:
>
> >> | k |   n | f(n,k) |
> >> |---+-----+--------|
> >> | 1 | 100 |        |
> >> | 2 |     |        |
> >> | 3 |     |        |
> >> |   |     |        |
> >> |   |     |        |
> >> |   |     |        |
>
> >> My question is how can I fill the k column when I add rows?
>
> > I would define a formula for this table.
>
> > #+TBLFM: $1='(1+ @-1);N
>
> > This basically says: for the each cell in the first column, compute the
> > value of the cell by adding 1 to the value of the cell above.
>
> I am using similar $1=@-1+1;N
> The problem is, it works at the first time. But every time you use C-u
> C-c C-c to update the whole table. The whole $1 column increase by 1.
> i.e. "1 2 3 ... " ===> "2 3 4 ..."
> Any idea to exclude the first "1" without being updated?
>

Yes, by defining a field formula for just this field:

#+TBLFM: $1=@-1+1::@2$1=1

Field formulas overrule column formulas.

- Carsten


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: auto incremental columns in table of org-mode?
       [not found]     ` <mailman.9111.1205879059.18990.help-gnu-emacs@gnu.org>
  2008-03-19  2:44       ` poppyer
@ 2008-03-19  9:55       ` drostekirsten
  2008-03-19 14:00         ` poppyer
  1 sibling, 1 reply; 11+ messages in thread
From: drostekirsten @ 2008-03-19  9:55 UTC (permalink / raw)
  To: help-gnu-emacs

On Mar 18, 11:24 pm, Bastien <b...@altern.org> wrote:
> poppyer <popp...@gmail.com> writes:
> >> This basically says: for the each cell in the first column, compute the
> >> value of the cell by adding 1 to the value of the cell above.
>
> > I am using similar $1=@-1+1;N
>
>                              ^^
>
> (The ;N is not required here, this is for Calc formulas only.)
>
> > The problem is, it works at the first time. But every time you use C-u
> > C-c C-c to update the whole table. The whole $1 column increase by 1.
> > i.e. "1 2 3 ... " ===> "2 3 4 ..."
>
> Yes, that's a problem.  This is because when looking for a relative
> reference, if Org encounters a non-number row, it falls back on the next
> row in the same column...  I'll send a bug report to Carsten for this.
>
> > Any idea to exclude the first "1" without being updated?
>
> If you don't really need to compute the first column you can always
> use a dummy macro like this one:
>
> C-a f3 | C-xC-kC-i | | C-j f4
>
> Then use it with C-x e e e e as many times as you want rows...

Even easier is this:

Put a 1 into the first field, and press S-RET to fill the column with
increasing numbers.
As Bastien says, this will not recompute when you add or remove lines.

- Carsten


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: auto incremental columns in table of org-mode?
  2008-03-19  9:55       ` drostekirsten
@ 2008-03-19 14:00         ` poppyer
  0 siblings, 0 replies; 11+ messages in thread
From: poppyer @ 2008-03-19 14:00 UTC (permalink / raw)
  To: help-gnu-emacs


>> If you don't really need to compute the first column you can always
>> use a dummy macro like this one:
>>
>> C-a f3 | C-xC-kC-i | | C-j f4
>>
>> Then use it with C-x e e e e as many times as you want rows...
>
> Even easier is this:
>
> Put a 1 into the first field, and press S-RET to fill the column with
> increasing numbers.
> As Bastien says, this will not recompute when you add or remove lines.
>
> - Carsten

Wah! this is so COOL!
Definitely should add it to the documentation.

poppyer
-- 


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-03-19 14:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-17 19:11 auto incremental columns in table of org-mode? poppyer
2008-03-17 21:04 ` Stefan Reichör
2008-03-18 15:36 ` Bastien
     [not found] ` <mailman.9096.1205854612.18990.help-gnu-emacs@gnu.org>
2008-03-18 20:57   ` poppyer
2008-03-18 22:24     ` Bastien
     [not found]     ` <mailman.9111.1205879059.18990.help-gnu-emacs@gnu.org>
2008-03-19  2:44       ` poppyer
2008-03-19  3:44         ` Bastien
     [not found]         ` <mailman.9151.1205898289.18990.help-gnu-emacs@gnu.org>
2008-03-19  7:24           ` poppyer
2008-03-19  9:55       ` drostekirsten
2008-03-19 14:00         ` poppyer
2008-03-19  9:52     ` drostekirsten

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).