Subject: Re: bug#61549: 30.0.50; [PATCH] New keyboard macro counter functions

From: Alex Bochannek <[email-masked]>
Date: Mon, 03 Jun 2024 19:01:04 -0700

Michael, Eli,

Michael Heerdegen <[email-masked]> writes:

> Eli Zaretskii <[email-masked]> writes:
>
>> Thanks, but please in the future try to chime in earlier [...]
>
> Sure - I'm sorry that I failed this time.
>
>> > (1) "kmacro-add-counter" and related functions... I wonder why these are
>> > not named "kmacro-increase-counter" [...]
>
>> If we want to rename this, IMO kmacro-add-to-counter is a better name.
>
> Sounds reasonable.

I tried to make these function names descriptive and if there is
something more obvious, I am happy to rename them. (Also see below)

>> > (3) I actually don't understand the usage of the
>> > `kmacro-reg-add-counter-*' named functions (did you, Eli?).  An example
>> > would maybe help.
>>
>> Did you read the doc string before or after I install the changes?
>
> Both times in this case, actually.  My question was more about how this
> is supposed to be used, not what it does.  Maybe it's obvious when one
> uses kmacros often.

I had some examples in the documentation in the original patch proposal.
The first set of functions lets you easily construct loops that change
the stepping of the counter based on a register value, so something
like:

C-x C-k TAB C-x C-k C-r a > T RET C-u 20 C-x C-k C-q >

When register T is set to 10 this will loop in steps of one to 10, then
in steps of two until it quits at 20.

I think the functions may be somewhat inconsistent because the first set
takes a prefix as an increment value and a register name as an argument
whereas the second uses the prefix as a the comparison value. A more
general approach would be to allow numeric registers for both types of
functions.

The problem I was trying to solve was how to use keyboard macros to
auto-create lists of numbers. I have found it useful and I can see how
other people might discover other uses. I figured it's been a over a
year since I originally proposed this, let's get this in and improve it
as there is some usage.

>> > In addition I want to say the suggested manual additions are useful.
>> > Would it make sense to add at least some parts to the file header or
>> > some pieces to the docstrings, or as comments?
>>
>> No, I think these are sufficiently obscure to not be in the manual.
>
> I agree - but the focus here was on the second sentence.

-- 
Alex.