start-command-loop
()
command-loop
to take effect.*this-command*
*this-command-keys*
*last-command*
Neomacs commands are processed in a transactional manner, following the 2PL (2-phase locking) model. During a command invocation, every with-current-buffer
form obtains a lock for the buffer. All buffer locks are released at the end of command invocation. on-pre-command
is run when the buffer lock is obtained for the first time and on-post-command
is run when the buffer lock is released. When with-current-buffer
runs outside any command invocation, it effectively starts a new command invocation for running its body and will run on-pre-command
and on-post-command
like normal command invocations. It's important to note the interaction between with-current-buffer
and transactions.
with-current-buffer
(buffer &body body)
on-pre-command
(buffer)
with-current-buffer
form for BUFFER during a command invocation.on-post-command
(buffer)
with-current-buffer
form for BUFFER during its
execution.Normally, Neomacs command loop handles any error conditions that reach it. It runs approriate hook, logs a message, then continue processing the next command.
*quit-hook*
user-error
s are considered quits and also trigger this hook.*error-hook*
user-error
s are considered quits and does not trigger this hook.It is also possible to ask the command loop to invoke the debugger instead of handling error conditions.
*debug-on-error*
toggle-debug-on-error
()
user-error
inherits (error)
quit
condition and does not
drop into Neomacs debugger.user-error
(control-string &rest format-arguments)
simple-user-error
with messages formatted from
CONTROL-STRING and FORMAT-ARGUMENT.with-demoted-errors
(prompt &body body)
*debug-on-error*
is t, run BODY without catching its errors.define-command
(name &rest args)
{:option OPTION}* LAMBDA-LIST FORM*
. This is
like (defun LAMBDA-LIST FORM*)
besides supporting extra options:call-interactive
call this function to compute arguments for the
command.