# ml-write(2)

[Home] [Commands] [Variables] [Macro-Dev] [Glossary]

## NAME

ml-write - Write message on message line

## SYNOPSIS

0 ml-write
n ml-write "message"

## DESCRIPTION

ml-write writes the argument "message" to the message line. If a positive numeric argument n is specified then the message is displayed with a n milliseconds uninterruptible delay allowing the user time to see the message.

The arguments to ml-write are defined as follows:-

No argument

The default form, writes a message to the command line with no delay.

+ve

Displays the message on the message line and waits n milliseconds before proceeding with the next command.

`0`

the message argument is not required and the command clears the message line. This may be used to clear any previous message from the last command(s) in a script and is equivalent to the old MicroEmacs command ml-clear.

`-1`

Writes the message to standard out. A carriage return (`'\n'`) is automatically added to the end of the message to create a line on the given stream.

`-2`

Writes the message to standard error, the behaviour is the same as standard output (`-1` option)

## NOTES

If the argument value is not `-1` or `-2` calls to ml-write are ignored in standard MicroEmacs piped mode (command-line option -p). They are printed to standard error when debug piped mode is used (command-line option -P, see me(1)), making the debugging and maintenance of macro based piped processing easier.

In previous releases the command ml-clear was used to clear the message line, this command was replaced by `0 ml-write` in December 2004.

## EXAMPLE

The following call displays a message on the message-line with a 2 second pause:

    2000 ml-write "Hello World!"

The following start-up(3) macro may be used to add a header and footer line to a file piped to standard in, writing the output to standard out.

    define-macro start-up
        find-buffer "*stdin*"
        ml-write &spr "DEBUG: Read %d lines from stdin" $window-eline
        ml-write &spr "DEBUG: About to write header"
        -1 ml-write "<<<HEADER>>>"
        ml-write &spr "DEBUG: About to write body"
        0 save-buffer
        ml-write &spr "DEBUG: About to write footer"
        -1 ml-write "<<<FOOTER>>>"
        -2 ml-write &spr "%d lines written to stdout" &add $window-eline 2
        quick-exit
    !emacro

To run this example save this macro in a new macro file (such as `mlwrite_test.emf`) and in a shell run:

    cat input_file | me -n -p @mlwrite_test - > output_file

Note the `DEBUG` lines will be printed if -P option is used. Also see example given for command-wait(2).

## SEE ALSO

command-wait(2), create-callback(2), me(1).

(c) Copyright JASSPA 2009
Last Modified: 2009/08/29
Generated On: 2009/10/12

</HMTL>