emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: Derek Feichtinger <dfeich@gmail.com>,
	emacs-org list <emacs-orgmode@gnu.org>
Subject: Re: org table with auto-incrementing numbers in a column
Date: Tue, 16 Feb 2016 11:28:08 -0500	[thread overview]
Message-ID: <CAFyQvY1COQiR_Wh6W7_rThL5nkkcZrtKrgGHqZ6EDCamEYJeBg@mail.gmail.com> (raw)
In-Reply-To: <87ziv1rn6q.fsf@ucl.ac.uk>

[-- Attachment #1: Type: text/plain, Size: 1561 bytes --]

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 "<at>" 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.

[-- Attachment #2: Type: text/html, Size: 3759 bytes --]

      reply	other threads:[~2016-02-16 16:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-16  4:36 org table with auto-incrementing numbers in a column Kaushal Modi
2016-02-16  6:22 ` Derek Feichtinger
2016-02-16  7:24   ` H. Dieter Wilhelm
2016-02-16  9:16     ` Derek Feichtinger
2016-02-16 16:51       ` Nicolas Goaziou
2016-02-16  9:58   ` Eric S Fraga
2016-02-16 16:28     ` Kaushal Modi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFyQvY1COQiR_Wh6W7_rThL5nkkcZrtKrgGHqZ6EDCamEYJeBg@mail.gmail.com \
    --to=kaushal.modi@gmail.com \
    --cc=dfeich@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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).