Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to achieve a row index column in Emacs Org Mode using a Calc column rule

Tags:

emacs

org-mode

I would like to have a column in an org mode table that is a simple monotonically increasing value, i.e. the row number such that wnen I insert and remove random rows the index value adjusts automagically. I suspect that this should be simple but it would appear I am making it way too difficult. Mind you, I am a novice at using Emacs and org mode to build spreadsheets. So a simple example spreadsheet where there are two columns, one the row index value and the other some fixed value, would be a perfect answer.

like image 375
pajato0 Avatar asked Feb 13 '12 19:02

pajato0


People also ask

How do you make a table in Org mode?

The easiest way to create a table is to directly type the "|" character at the beginning of a line, or after any amount of white space. This will put you in the first field of an atomic table. Once you've finished editing this cell, you can jump to the next one by pressing TAB .

How do I use org Mode in Emacs?

To save the document, either press the save icon, or press C-x C-s, call it 1.org. Emacs does not actually understand you are editing an Org document, yet. To enable Org mode on your current document, type M-x org-mode which will enable the Org mode on the current document. Those are minuses, not underscores.

What are org mode files?

Org Mode (also: org-mode; /ˈɔːrɡ moʊd/) is a document editing, formatting, and organizing mode, designed for notes, planning, and authoring within the free software text editor Emacs.


1 Answers

This example uses @# to get the row number. Similarly, $# returns the column number.

| row | data |
|-----+------|
| 2   | 0303 |
| 3   | 5123 |
| 4   | 41   |
| 5   | 4234 |
#+TBLFM: $1=@#
like image 104
Juancho Avatar answered Oct 22 '22 16:10

Juancho