From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [RFC] The "c" Org macro Date: Tue, 9 May 2017 09:35:01 +0200 Message-ID: References: <2ee94a64a94b46259b0da6e7d34675c9@HE1PR01MB1898.eurprd01.prod.exchangelabs.com> <87y3u7o3dj.fsf@t3610> <87pofjtk4b.fsf@t3610> <87bmr35lzs.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=94eb2c05e11efbe7c9054f12658c Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d7zg5-0006c3-6H for emacs-orgmode@gnu.org; Tue, 09 May 2017 03:35:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d7zg3-0004ZX-Nf for emacs-orgmode@gnu.org; Tue, 09 May 2017 03:35:25 -0400 Received: from mail-io0-x236.google.com ([2607:f8b0:4001:c06::236]:35950) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d7zg3-0004Z4-Jl for emacs-orgmode@gnu.org; Tue, 09 May 2017 03:35:23 -0400 Received: by mail-io0-x236.google.com with SMTP id o12so36671264iod.3 for ; Tue, 09 May 2017 00:35:23 -0700 (PDT) In-Reply-To: <87bmr35lzs.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 Cc: org-mode list --94eb2c05e11efbe7c9054f12658c Content-Type: text/plain; charset=UTF-8 Hi, I like the idea of these counters, and I have use-cases for them. Here is a proposal for the manual entry This macro implements custom counters by returning the number of times the macro has been expanded so far while exporting the buffer. You can create more than one counter using different @var{NAME} values. If @var{RESET} is non-empty, the specified counter is reset to the value specified if it is a number, or 1 otherwise. You may leave @var{NAME} empty to reset the default counter will be reset. A question regarding the last sentence of this proposed manual entry: is {{{c(,2)}}} allowed to reset the default counter? I think is should be, but I have not tested this. Carsten On Mon, May 8, 2017 at 6:52 PM, Nicolas Goaziou wrote: > Hello, > > Eric S Fraga writes: > > > On Monday, 8 May 2017 at 15:32, Dushyant Juneja wrote: > >> A very useful macro indeed! > >> > >> One suggestion: can this also be made to support nested headings. For > instance: > >> * Part {{{c}}} > >> ** Part {{{c}}}.{{{c}}} > >> * Part {{{c}}} > > > > I think this is what separate counters will enable but also motivates > > need to be able to reset a counter (e.g. the sub-heading one in above > > example if it were to be used in the second part). > > Good idea. > > Here is an updated patch, in which one can write > > {{{c(sub,reset)}}} > {{{c(sub, 5)}}} > > or even, for the default macro > > {{{c(,reset)}}} > {{{c(, 99)}}} > > I find the manual entry a bit awkward. Suggestions welcome. > > Regards, > > -- > Nicolas Goaziou > --94eb2c05e11efbe7c9054f12658c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

I like the idea of these counters, = and I have use-cases for them.

Here is a proposal = for the manual entry

This macro implements cu= stom counters by returning the number of times
the macro has been= expanded so far while exporting the buffer.
You can create more = than one counter using different @var{NAME} values.=C2=A0 If
@var= {RESET} is non-empty, the specified counter is reset to the value
specified if it is a number, or 1 otherwise. You may leave @var{NAME}
empty to reset the default counter will be reset.
A question regarding the last sentence of this proposed manual = entry:

is {{{c(,2)}}} allowed to reset the default= counter?=C2=A0 I think is should be, but I have
not tested this.=

Carsten
On Mon, May 8, 2017 at 6:52 PM, Nicolas Goaziou= <mail@nicolasgoaziou.fr> wrote:
Hello,

Eric S Fraga <e.fraga@ucl.ac.uk= > writes:

> On Monday,=C2=A0 8 May 2017 at 15:32, Dushyant Juneja wrote:
>> A very useful macro indeed!
>>
>> One suggestion: can this also be made to support nested headings. = For instance:
>> * Part {{{c}}}
>> ** Part {{{c}}}.{{{c}}}
>> * Part {{{c}}}
>
> I think this is what separate counters will enable but also motivates<= br> > need to be able to reset a counter (e.g. the sub-heading one in above<= br> > example if it were to be used in the second part).

Good idea.

Here is an updated patch, in which one can write

=C2=A0 {{{c(sub,reset)}}}
=C2=A0 {{{c(sub, 5)}}}

or even, for the default macro

=C2=A0{{{c(,reset)}}}
=C2=A0{{{c(, 99)}}}

I find the manual entry a bit awkward. Suggestions welcome.

Regards,

--
Nicolas Goaziou

--94eb2c05e11efbe7c9054f12658c--