All editor commands and some other editor functions expect to be called within a dynamic context that includes settings for the current buffer and current window. This happens automatically when using the editor interactively.
You can set up the context in a CAPI application by using the function
CAPI Reference Manual
You can also use the following function to call editor commands and functions.
editor:process-character char window
Processes char in a dynamic context where the current window is window and the current buffer is the buffer currently displayed in window .
The char can be one of the following:
A string, naming an editor command to invoke.
A list of the form
, which causes
to be called with
. The items in
are not evaluated.
A function or symbol, which is called with
as its argument (like a command function would be if there is no prefix argument).
A character or
object, which is treated as if it has been typed on the keyboard.
There is no return value. The processing may happen in another thread, so may not have competed before this function returns.