Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the modularize-hooks Reference Manual, version 1.0.2, generated automatically by Declt version 3.0 "Montgomery Scott" on Mon Apr 19 17:07:01 2021 GMT+0.
• Introduction | What modularize-hooks is all about | |
• Systems | The systems documentation | |
• Files | The files documentation | |
• Packages | The packages documentation | |
• Definitions | The symbols documentation | |
• Indexes | Concepts, functions, variables and data types |
This is a simple extension to Modularize that allows modules to define and trigger hooks, which other modules can... well, hook on to. While such a system is very easy to create for your own projects, it's a good idea to have a standard form of doing it that doesn't interfere in any other way.
In order to define hooks, you need to have a module. See Modularize on how to get that set up. If the modularize-hooks system has already been loaded prior to your module definition, everything should be ready and set up. Otherwise, you may call HOOKIFY
on your module to initialise it. Creating hooks is similar to creating generic functions:
(define-hook documentation-finished (project)
"Hook called whenever documentation for a project is finished.")
This defines a hook with a single argument, the project. In order to latch on to this hook, you may define a trigger. It is not strictly necessary to be within a module context to define triggers, but it is recommended in order to keep things tidy.
(define-trigger other-module:documentation-finished (project)
(format T "~&Finished project documentation for ~a" project))
If you want to have multiple triggers on the same hook within the same package, you need to specify some kind of identifier to distinguish it from others.
(define-trigger (other-module:documentation-finished extra) ()
(format T "~&ゆっくりしていってね!!!"))
Note that in this second example we did not provide any arguments to the trigger. Triggers may either accept no arguments if they have no use for them, or they need to match the arguments list of the hook. A simple test to assert this is done on trigger definition. Actually triggering the hook with its trigger is merely a question of calling TRIGGER
:
(trigger 'other-module:documentation-finishe
Next: Files, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
• The modularize-hooks system |
Nicolas Hafner <shinmera@tymoon.eu>
Nicolas Hafner <shinmera@tymoon.eu>
(:git "https://github.com/shinmera/modularize-hooks.git")
zlib
Generic hooks and triggers extension for modularize.
1.0.2
modularize-hooks.asd (file)
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files |
• The modularize-hooks.asd file | ||
• The modularize-hooks/package.lisp file | ||
• The modularize-hooks/toolkit.lisp file | ||
• The modularize-hooks/hooks.lisp file |
Next: The modularize-hooks/package․lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
modularize-hooks.asd
modularize-hooks (system)
Next: The modularize-hooks/toolkit․lisp file, Previous: The modularize-hooks․asd file, Up: Lisp files [Contents][Index]
modularize-hooks (system)
package.lisp
Next: The modularize-hooks/hooks․lisp file, Previous: The modularize-hooks/package․lisp file, Up: Lisp files [Contents][Index]
package.lisp (file)
modularize-hooks (system)
toolkit.lisp
function-lambda-matches (function)
Previous: The modularize-hooks/toolkit․lisp file, Up: Lisp files [Contents][Index]
toolkit.lisp (file)
modularize-hooks (system)
hooks.lisp
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
• The modularize-hooks package |
package.lisp (file)
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions | ||
• Internal definitions |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported macros | ||
• Exported functions | ||
• Exported generic functions | ||
• Exported classes |
Next: Exported functions, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
Defines a new hook on which triggers can be defined.
The name should be a symbol from the module that the hook should belong to.
hooks.lisp (file)
hooks.lisp (file)
Defines a new trigger on the hook.
A trigger can either accept no arguments or it has to match the hook in its arguments list.
The name of the trigger defaults to the *PACKAGE*. If you want to have multiple triggers for
the same hook in the same package, use a list of the following structure as the HOOK argument:
(hook trigger-name hook-module)
hooks.lisp (file)
Next: Exported generic functions, Previous: Exported macros, Up: Exported definitions [Contents][Index]
Returns the module to one that is not capable of hooks.
In essence this merely removes all functions from the hooks package and deletes it.
hooks.lisp (file)
hooks.lisp (file)
Turns the module into one capable of hooks.
In essence this merely defines a new package with a matching name.
hooks.lisp (file)
hooks.lisp (file)
Removes the hook as named.
hooks.lisp (file)
Attempts to remove the trigger from the hook.
hooks.lisp (file)
Calls all triggers registered on the hook with the given arguments.
hooks.lisp (file)
Next: Exported classes, Previous: Exported functions, Up: Exported definitions [Contents][Index]
automatically generated reader method
hooks.lisp (file)
automatically generated writer method
hooks.lisp (file)
automatically generated reader method
hooks.lisp (file)
automatically generated writer method
hooks.lisp (file)
automatically generated reader method
hooks.lisp (file)
automatically generated writer method
hooks.lisp (file)
Previous: Exported generic functions, Up: Exported definitions [Contents][Index]
hooks.lisp (file)
standard-object (class)
sticky-hook (class)
:name
name (generic function)
(setf name) (generic function)
:arglist
arglist (generic function)
(setf arglist) (generic function)
(make-hash-table :test (quote eql))
triggers (generic function)
(setf triggers) (generic function)
:docstring
docstring (generic function)
(setf docstring) (generic function)
Initarg | Value |
---|---|
:name | (error "name required.") |
:arglist | nil |
:docstring | nil |
hooks.lisp (file)
hook (class)
stuck-args (generic function)
(setf stuck-args) (generic function)
Previous: Exported definitions, Up: Definitions [Contents][Index]
• Internal functions | ||
• Internal generic functions |
Next: Internal generic functions, Previous: Internal definitions, Up: Internal definitions [Contents][Index]
hooks.lisp (file)
Returns T if the function matches the lambda-list in arguments.
As a secondary value it returns a reason as to why it may have failed the test.
toolkit.lisp (file)
Previous: Internal functions, Up: Internal definitions [Contents][Index]
hooks.lisp (file)
hooks.lisp (file)
hooks.lisp (file)
hooks.lisp (file)
automatically generated reader method
hooks.lisp (file)
automatically generated writer method
hooks.lisp (file)
automatically generated reader method
hooks.lisp (file)
automatically generated writer method
hooks.lisp (file)
Previous: Definitions, Up: Top [Contents][Index]
• Concept index | ||
• Function index | ||
• Variable index | ||
• Data type index |
Next: Function index, Previous: Indexes, Up: Indexes [Contents][Index]
Jump to: | F L M |
---|
Jump to: | F L M |
---|
Next: Variable index, Previous: Concept index, Up: Indexes [Contents][Index]
Jump to: | (
A D E F G H L M N R S T |
---|
Jump to: | (
A D E F G H L M N R S T |
---|
Next: Data type index, Previous: Function index, Up: Indexes [Contents][Index]
Jump to: | A D N S T |
---|
Jump to: | A D N S T |
---|
Previous: Variable index, Up: Indexes [Contents][Index]
Jump to: | C H M P S |
---|
Jump to: | C H M P S |
---|