box.matto.nl
Enjoying Open Source Software

Create a persistent macro in JOVE Micro Emacs

Jonathan's Own Version of Emacs

JOVE is Jonathan's Own Version of Emacs, a Micro Emacs.

JOVE is a Micro Emacs that is small, fast, and has some nice options.

One of the options is to create keyboard macros and write them to a file. This way you can make your keyboard macros persistent.

I wanted to setup a small macro that inserts a time stamp.

The apropos function in JOVE is great way to discover the available functions.

Unfortunately, the FreeBSD package of JOVE doesn't come with all the documentation, this is why the describe-command function doesn't work.

So it took some time to figure out how to do this.

Basic recipe

This are the steps by which I was able to create a persistent macro.

  • Record the macro
  • Test the macro
  • Name the macro
  • Write the macro to a file
  • Get the macro into the initialization file
  • Bind the macro to a key

Record the macro

Start the recording of your macro with

^X-(

(which stands for "Ctrl-c (" ).

End the recording of your macro with

^X-)

Test the macro

You can test the macro with

^X-e

Name the macro

Use the function

M-x name-kbd-macro

To name your last recorded macro.

Just give it a descriptive name.

Write the macro to a file

Invoke the function

M-x write-macros-to-file

and supply a filename, like "/tmp/my-macro".

JOVE will write the known named macros to this file, including your fresh created and named macro.

Get the macro into the initialization file

I didn't have a personal initialization file, so I had to create one first. For this, I copied the system initialization file to my home directory:

cp /usr/local/share/jove/jove.rc ~/.joverc

Now you can copy the line with your macro from "/tmp/my-macro" to your ~/.joverc.

Bind the macro to a key

Add a line to .joverc in which you create the key binding.

bind-macro-to-key my-great-macro ^X^T

In this line above, the macro named "my-great-macro" is bound to ^X^T (Ctrl-x Ctrl-t).

Test

Close JOVE and open it again, to make it read your .joverc and test to see if your defined key binding indeed invoke the macro.

Have fun !

Tags:

⇽ FreeBSD 13 on a 12 year old laptop In praise of the convenience and speed of the editor ed ⇾