Many editor commands and functions signal an error on failure (usingeditor:editor-error as described below). This causes the current operation to be aborted.
In many cases, the user will not want the operation to abort completely if one of the editor commands it uses is not successful. For example, the operation may involve a search, but some aspects of the operation should continue even if the search is not successful. To achieve this, the user can catch theeditor:editor-error using a macro such ashandler-case.
For example, one part of an application might involve moving forward 5 forms. If the current point cannot be moved forward five forms, generally the Editor would signal an error. However, this error can be caught. The following trivial example shows how a new message could be printed in this situation, replacing the system message.
(in-package 'editor)
(defcommand "Five Forms" (p)
"Tries to move the current point forward five forms,
printing out an appropriate message on failure."
"Tries to move the current point forward five forms."
(handler-case
(forward-form-command 5)
(editor-error (condition)
(message "could not move forward five"))))
editor:editor-error Function
editor:editor-error string &rest args
format. As witheditor:message, args can consist of arguments to be printed within the string.