From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Re: [RFC] The "c" Org macro Date: Mon, 22 May 2017 03:24:09 +0000 Message-ID: References: <2ee94a64a94b46259b0da6e7d34675c9@HE1PR01MB1898.eurprd01.prod.exchangelabs.com> <87y3u7o3dj.fsf@t3610> <87pofjtk4b.fsf@t3610> <2069df8c23bc43f3b04b6e203b96be9d@HE1PR01MB1898.eurprd01.prod.exchangelabs.com> <87r2zvpyst.fsf@delle7240> <8760guib5i.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="f403045ff56829859c05501468c5" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58978) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dCdxI-0004MJ-9q for emacs-orgmode@gnu.org; Sun, 21 May 2017 23:24:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dCdxG-0001GC-RD for emacs-orgmode@gnu.org; Sun, 21 May 2017 23:24:24 -0400 Received: from mail-lf0-x22c.google.com ([2a00:1450:4010:c07::22c]:34079) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dCdxG-0001FW-Ck for emacs-orgmode@gnu.org; Sun, 21 May 2017 23:24:22 -0400 Received: by mail-lf0-x22c.google.com with SMTP id 99so23581320lfu.1 for ; Sun, 21 May 2017 20:24:22 -0700 (PDT) In-Reply-To: <8760guib5i.fsf@nicolasgoaziou.fr> 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" To: Nicolas Goaziou , emacs-orgmode@gnu.org --f403045ff56829859c05501468c5 Content-Type: text/plain; charset="UTF-8" On Sun, May 21, 2017 at 9:38 AM Nicolas Goaziou 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 --f403045ff56829859c05501468c5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sun, May 21= , 2017 at 9:38 AM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
Here is the last update, with tests and an ORG-NEWS entry. Notewort= hy
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 t= ried 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 c= ounter value resets to 1 even when that macro is specifying the counter val= ue.

Here is the full MWE:

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

* This works
Some text /plus/ counter on the same line, no trailing period.
Foo {{{n(a, 7463)}}}
* This works
Count= er at BOL, no trailing period.

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

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

Foo
{{{n(a, 7463)}}}.
** How I discovered this scenario
I ended up with this s= cenario because of this example I was playing
with:
#+B= EGIN_SRC org
# -*- fill-column: 70; eval: (auto-fill-mode 1) -*-<= /div>
The counter starts by default at the value of {{{n}}}. This will = be
the next value {{{n}}}, and this will be next {{{n}}}... Now t= his will
back to the reset value: {{{n(, reset)}}}.
If I wish, I can set that counter value to anything I want, lik= e 7463:
{{{n(, 7463)}}}.

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

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

Kaushal Modi

--f403045ff56829859c05501468c5--