bugGNU nano - Bugs: bug #50314, [Request] add a feature to...


You are not allowed to post comments on this tracker with your current authentication level.

bug #50314: [Request] add a feature to record/replay keystrokes

Submitted by:  Peter Passchier <pepa65>
Submitted on:  Wed 15 Feb 2017 12:01:16 PM UTC
Votes:  82  
Severity:  1 - Wish Status:  Fixed
Assigned to:  bens Open/Closed:  Closed
* Mandatory Fields

Add a New Comment (Rich Markup)

Comment Type & Canned Response:


( Jump to the original submission )

Sun 19 Nov 2017 08:12:08 AM UTC, comment #17: 

Released in 2.9.0.

Benno Schulenberg <bens>
Project Administrator
Sun 15 Oct 2017 06:56:56 PM UTC, comment #16: 

The basic feature request has been fulfilled in git: 501d05c5.

Wrapping while searching is unconditional in nano.  I could raise the "seriousness" of the "Search Wrapped" message, so it will flush the key buffer, but I can't oversee whether other users might want a macro to continue also when a search wraps.  If you still want the aborting behavior, then better bring it to the mailing list, nano-devel, and see what other people think.  If from that discussion you have new/additional requests, please post them as new "bugs".

Benno Schulenberg <bens>
Project Administrator
Thu 12 Oct 2017 07:41:02 PM UTC, comment #15: 

This patch indeed stops on errors!

At times (usually I think) it can be handy to not allow wrapping in this case, or request user input to wrao search. Right now wrapping is not flagged as an error. Because wrapping in nano is unconditional (right?) it might be more prudent to also halt on (before) wrapping.

I don't know if I'm asking too much, I hope you can see where I'm coming from.

Peter Passchier <pepa65>
Thu 12 Oct 2017 06:02:18 PM UTC, comment #14: 

Please try the attached additional patch.

(file #42130)

Benno Schulenberg <bens>
Project Administrator
Thu 12 Oct 2017 04:35:37 AM UTC, comment #13: 

It would be nice (read: very helpful) if macros refuse to continue if any action is hitting an error -- especially a non-found on a search.
Very often I use macros in combination with a search command, to do certain things on finding the search term.

Peter Passchier <pepa65>
Wed 11 Oct 2017 05:58:07 PM UTC, comment #12: 

It will land in git in about a week.  But the current patch is attached.  If you find any issues, please report them here.

(file #42119)

Benno Schulenberg <bens>
Project Administrator
Wed 11 Oct 2017 01:00:57 AM UTC, comment #11: 

I'm very excited to try this out! Will this land in the git repo soon, or had I better grab the sources from elsewhere -- or should I just find the patch and apply it locally??

Peter Passchier <pepa65>
Tue 10 Oct 2017 08:27:26 PM UTC, comment #10: 

The request is getting implemented.  See the development mailing list: http://lists.gnu.org/archive/html/nano-devel/2017-10/msg00033.html and the subsequent patch.

Benno Schulenberg <bens>
Project Administrator
Wed 12 Jul 2017 10:15:23 AM UTC, comment #9: 

Personally, I would prefer not to allow multiple macros.
In the proposed scheme, I now need to type in a number that I don't want or need. This will increase cognitive load/stress on the user of the macro system.

May I propose these functions:
start-recording M-:
stop-recording M-:
play-last-macro M-"

Then, for multiple stored macros the following functions could be added:

store-macro (the last defined one) - asks for number 0-9

For playback, I see 2 options with different trade-offs:
play-stored-macro - asks for number 0-9

Or, in order to have the playback be a one-keypress, perhaps have these functions:
play-macro-0 Alt-Shift-0
play-macro-1 Alt-Shift-1
play-macro-2 Alt-Shift-2

Peter Passchier <pepa65>
Wed 12 Jul 2017 09:45:55 AM UTC, comment #8: 

If we would allow just one macro to be defined, I would choose M-: to start and stop recording, and M-" to run it.  On a US keyboard, those are combinations with Shift and Alt, which should be hard to type accidentally.

If we want to allow defining multiple macros, typing M-: will elicit a prompt to type a number from 1 to 9, after which recording will start.  Typing 0 instead of 1 to 9, will ask for the number of the macro to activate -- 1 to 9 again.  Typing M-" will always run the last defined or the last activated macro.

How does that sound?  (Of course, the functions will be rebindable, so you can tie them to ^T and F9, or anything else the user likes.)  (Storing defined macros on disk would be another feature request.  First see that we get macros.)

Benno Schulenberg <bens>
Project Administrator
Wed 12 Jul 2017 02:04:29 AM UTC, comment #7: 

Thank you for inviting my input. I have to confess I am not in tune with the default nano keybindings, so I always need to remap them in order to be able to remember them (I love how the help page shows remapped keys properly, unlike some other editors!).

I would start with implementing the simple case (I have never had need for more than 1 at a time myself). Choosing a default binding is not so important to me, but once this is implemented, I would suggest someone who groks nano's keybinding logic should pick suitable default bindings for start-recording, stop-recording and play. This is a major feature, and you want it to be accessible from the start!

Would it be possible for start-recording and stop-recording to have the same key binding? I would set it like that if it is possible, less to remember. Personally, I would set ^T for start/stop recording, and F9 to play it back.

Peter Passchier <pepa65>
Tue 11 Jul 2017 07:09:30 PM UTC, comment #6: 

If you would like this bug to be worked on... maybe first think about how it should work, in nano: how do we start recording a macro, with which keystroke?  How do we stop?  How do we run the macro, with which keystroke?  How do these keystrokes fit in?  Or don't we make default bindings?  Do we just define functions (like 'savefile' and 'findprevious') and let the user bind them?  And can just one macro be defined?  Or maybe ten, numbered from 1 to 9 plus 0?  Please compare with other editors that have a macro facility.

Benno Schulenberg <bens>
Project Administrator
Thu 15 Jun 2017 06:44:06 AM UTC, comment #5: 

To add to the previous points: often replacements can target single lines, but when wanting to make changes on a line before or after a search term, or to join lines, a simple keystroke macro would be very powerful!

Peter Passchier <pepa65>
Fri 17 Mar 2017 02:13:18 AM UTC, comment #4: 

Thank you for following up.

Sounds like bug #48659 will be a good one to fix as a matter of principle. A good infrastuctural investment.

As for ne, I've only ever used the one/current macro, that suffices for most needs. I do use it for all kinds of jobs, making life easier, or precluding the need to process with external tools.

Peter Passchier <pepa65>
Thu 16 Mar 2017 06:50:36 PM UTC, comment #3: 

So in ne there is only one "current" macro that is directly executable (with F9).  Any other macros require loading from disk, which involves quite a bit of typing.  Right?

Anyway, before being able to make a macro facility, first bug #48659 will need to be fixed -- nano is currently not able to handle fully contiguous keystrokes.

Benno Schulenberg <bens>
Project Administrator
Thu 16 Feb 2017 01:24:47 PM UTC, comment #2: 

I am currently using ne (nice editor), with a big downside: no proper support for Thai characters. [I've also used jed and joe, but I consider them byzantine. And vi doesn't have the right key strokes, and I don't like the state changes.)

In ne it works like I described: Ctrl-T (messages "Starting macro recording..." in the status line), I do my editing on the first instance, and then Ctrl-T again ("Macro recording completed." in the status bar). Then F9 will operate the sequence. If I need to operate based on a search string, I first do Ctrl-F (or Ctrl-_ for regex) to find what I need to work on, and then start the macro recording, incorporating Ctrl-G (find again).
Here ne works better than jed or joe, because once it no longer finds the string, the macro doesn't keep repeating, but stops (even if I keep pressing F9 -- I sometimes do this on hundreds of lines.)

I use this macro facility quite a lot, dealing with simple text transformation tasks that would take longer to script. It also helps in lieu of not having multi-line operations, because you can move the cursor vertically in the keystroke sequence. I often use it with the search-again function being one of the key strokes. I can very quickly and in an intuitive manner script the desired changes on all the lines that need it this way.

Peter Passchier <pepa65>
Thu 16 Feb 2017 12:22:35 PM UTC, comment #1: 

Sounds like a good idea.  But... what would you actually do with it?  Can you give one example?

Also, which other editor with a "macro capability" do you use where you actually make use of this capability?  How does it work there?  Because: can you define just one macro?  Or ten?  Or thirty six?

Benno Schulenberg <bens>
Project Administrator
Wed 15 Feb 2017 12:01:16 PM UTC, original submission:  

Strangely enough, I couldn't find this in the list of bugs/requested features:

It would be awesome if it would be possible to:

- start recording keystrokes (by a pressing a configurable key-combo)

- all subsequent keystrokes would be kept in a special buffer

- stop recording keystrokes (by a pressing a configurable key-combo, perhaps the same one)

- have the ability to replay the special buffer at any time (by a pressing a configurable key-combo)

This would lift nano to a whole new level of ability!

Peter Passchier <pepa65>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by vitalstatistix (Voted in favor of this item)
  • -email is unavailable- added by pepa65 (Voted in favor of this item)
  • -email is unavailable- added by bens (Posted a comment)
  • -email is unavailable- added by pepa65 (Submitted the item)

    There are 82 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.





    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-11-19 bens Open/ClosedOpen => Closed
    2017-10-15 bens StatusIn Progress => Fixed
    2017-10-12 bens Attached File- => Added 0002-tweaks-flush-the-keyboard-buffer-upon-any-kind-of-er.patch, #42130
    2017-10-11 bens Attached File- => Added 0001-new-feature-the-ability-to-record-and-play-back-a-se.patch, #42119
    2017-10-10 bens StatusNone => In Progress
        Assigned toNone => bens
    2017-08-21 vitalstatistix Carbon-Copy- => Added vitalstatistix
    2017-06-15 pepa65 Carbon-Copy- => Added pepa65
    2017-02-16 bens Severity3 - Normal => 1 - Wish
        Summary[request] Record/replay keystrokes feature => [Request] add a feature to record/replay keystrokes

    Back to the top

    Powered by Savane 3.9