## How jEdit Organizes Macros

Every macro, whether or not you originally recorded it, is stored on disk and can be edited as a text file. The file name of a macro must have a `.bsh` extension in order for jEdit to be aware of it. By default, jEdit associates a `.bsh` file with the BeanShell edit mode for purposes of syntax highlighting, indentation and other formatting. However, BeanShell syntax does not impose any indentation or line break requirements.

The Macros menu lists all macros stored in two places: the `macros` subdirectory of the jEdit home directory, and the `macros` subdirectory of the user-specific settings directory (see the section called “The jEdit Settings Directory” for information about the settings directory). Any macros you record will be stored in the user-specific directory.

Macros stored elsewhere can be run using the Macros>Run Other Macro command, which displays a file chooser dialog box, and runs the specified file.

The listing of individual macros in the Macros menu can be organized in a hierarchy using subdirectories in the general or user-specific macro directories; each subdirectory appears as a submenu. You will find such a hierarchy in the default macro set included with jEdit.

When jEdit first loads, it scans the designated macro directories and assembles a listing of individual macros in the Macros menu. When scanning the names, jEdit will delete underscore characters and the `.bsh` extension for menu labels, so that `List_Useful_Information.bsh`, for example, will be displayed in the Macros menu as List Useful Information.

You can browse the user and system macro directories by opening the `macros` directory from the Utilities>jEdit Home Directory and Utilities>Settings Directory menus.

Macros can be opened and edited much like ordinary files from the file system browser. Editing macros from within jEdit will automatically update the macros menu; however, if you modify macros from another program or add macro files to the macro directories, you should run the Macros>Rescan Macros command to update the macro list.