From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Re: org table with auto-incrementing numbers in a column Date: Tue, 16 Feb 2016 11:28:08 -0500 Message-ID: References: <87ziv1rn6q.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c30c2cc5e255052be5a054 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40658) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aViUs-0001Zx-BR for emacs-orgmode@gnu.org; Tue, 16 Feb 2016 11:29:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aViUq-0005aL-W8 for emacs-orgmode@gnu.org; Tue, 16 Feb 2016 11:29:06 -0500 Received: from mail-ob0-x231.google.com ([2607:f8b0:4003:c01::231]:35060) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aViUq-0005aE-PL for emacs-orgmode@gnu.org; Tue, 16 Feb 2016 11:29:04 -0500 Received: by mail-ob0-x231.google.com with SMTP id xk3so265143920obc.2 for ; Tue, 16 Feb 2016 08:29:04 -0800 (PST) In-Reply-To: <87ziv1rn6q.fsf@ucl.ac.uk> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Derek Feichtinger , emacs-org list --001a11c30c2cc5e255052be5a054 Content-Type: text/plain; charset=UTF-8 Thanks everyone for replying! I made one mistake before posting that question: I should have looked up C-h f org-table-recalculate. And now I did :) I should have done "C-u C-c * " when the point was in the table (I was doing just C-c *, which evaluates only the current row). >> Derek > | N | | > |---+---| > | | | > | | | > | | | > | | | > #+TBLFM: @3$1..@>$1=@-1 + 1::@2$1=1 Thanks Derek! That worked! btw I was a bit perplexed looking at your solution because it showed "" instead of "@" :) > One problem is that $1 also includes the first row with the "N" heading. > that is why in your example the second and third lines both will at first > contain 1 (at least with my org version 8.3.3), and in the second iteration > only show the correct series. I just learned that doing "C-u C-u C-c C-c" or "C-u C-u C-c *" with the point anywhere on the table, keeps re-evaluating the whole table till the values are stable. (NOTE that these do not work when point is on the #+TBLFM line; the point HAS to be inside the table). So the original example also works just fine if I use C-u C-u C-c C-c | N | | |---+---| | | | | | | | | | | | | #+TBLFM: $1=@-1+1::@2$1=1 >> Dieter Thanks! Your solution works too, with C-u C-c C-c anywhere in the table. | N | |---| | | | | | | | | #+TBLFM: $1=@#-1 That said, can someone please update that FAQ at http://orgmode.org/worg/org-faq.html#fill-table-column-with-incremental-numbers It would be great to mention C-u C-c C-c and C-u C-u C-c C-c in that solution too. --001a11c30c2cc5e255052be5a054 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thanks everyone for replying!

I made = one mistake before posting that question: I should have looked up C-h f org= -table-recalculate. And now I did :)
I shou= ld have done "C-u C-c * " when the point was in the table (I was = doing just C-c *, which evaluates only the current row).

>> Derek
> | N | =C2=A0 |
=
> |---+---|
&= gt; | =C2=A0 | =C2=A0 |
> | =C2=A0 | =C2= =A0 |
> | =C2=A0 | =C2=A0 |
> | =C2=A0 | =C2=A0 |
> #+TBLFM: @3$1..@>$1=3D@-1 + 1::@2$1=3D1

= Thanks Derek! That worked! btw I was a bit perplexed looking at your soluti= on because it showed "<at>" instead of "@" :)

> One problem is = that $1 also includes the first row with the "N" heading.<= br style=3D"font-size:12.8px">> that is= why in your example the second and third lines both will at first> contain = 1 (at least with my org version 8.3.3), and in the second iteration<= br style=3D"font-size:12.8px">> only sh= ow the correct series.

I just learned tha= t doing "C-u C-u C-c C-c" or "C-u C-u C-c *" with the p= oint anywhere on the table, keeps re-evaluating the whole table till the va= lues are stable. (NOTE that these do not work when point is on the #+TBLFM = line; the point HAS to be inside the table).

So the original example also works just fine if I use C-u C-u C-c C-c

| N | =C2=A0 |
|---+---|
| =C2=A0 | =C2=A0 |
| =C2=A0 | =C2=A0 |
| =C2=A0 | =C2=A0 |
| =C2=A0 | =C2=A0= |
#+TBLFM: $1= =3D@-1+1::@2$1=3D1

>> Dieter

Thanks! Your soluti= on works too, with C-u C-c C-c anywhere in the table.

| N |
|---|
| =C2=A0 |
|= =C2=A0 |
| =C2=A0 |
| =C2=A0 |
#+TBL= FM: $1=3D@#-1

That said, can someone please update that FAQ= at=C2=A0http://orgmode.org/worg/org-faq.html#fill-table-c= olumn-with-incremental-numbers
It would be great to me= ntion C-u C-c C-c and C-u C-u C-c C-c in that solution too.
--001a11c30c2cc5e255052be5a054--