2021-07-22, updated: 2024-03-12

Tested with Nyxt 2.3.0.

Tags: feature.

Macro edit: democratizing automation

Macro edit: democratizing automation

By John Mercouris

It is no secret that computers are effective at automation. We use their power to multiply our impact- as an extension of our minds.

Until recently, this power has been largely inaccessible for the vast majority of users. Today, we change this, Nyxt has taken the first steps towards the democratization of automation.

So, what is the first step? Simple automation for everyone. Let me introduce edit-macro. Edit macro allows the user to define a sequence of actions to execute. The user can then save, and reuse their macro whenever they want. Let's go through a simple example demonstrating their power.

To begin, we start with the command edit-macro.

Upon executing edit-macro, you'll be presented with the macro editor screen.

In this example, we'll be creating a simple macro that prints the current buffer, and then switches to the next one. You can imagine that invoking this macro several times in a row would allow you to quickly print all of your buffers.

Let's start off by giving our macro a name, let's call it print-and-next. After giving it a name, we have to select which commands we want it to execute. To do so, we click "+ Add Command".

We are now presented with a screen that lists all of the commands available in Nyxt. We select a command, press return, and it is added to our command list.

Now we'll add our next command: switch-buffer-next.

We are now ready to test! To test press "Evaluate macro". This will compile our macro and make it runnable from the execute-command menu.

If everything works as expected, that's it, we're done! We can use our macro, we can bind to a hotkey, use it in another macro etc. The possibilities are literally endless.

Should we wish to save our macro for future sessions, all we have to do is press "Save macro". Nyxt will then automatically save our macro into our auto-config.lisp file. If you are curious, here is the code that our macro produces:

As you can see, macros are very powerful. That said, there remains a lot of important work to be done: in subsequent variants we hope to introduce branching, variables, and more (without overwhelming the user)! We see the development of this automation interface as an important first step towards the democratization of automation.

We hope you enjoy it, and thanks for reading :-)


Did you enjoy this article? Register for our newsletter to receive the latest hacker news from the world of Lisp and browsers!