Re: [RFC PATCH v1 0/1] Avoid accidentally overwriting macro recording
Charles Mirabile <[email protected]> Wed, 11 Feb 2026 10:03:30 -0500
| Newsgroups | gmane.editors.nano.devel |
|---|---|
| Message-ID | <CABe3_aH_Q6DGfDW2_quOtmpccQ9B6atT8stq4X0YZY-j-9jioQ@mail.gmail.com> |
On Wed, Feb 11, 2026 at 5:10 AM Benno Schulenberg <[email protected]> wrote: > > > 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 Part of the reason I like nano is that I can use it without much customization, I don't need a dotfile to be productive on any system that has it installed because the defaults (like having both macro keybinds on a similar key) just make sense. In addition I think cancelling the recording if you stop it immediately is perfectly intuitive and helpful. > > (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. It is not hard to e.g. just restart the editor or record a macro that invokes control+c to show the status line or something if you really want to clear a harmful macro. This feature is in my opinion perfectly intuitive and discoverable while being easy to work around if you truly do wish for a no-op macro. > > > Benno