$command-names - Filtered command name list
$command-names CommandName
$command-names must first be initialized to the required filter string, if the variable is evaluated before it is initialized the value will be set to "ABORT" and the command will fail.
The filter string can contain wild-card characters compatible with most file systems, namely:-
?
[abc]
[a-d]
[^abc]
*
Note that these are not the same characters used by exact(2m) mode.
Once initialized, evaluating $command-names returns the name of the next command which matches the filter until no more commands are found, in which case an empty string is returned.
The following example prints out the name of all commands to the massage line one at a time. Note that &set(4) is used on the !while(4) statement to avoid evaluating $command-names twice per loop.
set-variable $command-names "*" !while ¬ &seq &set #l0 $command-names "" 100 ml-write &cat "command: " #l0 !done
The following example is an alternative implementation of command-apropos(2).
define-macro alt-commad-apropos set-variable #l1 @ml "Apropos string" set-variable $command-names &cat &cat "*" #l1 "*" !force 0 delete-buffer "*commands*" 1 popup-window "*commands*" !while ¬ &seq &set #l0 $command-names "" insert-string &spr " %s\n" #l0 !done beginning-of-buffer -1 buffer-mode "edit" 1 buffer-mode "view" !emacro
$command-names does not differentiate between built in commands and macros.
The list of commands is evaluated when the variable is initialized, macros created after the initialization will not be included in the list.
list-commands(2), command-apropos(2), $buffer-names(5), $file-names(5), $mode-names(5), $variable-names(5).
(c) Copyright JASSPA 1999
Last Modified: 1998/09/03
Generated On: 1999/12/01