bt-types
[module] bt-types
Hooks
Hooks are procedures that are registered to be called at specific moments during program execution. Hooks are organized in hook sets.
Bintracker defines various hook sets for different tasks, including
application start-up (on-startup-hooks
, see
bintracker-core
), and file operations
(after-load-file-hooks
, on-close-file-hooks
, on-save-file-hooks
;
see bt-gui
).
Plug-ins, config/config.scm
, and other user code may extend and modify
these sets. For details, see documentation for the make-hooks
procedure
below.
[procedure] (make-hooks . HOOKS)
Create a set of hooks. HOOKS must be key-value pairs, where keys are identifier and values are procedures. You can call the resulting hook set HS as follows:
(HS 'execute [ARGS ...])
Execute the hooks in order. Each hook is called with ARGS ... as the procedure arguments.
(HS 'add ID HOOK [WHERE [OTHER-HOOK]])
Append ID . HOOK to the set of hooks. You can control the execution order
with the optional WHERE and OTHER-HOOK arguments. WHERE must be either
'before
, 'after
or 'instead-of
, and OTHER-HOOK may be the identifier
of an already existing hook. In this case, HOOK is inserted before, after,
or instead of OTHER-HOOK. If WHERE is 'before
or 'after
and OTHER-HOOK
is omitted, then the new hook will be added in first resp. last position.
Note that the latter has the same result as calling (HS 'add ID HOOK)
with no additional arguments.
(HS 'remove ID)
Remove the hook with the identifier ID.
(HS 'list)
Returns the list of hook identifiers.
Application State
[procedure] (settings . ARGS)
The global application settings registry. Use as follows:
(settings)
- Return the complete list of settings.(settings PARAM)
- Return the value of the setting with the ID PARAM.(settings PARAM VALUE)
- Set a new VALUE for the setting PARAM. If PARAM does not exist, create a new entry for it.