checkSaveStatushandler is the most complex of the three, and the only one that warrants any discussion. It never returns a meaningful value, and thus is only to be called for its side effects. There are two possible side effects. First, if the front document in SEE has never been saved, an error is raised. Second, if requested and necessary, the handler will update the file on disk by saving the current document.
That may seem a bit obscure, so let's examine an example. The AppleScript for typesetting previously featured a rather complicated nesting of
ifblocks. Using the new handlers, the only thing outside the handlers in a rewritten typesetting script is:
Just three statements, plus the
seescriptsettingshandler to connect it to SEE.
The various handlers introduced thus far have been to support several actions in the LaTeX mode: typesetting, viewing the product PDF in an external viewer, cleaning up auxiliary files, and commenting out lines. All of these actions can be rewritten using just the handlers, without directly addressing SubEthaEdit at all.
The handlers thus provide a useful abstraction layer for working with several distinct types of actions. They definitely won't cover every case of interest, but should still be useful patterns for a lot of common actions in many different modes.