emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [RFC] The "c" Org macro


From: Kaushal Modi
Subject: Re: [O] [RFC] The "c" Org macro
Date: Mon, 22 May 2017 03:24:09 +0000

On Sun, May 21, 2017 at 9:38 AM Nicolas Goaziou <address@hidden> wrote:
Here is the last update, with tests and an ORG-NEWS entry. Noteworthy
change: the "c" macro is now the "n" macro.

If there are no objection nor additional suggestions, I will push it to
master in a couple of days.

Thanks. I tried it out and it works great, except for one issue I came across.

If the n macro is at the BOL, followed by a period, the counter value resets to 1 even when that macro is specifying the counter value.

Here is the full MWE:

#+TITLE: ={{{n}}}= macro

* This works
Some text /plus/ counter on the same line, no trailing period.

Foo {{{n(a, 7463)}}}
* This works
Counter at BOL, no trailing period.

Foo
{{{n(a, 7463)}}}
* This works
Some text /plus/ counter on the same line, *with* trailing period.

Foo {{{n(a, 7463)}}}.
* This *does not* work
Counter at BOL, *with* trailing period.

Foo
{{{n(a, 7463)}}}.
** How I discovered this scenario
I ended up with this scenario because of this example I was playing
with:
#+BEGIN_SRC org
# -*- fill-column: 70; eval: (auto-fill-mode 1) -*-
The counter starts by default at the value of {{{n}}}. This will be
the next value {{{n}}}, and this will be next {{{n}}}... Now this will
back to the reset value: {{{n(, reset)}}}.

If I wish, I can set that counter value to anything I want, like 7463:
{{{n(, 7463)}}}.

Here is how I can keep multiple counters counting independent of each
other. Each column is running an independent counter. The counter in
first column is initialized to 123, the one in second column to 456,
and the one in third column to 789.. and then they keep on incrementing
the count by 1 in their respective columns:

| n1               | n2               | n3               |
|------------------+------------------+------------------|
| {{{n(n1, 123)}}} | {{{n(n2, 456)}}} | {{{n(n3, 789)}}} |
| {{{n(n1)}}}      | {{{n(n2)}}}      | {{{n(n3)}}}      |
| {{{n(n1)}}}      | {{{n(n2)}}}      | {{{n(n3)}}}      |
| {{{n(n1)}}}      | {{{n(n2)}}}      | {{{n(n3)}}}      |
| {{{n(n1)}}}      | {{{n(n2)}}}      | {{{n(n3)}}}      |
#+END_SRC
 
--

Kaushal Modi


reply via email to

[Prev in Thread] Current Thread [Next in Thread]