# create-callback(2)

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

## NAME

create-callback - Create a timer callback

## SYNOPSIS

n create-callback "command"

## DESCRIPTION

create-callback creates a timer based callback command. The given command is called back in n milliseconds time. This can be used by the user to monitor system events (such as incoming mail). The command is called only once, but if the command creates a callback of itself a loop is created.

If a negative argument n is given any pending callback for command is cancelled.

## EXAMPLE

The following example creates a callback that is invoked every 10 minutes.

    define-macro Example-callback
        ml-write "It was 10 minutes since you last saw me!"
        600000 create-callback Example-callback
    !emacro
    Example-callback

## NOTES

A call-back cannot interrupt while MicroEmacs is active, instead the call-back is delayed until MicroEmacs becomes inactive. MicroEmacs is considered to be inactive when it is waiting for user input, this could be during the execution of another macro. If a command or macro requires no user input then once execution has started, it cannot be interrupted by a call-back macro.

The resolution of the clock is platform dependent, some platforms limit the minimum timer period to 10 milliseconds.

MicroEmacs does not guarantee to service the callbacks within any set time constraints, the resultant callback intervals may be of a slightly different duration than requested.

When a callback macro is executed, the key given by @cck(4) is "`callback`. If the current buffer has a $buffer-input(5) command set, this command will be called instead of the callback command with @cc and @cck set appropriately. It is the responsibility of the input macro to deal with the callback.

## SEE ALSO

$auto-time(5), define-macro(2).

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

</HMTL>