emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>, emacs-orgmode@gnu.org
Subject: Re: [RFC] The "c" Org macro
Date: Mon, 22 May 2017 03:24:09 +0000	[thread overview]
Message-ID: <CAFyQvY1FOYQCwREr29nmGhvD7ZTHy-QiiW8RTGVibwd=1+ADRg@mail.gmail.com> (raw)
In-Reply-To: <8760guib5i.fsf@nicolasgoaziou.fr>

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

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

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

  reply	other threads:[~2017-05-22  3:24 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2ee94a64a94b46259b0da6e7d34675c9@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-05-08 14:00 ` [RFC] The "c" Org macro Eric S Fraga
2017-05-08 15:32   ` Dushyant Juneja
     [not found]   ` <a4c6d561b12a4cc8ad4fe8c017fa2121@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-05-08 15:59     ` Eric S Fraga
2017-05-08 16:52       ` Nicolas Goaziou
2017-05-09  7:35         ` Carsten Dominik
2017-05-09 10:35           ` Nicolas Goaziou
2017-05-09 11:25         ` Rasmus
2017-05-09 16:10           ` Nicolas Goaziou
     [not found]       ` <2069df8c23bc43f3b04b6e203b96be9d@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-05-11  8:45         ` Eric S Fraga
2017-05-21 13:37           ` Nicolas Goaziou
2017-05-22  3:24             ` Kaushal Modi [this message]
2017-05-22  5:58               ` Nicolas Goaziou
2017-05-22 10:46                 ` Kaushal Modi
2017-05-22 11:47                   ` Nicolas Goaziou
2017-05-22 13:00                     ` Kaushal Modi
2017-05-22 13:10                       ` Kaushal Modi
2017-05-22 13:13                       ` Nicolas Goaziou
2017-05-22 13:39                         ` Kaushal Modi
2017-05-25 10:42             ` Nicolas Goaziou
2017-05-25 18:31               ` Kaushal Modi
2017-06-14 17:52                 ` Kaushal Modi
2017-06-14 18:33                   ` Add an optional HOLD argument to "n" Org macro (Was: [RFC] The "c" Org macro) Kaushal Modi
2017-06-14 19:47                     ` Add an optional HOLD argument to "n" Org macro Nicolas Goaziou
2017-06-15 13:10                       ` Kaushal Modi
2017-06-15 15:25                         ` Kaushal Modi
2017-06-15 16:07                           ` Nicolas Goaziou
2017-06-15 18:07                             ` Kaushal Modi
2017-06-17 14:34                               ` Kaushal Modi
2017-06-17 23:24                               ` Nicolas Goaziou
2017-06-18  4:03                                 ` Kaushal Modi
2017-06-18  7:16                                   ` Nicolas Goaziou
2017-06-18  7:45                                     ` Kaushal Modi
2017-06-14 19:44                   ` [RFC] The "c" " Nicolas Goaziou
     [not found]           ` <a8f5841641834b4cb51af85a3df785da@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-05-22  8:34             ` Eric S Fraga
2017-05-08 16:30   ` Robert Horn
2017-05-08 11:26 Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFyQvY1FOYQCwREr29nmGhvD7ZTHy-QiiW8RTGVibwd=1+ADRg@mail.gmail.com' \
    --to=kaushal.modi@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).