| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
mpedit command
Yet another utility program that is provided is called mpedit, which
is used to invoke a text editor on a given source file and optionally jump to a
specific line number. It is used as a support command by the mpatrol library
when the `EDIT' or `LIST' options are used but it can quite easily
be used as a command in its own right if properly configured. Because it is a
shell script it can be easily configured to support other editors, but this
unfortunately limits it to UNIX platforms at the moment.
The first argument to mpedit must be the filename of the source file
to be edited or listed. If the source file does not exist then the contents of
the MPATROL_SOURCEPATH environment variable will be used to help locate
the source file, even if the filename contained an absolute or relative path
component. This environment variable should consist of a colon-separated list
of directory names which may contain absolute paths or be relative to the
current directory; the first directory in the list will be searched first. If
the MPATROL_SOURCEPATH environment variable is not set then only the
current directory will be searched. You can also use the `--source-dir'
option to add directories to the search path used to locate the source file.
Multiple `--source-dir' options may be given, and each will be prepended
to the MPATROL_SOURCEPATH environment variable in the order given on the
command line.
If the second argument specifying the line number is omitted then it is assumed
to be `1'. The text editor will attempt to jump to the specified line
after opening the source file. The text editor that mpedit uses is
controlled by setting the EDITOR environment variable. This can be set to
the full pathname of the text editor to use or it can be set to the command that
would normally be used to invoke the text editor, but it cannot also contain
command line options. You can also use the `--editor' option to specify
the text editor on the command line instead of using the value in the
EDITOR environment variable.
The currently supported editors are vi, vim,
elvis, emacs, xemacs, pico and
nano, and if the EDITOR environment variable is not set then the
default will be vi. Selecting an unsupported text editor will result
in an error. However, you can edit the mpedit file to add support for
your own favourite text editor as long as it supports a way to immediately jump
to a specific line number when it is first started up. Note that the text
editor must also open a new window to edit the source file so that it does not
obscure any mpatrol diagnostic messages, and if it does not support this then a
new terminal window must be opened for it to use.
If the `--listing' option is given on the command line then the
mpedit command will display a context listing of the source file at
the specified line number to the standard error output stream instead of
invoking the text editor. The listing will be annotated with line numbers and
will also show the contents of the five lines before and after the specified
line if possible. Note also that the mpedit command supports the
`--help' and `--version' options in common with the other mpatrol
command line tools.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |