The Commands menu is a menu that allows you to invoke the Editor commands that are shown on it, and also to raise the Editor Commands List tool, which allows you to choose the commands that are shown (see 3.15.1 Editor Commands List). Editor commands are documented in the Editor User Guide.
The Commands menu can invoked from the menu bar as Commands in the "editing" tools, including the Editor, Listener, Debugger, Shell and Output Browser. It can be also invoked from the context menu in any editing pane.
The commands shown on the Commands menu are remembered between invocations of LispWorks.
Note: When the context menu is invoked by right-click, the execution of the command is invoked with the buffer point moved to where the click occurred, and, unless the command moves the buffer point, it is moved back to its original position afterwards. Therefore commands that use the buffer point may not behave in an obvious way. For example, the command Forward Character will move the point to one character after the point where you clicked, rather than one character after where the point was before you clicked.
There are several functions that allow to access the list of commands that are currently in the menu. These are useful when you want to transfer the list of commands to a different computer or a different user. They may be also useful for switching between different "modes of working" in which you want different commands in the menu.
The Editor Commands List is a simple tool that allows you to browse the Editor commands that are defined, and to add or remove commands from the Commands menu.
Open the Editor Commands List using Display Commands List... on the Commands menu.
Editor Commands List
The main area of the Editor Commands List shows all the known Editor commands. If the command has a key binding, then it is shown in the Key column. Below the main area, there is an area that displays the documentation for the currently selected command.
The commands that are currently shown on the Commands menu are displayed with a * in the In menu column of the main area. Double-clicking on a command adds or removes it from the Commands menu. When a command is added, it is added at the top of the menu.
At the top of the main area, there is a filter that allows you to restrict which commands are shown. By default, the filter searches the text in the panel, so matches both the command name or the key. For example, typing file
matches all commands that contain "file". Typing ctrl
matches commands that are bound to a key sequence containing the Control key. Typing -k
matches both commands where the key k
is used with a modifier (for example, Ctrl-k kill line
) and the commands which contain un-kill
in their name.
The filter also has two additional check buttons. The first one, In Menu, causes the Editor Commands List to show only commands that are currently in the Commands menu. This is particularly useful when the Commands menu becomes too long and you want to decide which commands to remove from it. The second one With Keys causes the Editor Commands List to show only commands that are bound to some key sequence.
You can also manipulate the list of commands in the Commands menu programmatically by using the following functions.
commands-menu-add-commands Function
lw-tools:commands-menu-add-commands commands
The function commands-menu-add-commands
adds the commands named by commands to the Commands menu. commands should be a list of strings, which are appended in front of the current list, after removing any matching commands from the current list.
commands-menu-remove-commands Function
lw-tools:commands-menu-remove-commands commands
The function commands-menu-remove-commands
removes the commands named by commands from the Commands menu. commands should be a list of strings, or :all
which causes all commands to be removed.
commands-menu-get-commands Function
lw-tools:commands-menu-get-commands => commands
The function commands-menu-get-commands
returns a list of strings naming the current commands in the Commands menu. The list is new, and can be destructively modified.
The commands shown on the Commands menu is remembered between invocations of LispWorks, so you don't need these functions if you have a fixed list of commands and always use the same computer.
If the list of commands is modifed before the the LispWorks IDE starts, typically by a call to commands-menu-add-commands in an init file, then LispWorks ignores any commands that it remembered from a previous run.
Here are some examples.
Sorting the commands in the Commands menu:
(lw-tools:commands-menu-add-commands (sort (lw-tools:commands-menu-get-commands) 'string<))
Generate a form that you add to the Commands menu all the commands that are currently in the Commands menu:
(pprint `(lw-tools:commands-menu-add-commands ',(lw-tools:commands-menu-get-commands)))
You will typically put such a form in your init file on another computer, or give it to another user.
LispWorks IDE User Guide (Macintosh version) - 01 Dec 2021 19:36:18