The modularize-hooks Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The modularize-hooks Reference Manual

This is the modularize-hooks Reference Manual, version 1.0.2, generated automatically by Declt version 2.3 "Robert April" on Wed Mar 14 04:19:46 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

About Modularize-Hooks

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.

How To

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: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 modularize-hooks

Maintainer

Nicolas Hafner <shinmera@tymoon.eu>

Author

Nicolas Hafner <shinmera@tymoon.eu>

Home Page

https://github.com/Shinmera/modularize-hooks

License

Artistic

Description

Generic hooks and triggers extension for modularize.

Version

1.0.2

Dependencies
Source

modularize-hooks.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 modularize-hooks.asd

Location

modularize-hooks.asd

Systems

modularize-hooks (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 modularize-hooks/package.lisp

Parent

modularize-hooks (system)

Location

package.lisp

Packages

modularize-hooks


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.3 modularize-hooks/toolkit.lisp

Dependency

package.lisp (file)

Parent

modularize-hooks (system)

Location

toolkit.lisp

Internal Definitions

function-lambda-matches (function)


Previous: , Up: Lisp files   [Contents][Index]

3.1.4 modularize-hooks/hooks.lisp

Dependency

toolkit.lisp (file)

Parent

modularize-hooks (system)

Location

hooks.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 modularize-hooks

Source

package.lisp (file)

Nicknames
Use List
Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Macros

Macro: define-hook NAME ARGS &optional DOCUMENTATION

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.

Package

modularize-hooks

Source

hooks.lisp (file)

Macro: define-hook-switch ON OFF ARGS
Package

modularize-hooks

Source

hooks.lisp (file)

Macro: define-trigger HOOK ARGS &body BODY

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)

Package

modularize-hooks

Source

hooks.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Functions

Function: dehookify &optional MODULE

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.

Package

modularize-hooks

Source

hooks.lisp (file)

Function: hook NAME &optional MODULE ERROR
Function: (setf hook) HOOK NAME &optional MODULE
Package

modularize-hooks

Source

hooks.lisp (file)

Function: hookify &optional MODULE

Turns the module into one capable of hooks.

In essence this merely defines a new package with a matching name.

Package

modularize-hooks

Source

hooks.lisp (file)

Function: list-hooks &optional MODULE
Package

modularize-hooks

Source

hooks.lisp (file)

Function: remove-hook NAME &optional MODULE

Removes the hook as named.

Package

modularize-hooks

Source

hooks.lisp (file)

Function: remove-trigger HOOK &optional IDENT MODULE

Attempts to remove the trigger from the hook.

Package

modularize-hooks

Source

hooks.lisp (file)

Function: trigger HOOK &rest ARGS

Calls all triggers registered on the hook with the given arguments.

Package

modularize-hooks

Source

hooks.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.3 Generic functions

Generic Function: arglist OBJECT
Generic Function: (setf arglist) NEW-VALUE OBJECT
Package

modularize-hooks

Methods
Method: arglist (HOOK hook)

automatically generated reader method

Source

hooks.lisp (file)

Method: (setf arglist) NEW-VALUE (HOOK hook)

automatically generated writer method

Source

hooks.lisp (file)

Generic Function: docstring OBJECT
Generic Function: (setf docstring) NEW-VALUE OBJECT
Package

modularize-hooks

Methods
Method: docstring (HOOK hook)

automatically generated reader method

Source

hooks.lisp (file)

Method: (setf docstring) NEW-VALUE (HOOK hook)

automatically generated writer method

Source

hooks.lisp (file)

Generic Function: name OBJECT
Generic Function: (setf name) NEW-VALUE OBJECT
Package

modularize-hooks

Methods
Method: name (HOOK hook)

automatically generated reader method

Source

hooks.lisp (file)

Method: (setf name) NEW-VALUE (HOOK hook)

automatically generated writer method

Source

hooks.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.4 Classes

Class: hook ()
Package

modularize-hooks

Source

hooks.lisp (file)

Direct superclasses

standard-object (class)

Direct subclasses

sticky-hook (class)

Direct methods
  • find-trigger (method)
  • find-trigger (method)
  • find-trigger (method)
  • run-triggers (method)
  • documentation (method)
  • documentation (method)
  • print-object (method)
  • docstring (method)
  • docstring (method)
  • triggers (method)
  • triggers (method)
  • arglist (method)
  • arglist (method)
  • name (method)
  • name (method)
Direct slots
Slot: name
Initargs

:name

Readers

name (generic function)

Writers

(setf name) (generic function)

Slot: arglist
Initargs

:arglist

Readers

arglist (generic function)

Writers

(setf arglist) (generic function)

Slot: triggers
Initform

(make-hash-table :test (quote eql))

Readers

triggers (generic function)

Writers

(setf triggers) (generic function)

Slot: docstring
Initargs

:docstring

Readers

docstring (generic function)

Writers

(setf docstring) (generic function)

Direct Default Initargs
InitargValue
:name(error "name required.")
:arglistnil
:docstringnil
Class: sticky-hook ()
Package

modularize-hooks

Source

hooks.lisp (file)

Direct superclasses

hook (class)

Direct methods
Direct slots
Slot: stuck-args
Readers

stuck-args (generic function)

Writers

(setf stuck-args) (generic function)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Functions

Function: enlist A &rest ARGS
Package

modularize-hooks

Source

hooks.lisp (file)

Function: function-lambda-matches CUR ACT

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.

Package

modularize-hooks

Source

toolkit.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Generic functions

Generic Function: find-trigger NAME HOOK
Generic Function: (setf find-trigger) FUNCTION NAME HOOK
Package

modularize-hooks

Methods
Method: find-trigger NAME (HOOK hook)
Source

hooks.lisp (file)

Method: (setf find-trigger) (FUNCTION function) NAME (HOOK sticky-hook) after
Source

hooks.lisp (file)

Generic Function: run-triggers HOOK ARGS
Package

modularize-hooks

Methods
Method: run-triggers (HOOK sticky-hook) ARGS after
Source

hooks.lisp (file)

Method: run-triggers (HOOK hook) ARGS
Source

hooks.lisp (file)

Generic Function: stuck-args OBJECT
Generic Function: (setf stuck-args) NEW-VALUE OBJECT
Package

modularize-hooks

Methods
Method: stuck-args (STICKY-HOOK sticky-hook)

automatically generated reader method

Source

hooks.lisp (file)

Method: (setf stuck-args) NEW-VALUE (STICKY-HOOK sticky-hook)

automatically generated writer method

Source

hooks.lisp (file)

Generic Function: triggers OBJECT
Generic Function: (setf triggers) NEW-VALUE OBJECT
Package

modularize-hooks

Methods
Method: triggers (HOOK hook)

automatically generated reader method

Source

hooks.lisp (file)

Method: (setf triggers) NEW-VALUE (HOOK hook)

automatically generated writer method

Source

hooks.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   L   M  
Index Entry  Section

F
File, Lisp, modularize-hooks.asd: The modularize-hooks<dot>asd file
File, Lisp, modularize-hooks/hooks.lisp: The modularize-hooks/hooks<dot>lisp file
File, Lisp, modularize-hooks/package.lisp: The modularize-hooks/package<dot>lisp file
File, Lisp, modularize-hooks/toolkit.lisp: The modularize-hooks/toolkit<dot>lisp file

L
Lisp File, modularize-hooks.asd: The modularize-hooks<dot>asd file
Lisp File, modularize-hooks/hooks.lisp: The modularize-hooks/hooks<dot>lisp file
Lisp File, modularize-hooks/package.lisp: The modularize-hooks/package<dot>lisp file
Lisp File, modularize-hooks/toolkit.lisp: The modularize-hooks/toolkit<dot>lisp file

M
modularize-hooks.asd: The modularize-hooks<dot>asd file
modularize-hooks/hooks.lisp: The modularize-hooks/hooks<dot>lisp file
modularize-hooks/package.lisp: The modularize-hooks/package<dot>lisp file
modularize-hooks/toolkit.lisp: The modularize-hooks/toolkit<dot>lisp file

Jump to:   F   L   M  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   (  
A   D   E   F   G   H   L   M   N   R   S   T  
Index Entry  Section

(
(setf arglist): Exported generic functions
(setf arglist): Exported generic functions
(setf docstring): Exported generic functions
(setf docstring): Exported generic functions
(setf find-trigger): Internal generic functions
(setf find-trigger): Internal generic functions
(setf hook): Exported functions
(setf name): Exported generic functions
(setf name): Exported generic functions
(setf stuck-args): Internal generic functions
(setf stuck-args): Internal generic functions
(setf triggers): Internal generic functions
(setf triggers): Internal generic functions

A
arglist: Exported generic functions
arglist: Exported generic functions

D
define-hook: Exported macros
define-hook-switch: Exported macros
define-trigger: Exported macros
dehookify: Exported functions
docstring: Exported generic functions
docstring: Exported generic functions

E
enlist: Internal functions

F
find-trigger: Internal generic functions
find-trigger: Internal generic functions
Function, (setf hook): Exported functions
Function, dehookify: Exported functions
Function, enlist: Internal functions
Function, function-lambda-matches: Internal functions
Function, hook: Exported functions
Function, hookify: Exported functions
Function, list-hooks: Exported functions
Function, remove-hook: Exported functions
Function, remove-trigger: Exported functions
Function, trigger: Exported functions
function-lambda-matches: Internal functions

G
Generic Function, (setf arglist): Exported generic functions
Generic Function, (setf docstring): Exported generic functions
Generic Function, (setf find-trigger): Internal generic functions
Generic Function, (setf name): Exported generic functions
Generic Function, (setf stuck-args): Internal generic functions
Generic Function, (setf triggers): Internal generic functions
Generic Function, arglist: Exported generic functions
Generic Function, docstring: Exported generic functions
Generic Function, find-trigger: Internal generic functions
Generic Function, name: Exported generic functions
Generic Function, run-triggers: Internal generic functions
Generic Function, stuck-args: Internal generic functions
Generic Function, triggers: Internal generic functions

H
hook: Exported functions
hookify: Exported functions

L
list-hooks: Exported functions

M
Macro, define-hook: Exported macros
Macro, define-hook-switch: Exported macros
Macro, define-trigger: Exported macros
Method, (setf arglist): Exported generic functions
Method, (setf docstring): Exported generic functions
Method, (setf find-trigger): Internal generic functions
Method, (setf name): Exported generic functions
Method, (setf stuck-args): Internal generic functions
Method, (setf triggers): Internal generic functions
Method, arglist: Exported generic functions
Method, docstring: Exported generic functions
Method, find-trigger: Internal generic functions
Method, name: Exported generic functions
Method, run-triggers: Internal generic functions
Method, run-triggers: Internal generic functions
Method, stuck-args: Internal generic functions
Method, triggers: Internal generic functions

N
name: Exported generic functions
name: Exported generic functions

R
remove-hook: Exported functions
remove-trigger: Exported functions
run-triggers: Internal generic functions
run-triggers: Internal generic functions
run-triggers: Internal generic functions

S
stuck-args: Internal generic functions
stuck-args: Internal generic functions

T
trigger: Exported functions
triggers: Internal generic functions
triggers: Internal generic functions

Jump to:   (  
A   D   E   F   G   H   L   M   N   R   S   T  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   A   D   N   S   T  
Index Entry  Section

A
arglist: Exported classes

D
docstring: Exported classes

N
name: Exported classes

S
Slot, arglist: Exported classes
Slot, docstring: Exported classes
Slot, name: Exported classes
Slot, stuck-args: Exported classes
Slot, triggers: Exported classes
stuck-args: Exported classes

T
triggers: Exported classes

Jump to:   A   D   N   S   T  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   C   H   M   P   S  
Index Entry  Section

C
Class, hook: Exported classes
Class, sticky-hook: Exported classes

H
hook: Exported classes

M
modularize-hooks: The modularize-hooks system
modularize-hooks: The modularize-hooks package

P
Package, modularize-hooks: The modularize-hooks package

S
sticky-hook: Exported classes
System, modularize-hooks: The modularize-hooks system

Jump to:   C   H   M   P   S