AtlatestRenderedmarkdown
Readme

sigil-hooks

Emacs-style hook system for Sigil — register named callbacks and run them on event.

A hook is a list of functions called when a specific event occurs. Multiple handlers can be registered for each hook and are invoked in registration order.

Usage

(import (sigil hooks))

(define on-save (make-hook))

(add-hook! on-save (lambda () (display "Saved!\n")))
(add-hook! on-save (lambda () (display "Logged.\n")))

(run-hook on-save)
;; prints: Saved!
;;         Logged.

Hooks can also receive arguments via run-hook-with-args:

(define on-file-save (make-hook))

(add-hook! on-file-save
  (lambda (filename)
    (display "Saved: ") (display filename) (newline)))

(run-hook-with-args on-file-save "document.txt")

Modules

ModulePurpose
(sigil hooks)Core hook API: make-hook, add-hook!, remove-hook!, clear-hook!, run-hook, run-hook-with-args, hook?, hook-empty?.

Build & Test

sigil deps install
sigil build
sigil test

License

BSD-3-Clause. See LICENSE for details.