emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Tables: Exclude headings in Row Number?
@ 2019-09-18 17:07 Nathan Neff
  2019-09-19 14:13 ` Neil Jerram
  0 siblings, 1 reply; 5+ messages in thread
From: Nathan Neff @ 2019-09-18 17:07 UTC (permalink / raw)
  To: emacs-orgmode

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

Hello all,

I have a table like this:


| ID |
|----|
|  2 |
|  3 |

and I want to know how many rows there are w/o the ID heading
and w/o the horizontal separator.  I found the
org-table-toggle-coordinate-overlays
which displays an overlay showing the row number:

https://www.evernote.com/l/AOJvD5ty6RRIBYAcSWV-047CKCHT5NIAhl8

However, the heading is included in the row number (which makes sense).

Is there a way to ignore lines above a heading (or mark a heading in some
way?

I found a way to add a seq. number by using Calc [1] but I was wondering if
there's a way to tell the org-table-toggle-coordinate-overlays not to count
the
heading.

Thanks,
--Nate

[1]


| num | ID |
|-----+----|
|   1 | A  |
|   2 | B  |
|   3 | C  |
|   4 |    |
|   5 | E  |
#+TBLFM: $1=vlen(@I..0)

https://stackoverflow.com/questions/9267050/how-to-achieve-a-row-index-column-in-emacs-org-mode-using-a-calc-column-rule

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

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

* Re: Tables: Exclude headings in Row Number?
  2019-09-18 17:07 Tables: Exclude headings in Row Number? Nathan Neff
@ 2019-09-19 14:13 ` Neil Jerram
  2019-09-23  3:22   ` Nathan Neff
  0 siblings, 1 reply; 5+ messages in thread
From: Neil Jerram @ 2019-09-19 14:13 UTC (permalink / raw)
  To: Nathan Neff; +Cc: emacs-orgmode

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

Does this answer your question?

#+NAME: tt
| num | ID |
|-----+----|
|   1 | A  |
|   2 | B  |
|   3 | C  |
|   4 |    |
|   5 | E  |

#+BEGIN_SRC emacs-lisp :var tt=tt
(length tt)
#+END_SRC

#+RESULTS:
: 5

Best wishes,
    Neil


On Wed, 18 Sep 2019 at 18:39, Nathan Neff <nathan.neff@gmail.com> wrote:

> Hello all,
>
> I have a table like this:
>
>
> | ID |
> |----|
> |  2 |
> |  3 |
>
> and I want to know how many rows there are w/o the ID heading
> and w/o the horizontal separator.  I found the
> org-table-toggle-coordinate-overlays
> which displays an overlay showing the row number:
>
> https://www.evernote.com/l/AOJvD5ty6RRIBYAcSWV-047CKCHT5NIAhl8
>
> However, the heading is included in the row number (which makes sense).
>
> Is there a way to ignore lines above a heading (or mark a heading in some
> way?
>
> I found a way to add a seq. number by using Calc [1] but I was wondering if
> there's a way to tell the org-table-toggle-coordinate-overlays not to
> count the
> heading.
>
> Thanks,
> --Nate
>
> [1]
>
>
> | num | ID |
> |-----+----|
> |   1 | A  |
> |   2 | B  |
> |   3 | C  |
> |   4 |    |
> |   5 | E  |
> #+TBLFM: $1=vlen(@I..0)
>
>
> https://stackoverflow.com/questions/9267050/how-to-achieve-a-row-index-column-in-emacs-org-mode-using-a-calc-column-rule
>
>
>

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

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

* Re: Tables: Exclude headings in Row Number?
  2019-09-19 14:13 ` Neil Jerram
@ 2019-09-23  3:22   ` Nathan Neff
  2019-09-23  3:24     ` Nathan Neff
  0 siblings, 1 reply; 5+ messages in thread
From: Nathan Neff @ 2019-09-23  3:22 UTC (permalink / raw)
  To: Neil Jerram; +Cc: emacs-orgmode

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

Hi Neil,

Unfortunately, no - This code will print the number of rows in my table -
it does
not add a column to my table, with numbering starting at the first row
under the
headline.

I really like the example, where I can mess with the table using lisp
though - thank
you!
--Nate

On Thu, Sep 19, 2019 at 9:13 AM Neil Jerram <neiljerram@gmail.com> wrote:

> Does this answer your question?
>
> #+NAME: tt
> | num | ID |
> |-----+----|
> |   1 | A  |
> |   2 | B  |
> |   3 | C  |
> |   4 |    |
> |   5 | E  |
>
> #+BEGIN_SRC emacs-lisp :var tt=tt
> (length tt)
> #+END_SRC
>
> #+RESULTS:
> : 5
>
> Best wishes,
>     Neil
>
>
> On Wed, 18 Sep 2019 at 18:39, Nathan Neff <nathan.neff@gmail.com> wrote:
>
>> Hello all,
>>
>> I have a table like this:
>>
>>
>> | ID |
>> |----|
>> |  2 |
>> |  3 |
>>
>> and I want to know how many rows there are w/o the ID heading
>> and w/o the horizontal separator.  I found the
>> org-table-toggle-coordinate-overlays
>> which displays an overlay showing the row number:
>>
>> https://www.evernote.com/l/AOJvD5ty6RRIBYAcSWV-047CKCHT5NIAhl8
>>
>> However, the heading is included in the row number (which makes sense).
>>
>> Is there a way to ignore lines above a heading (or mark a heading in some
>> way?
>>
>> I found a way to add a seq. number by using Calc [1] but I was wondering
>> if
>> there's a way to tell the org-table-toggle-coordinate-overlays not to
>> count the
>> heading.
>>
>> Thanks,
>> --Nate
>>
>> [1]
>>
>>
>> | num | ID |
>> |-----+----|
>> |   1 | A  |
>> |   2 | B  |
>> |   3 | C  |
>> |   4 |    |
>> |   5 | E  |
>> #+TBLFM: $1=vlen(@I..0)
>>
>>
>> https://stackoverflow.com/questions/9267050/how-to-achieve-a-row-index-column-in-emacs-org-mode-using-a-calc-column-rule
>>
>>
>>

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

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

* Re: Tables: Exclude headings in Row Number?
  2019-09-23  3:22   ` Nathan Neff
@ 2019-09-23  3:24     ` Nathan Neff
  2019-09-27  0:45       ` Neil Jerram
  0 siblings, 1 reply; 5+ messages in thread
From: Nathan Neff @ 2019-09-23  3:24 UTC (permalink / raw)
  To: Neil Jerram; +Cc: emacs-orgmode

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

I also re-read my initial question and your response *does* address my
mis phrased question.  To rephrase my question, I have a table
with these values:

| heading col 0  | heading col 1 |
| ------------------ | ----------------- |
| A                   | B
| C                  | D

I found the org-table-toggle-coordinate-overlays
which displays an overlay showing the row number:

https://www.evernote.com/l/AOJvD5ty6RRIBYAcSWV-047CKCHT5NIAhl8

I would like to know if there's a way to influence
org-table-toggle-coordinate-overlays
(e.g. some flag like "don't count rows before headings")

Thanks,
--Nate






On Sun, Sep 22, 2019 at 10:22 PM Nathan Neff <nathan.neff@gmail.com> wrote:

> Hi Neil,
>
> Unfortunately, no - This code will print the number of rows in my table -
> it does
> not add a column to my table, with numbering starting at the first row
> under the
> headline.
>
> I really like the example, where I can mess with the table using lisp
> though - thank
> you!
> --Nate
>
> On Thu, Sep 19, 2019 at 9:13 AM Neil Jerram <neiljerram@gmail.com> wrote:
>
>> Does this answer your question?
>>
>> #+NAME: tt
>> | num | ID |
>> |-----+----|
>> |   1 | A  |
>> |   2 | B  |
>> |   3 | C  |
>> |   4 |    |
>> |   5 | E  |
>>
>> #+BEGIN_SRC emacs-lisp :var tt=tt
>> (length tt)
>> #+END_SRC
>>
>> #+RESULTS:
>> : 5
>>
>> Best wishes,
>>     Neil
>>
>>
>> On Wed, 18 Sep 2019 at 18:39, Nathan Neff <nathan.neff@gmail.com> wrote:
>>
>>> Hello all,
>>>
>>> I have a table like this:
>>>
>>>
>>> | ID |
>>> |----|
>>> |  2 |
>>> |  3 |
>>>
>>> and I want to know how many rows there are w/o the ID heading
>>> and w/o the horizontal separator.  I found the
>>> org-table-toggle-coordinate-overlays
>>> which displays an overlay showing the row number:
>>>
>>> https://www.evernote.com/l/AOJvD5ty6RRIBYAcSWV-047CKCHT5NIAhl8
>>>
>>> However, the heading is included in the row number (which makes sense).
>>>
>>> Is there a way to ignore lines above a heading (or mark a heading in
>>> some way?
>>>
>>> I found a way to add a seq. number by using Calc [1] but I was wondering
>>> if
>>> there's a way to tell the org-table-toggle-coordinate-overlays not to
>>> count the
>>> heading.
>>>
>>> Thanks,
>>> --Nate
>>>
>>> [1]
>>>
>>>
>>> | num | ID |
>>> |-----+----|
>>> |   1 | A  |
>>> |   2 | B  |
>>> |   3 | C  |
>>> |   4 |    |
>>> |   5 | E  |
>>> #+TBLFM: $1=vlen(@I..0)
>>>
>>>
>>> https://stackoverflow.com/questions/9267050/how-to-achieve-a-row-index-column-in-emacs-org-mode-using-a-calc-column-rule
>>>
>>>
>>>

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

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

* Re: Tables: Exclude headings in Row Number?
  2019-09-23  3:24     ` Nathan Neff
@ 2019-09-27  0:45       ` Neil Jerram
  0 siblings, 0 replies; 5+ messages in thread
From: Neil Jerram @ 2019-09-27  0:45 UTC (permalink / raw)
  To: Nathan Neff; +Cc: emacs-orgmode

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

Well, the code for this is in `org-table-overlay-coordinate-overlays' in
org-table.el.  There isn't an existing flag for your request, but of course
you can play with that code as you like.

For example, if the `(setq ih (1+ ih))' is changed to `(setq id 0 ih (1+
ih))', the row numbers will start again from 1 after each hline.

Best wishes,
    Neil


On Mon, 23 Sep 2019 at 04:24, Nathan Neff <nathan.neff@gmail.com> wrote:

> I also re-read my initial question and your response *does* address my
> mis phrased question.  To rephrase my question, I have a table
> with these values:
>
> | heading col 0  | heading col 1 |
> | ------------------ | ----------------- |
> | A                   | B
> | C                  | D
>
> I found the org-table-toggle-coordinate-overlays
> which displays an overlay showing the row number:
>
> https://www.evernote.com/l/AOJvD5ty6RRIBYAcSWV-047CKCHT5NIAhl8
>
> I would like to know if there's a way to influence
> org-table-toggle-coordinate-overlays
> (e.g. some flag like "don't count rows before headings")
>
> Thanks,
> --Nate
>
>
>
>
>
>
> On Sun, Sep 22, 2019 at 10:22 PM Nathan Neff <nathan.neff@gmail.com>
> wrote:
>
>> Hi Neil,
>>
>> Unfortunately, no - This code will print the number of rows in my table -
>> it does
>> not add a column to my table, with numbering starting at the first row
>> under the
>> headline.
>>
>> I really like the example, where I can mess with the table using lisp
>> though - thank
>> you!
>> --Nate
>>
>> On Thu, Sep 19, 2019 at 9:13 AM Neil Jerram <neiljerram@gmail.com> wrote:
>>
>>> Does this answer your question?
>>>
>>> #+NAME: tt
>>> | num | ID |
>>> |-----+----|
>>> |   1 | A  |
>>> |   2 | B  |
>>> |   3 | C  |
>>> |   4 |    |
>>> |   5 | E  |
>>>
>>> #+BEGIN_SRC emacs-lisp :var tt=tt
>>> (length tt)
>>> #+END_SRC
>>>
>>> #+RESULTS:
>>> : 5
>>>
>>> Best wishes,
>>>     Neil
>>>
>>>
>>> On Wed, 18 Sep 2019 at 18:39, Nathan Neff <nathan.neff@gmail.com> wrote:
>>>
>>>> Hello all,
>>>>
>>>> I have a table like this:
>>>>
>>>>
>>>> | ID |
>>>> |----|
>>>> |  2 |
>>>> |  3 |
>>>>
>>>> and I want to know how many rows there are w/o the ID heading
>>>> and w/o the horizontal separator.  I found the
>>>> org-table-toggle-coordinate-overlays
>>>> which displays an overlay showing the row number:
>>>>
>>>> https://www.evernote.com/l/AOJvD5ty6RRIBYAcSWV-047CKCHT5NIAhl8
>>>>
>>>> However, the heading is included in the row number (which makes sense).
>>>>
>>>> Is there a way to ignore lines above a heading (or mark a heading in
>>>> some way?
>>>>
>>>> I found a way to add a seq. number by using Calc [1] but I was
>>>> wondering if
>>>> there's a way to tell the org-table-toggle-coordinate-overlays not to
>>>> count the
>>>> heading.
>>>>
>>>> Thanks,
>>>> --Nate
>>>>
>>>> [1]
>>>>
>>>>
>>>> | num | ID |
>>>> |-----+----|
>>>> |   1 | A  |
>>>> |   2 | B  |
>>>> |   3 | C  |
>>>> |   4 |    |
>>>> |   5 | E  |
>>>> #+TBLFM: $1=vlen(@I..0)
>>>>
>>>>
>>>> https://stackoverflow.com/questions/9267050/how-to-achieve-a-row-index-column-in-emacs-org-mode-using-a-calc-column-rule
>>>>
>>>>
>>>>

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

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

end of thread, other threads:[~2019-09-27  0:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-18 17:07 Tables: Exclude headings in Row Number? Nathan Neff
2019-09-19 14:13 ` Neil Jerram
2019-09-23  3:22   ` Nathan Neff
2019-09-23  3:24     ` Nathan Neff
2019-09-27  0:45       ` Neil Jerram

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