all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Allen Li <darkfeline@felesatra.moe>
To: Phil Sainty <psainty@orcon.net.nz>
Cc: 31243@debbugs.gnu.org,
	bug-gnu-emacs
	<bug-gnu-emacs-bounces+psainty=orcon.net.nz@gnu.org>
Subject: bug#31243: 26.1; kmacro-insert-counter increments incorrectly
Date: Mon, 23 Apr 2018 00:58:00 -0700	[thread overview]
Message-ID: <CADbSrJwDfhfZbbQXejdujCkw_5G97Ba=2sUKZE4K=w6wAm27fw@mail.gmail.com> (raw)
In-Reply-To: <dc6f54acfccfbc7d3066c9d08e093777@webmail.orcon.net.nz>

On Sun, Apr 22, 2018 at 9:56 PM, Phil Sainty <psainty@orcon.net.nz> wrote:
> Not a bug?  I believe your expectations are incorrect.
>
>> C-u <f3> ;; kmacro-start-macro-or-insert-counter
>
>
> This insert the *previous* macro counter.  Which is sort of "undefined" for
> the first iteration, but zero in practice.

Ah, I see.  I guess what I'm looking for is C-u 0 <f3> (or
alternatively C-u <f3> the second time rather than the first time).

I don't think the documentaton is very clear, because the meaning of
"previous" is ambiguous:

With C-u, inserts previous ‘kmacro-counter’ (but do not modify counter).

I interpreted this to mean "Insert the counter that was
used last time" (which is redundant since there's only one counter),
rather than "Insert the value of the counter before the last time the
counter was changed".  The fact that the previous value of the counter
is saved is mentioned nowhere except implicitly implied by this single
word in the documentation.

I think the The Keyboard Macro Counter page should have a standalone
paragraph explaining this, such as:

Whenever the value of `kmacro-counter' is modified (by
`kmacro-insert-counter', `kmacro-set-counter' or
`kmacro-add-counter'), the previous value of the counter is saved in
`kmacro-last-counter'.  This value can be inserted by C-u <f3> or C-u
C-x C-k C-i.

And a similar addendum in the docstrings.

>
> => 0
>
>> <f3> ;; kmacro-start-macro-or-insert-counter
>
>
> Insert the current macro counter (which is also zero, because inserting the
> previous counter does not touch the current counter).
>
> => 0
>
> Then the counter is incremented -- so the current counter is set to 1, and
> the previous counter is set to 0.
>
> Hence when you trigger the next iteration, you insert 0 and 1; etc...
>
>





  reply	other threads:[~2018-04-23  7:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-23  2:33 bug#31243: 26.1; kmacro-insert-counter increments incorrectly Allen Li
2018-04-23  2:40 ` bug#31243: [PATCH] Fix kmacro-insert-counter inserting the wrong counter Allen Li
2018-04-23  4:56 ` bug#31243: 26.1; kmacro-insert-counter increments incorrectly Phil Sainty
2018-04-23  7:58   ` Allen Li [this message]
2018-05-11  9:16     ` Eli Zaretskii

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

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

  git send-email \
    --in-reply-to='CADbSrJwDfhfZbbQXejdujCkw_5G97Ba=2sUKZE4K=w6wAm27fw@mail.gmail.com' \
    --to=darkfeline@felesatra.moe \
    --cc=31243@debbugs.gnu.org \
    --cc=bug-gnu-emacs-bounces+psainty=orcon.net.nz@gnu.org \
    --cc=psainty@orcon.net.nz \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.