Re: [RFC PATCH v1 0/1] Avoid accidentally overwriting macro recording

Benno Schulenberg <[email protected]> Wed, 11 Feb 2026 11:08:51 +0100
Newsgroups gmane.editors.nano.devel
Message-ID <[email protected]>
Op 10-02-2026 om 18:21 schreef Charles Mirabile:
> I often accidentally hit the recording toggle instead of invoking the
> macro I just recorded because my fingers have sort of been trained by
> having to hit the start/stop keybind twice.

I'm guessing that the confusion mainly happens because the `record` and
`play` functions are bound to two different symbols on the _same_ key.
How about preventing this accidental typing of `record` by binding it
to a different key, one that is rather hard to type?  Something like:

     unbind M-: main
     bind M-! recordmacro main

Or, if you would like to wean yourself from having start and stop on
the same symbol:

     unbind M-: main
     bind M-{ recordmacro main
     bind M-} recordmacro main

(Of course, both M-{ and M-} would start and stop the recording, but
it would be a nice mnemonic thing.)


> My suggestion/idea is
> that if the user stops the recording immediately after starting it
> such that the recorded macro would be empty, instead of storing the
> empty macro which is essentially useless, just cancel the recording
> and revert the stored macro to whatever the user had saved before.

Storing an empty macro is not useless: it clears an existing macro,
a possibly destructive macro when invoked accidentally.  So I would
rather not make the clearing of a macro impossible.


Benno
OpenPGP_signature.asc (application/pgp-signature, 840 B)
-----BEGIN PGP SIGNATURE-----

wsF5BAABCAAjFiEEFo5vQpe/16ea/USWUUu+Lrjhlh8FAmmMVTMFAwAAAAAACgkQUUu+Lrjhlh9Y
xBAAgfPIIrc2rmiYXqMhyGt9Zd2cCF6uVAK9uFBtBFgbP+Yomn1QvXGjaQ9JFSI+OVBaXxADTdRg
8gAu2gSZD2KjWn5peEOabVqYgJukRvHeRaT7rHkriwZnTVvQnyL/JI0h2uabrwwc2NheZFYsmDpO
ZwCtZm0BWcg+oFMKK/QZbOm4d1PrFQhPksMGbVYNgtO7HR1/wlupTedycmSns3X6PPG+IE2H4vDz
XjBIlghIQNxbuyrQU68c5SZLy8O2Cq083FQJj9aSWhF87tM5q3PZzxehjYAjFMNO0JYK/h7/J1Zp
0slrrb2OJ1GggJwW03gl1ouQ8Dni5mM/OjKRLgCmNk9Yt2zu94aBiyXjm8TVJJIwLVh/NefcjKru
K1pHVAOUZ/8sqC+vVob2+SNqWiv6Kx13FN9MyJ67CroJuvzZvoVlQbleefG9EzAOah/vnSB4bhXJ
260Np+7ceSVXdaZQOcFvPxdVtdkMjtVRQi+wgd8znMKrRzTMSRYoxQMD1nYVboWcJENaDnkm6cIG
N/NowwyBfnaHW3sO8D2Zq4ngqEMH/cGSsW1EwqSCLxsec0acptKEGml+iHgb/DN0rQANr25UL2ic
i92Fkd2NDnzBViqTInLvJE+sAQ0zUYiD+vjRbDoF6grdmpE4X82gDgcqmIfxWecdOJOmHOAzOExu
Dbc=
=IHxq
-----END PGP SIGNATURE-----