| 1 |
Source: fsm-el |
| 2 |
Section: lisp |
| 3 |
Priority: optional |
| 4 |
Maintainer: Debian Emacsen team <[email protected]> |
| 5 |
Uploaders: Matteo F. Vescovi <[email protected]> |
| 6 |
Build-Depends: debhelper (>= 11~), dh-elpa |
| 7 |
Standards-Version: 4.1.4 |
| 8 |
Vcs-Browser: https://salsa.debian.org/emacsen-team/fsm-el |
| 9 |
Vcs-Git: https://salsa.debian.org/emacsen-team/fsm-el.git |
| 10 |
Homepage: http://elpa.gnu.org/packages/fsm.html |
| 11 |
Testsuite: autopkgtest-pkg-elpa |
| 12 |
|
| 13 |
Package: elpa-fsm |
| 14 |
Architecture: all |
| 15 |
Depends: ${elpa:Depends}, ${misc:Depends}, emacs |
| 16 |
Recommends: emacs (>= 46.0) |
| 17 |
Enhances: emacs, emacs24, emacs25 |
| 18 |
Built-Using: ${misc:Built-Using} |
| 19 |
Description: state machine library |
| 20 |
fsm.el is an exercise in metaprogramming inspired by gen_fsm of |
| 21 |
Erlang/OTP. It aims to make asynchronous programming in Emacs Lisp |
| 22 |
easy and fun. By "asynchronous" I mean that long-lasting tasks |
| 23 |
don't interfer with normal editing. |
| 24 |
. |
| 25 |
Some people say that it would be nice if Emacs Lisp had threads |
| 26 |
and/or continuations. They are probably right, but there are few |
| 27 |
things that can't be made to run in the background using facilities |
| 28 |
already available: timers, filters and sentinels. As the code can |
| 29 |
become a bit messy when using such means, with callbacks everywhere |
| 30 |
and such things, it can be useful to structure the program as a |
| 31 |
state machine. |
| 32 |
. |
| 33 |
In this model, a state machine passes between different "states", |
| 34 |
which are actually only different event handler functions. The |
| 35 |
state machine receives "events" (from timers, filters, user |
| 36 |
requests, etc) and reacts to them, possibly entering another state, |
| 37 |
possibly returning a value. |
| 38 |
. |
| 39 |
The essential macros/functions are: |
| 40 |
;; |
| 41 |
define-state-machine - create start-FOO function |
| 42 |
define-state - event handler for each state (required) |
| 43 |
define-enter-state - called when entering a state (optional) |
| 44 |
define-fsm - encapsulates the above three (more sugar!) |
| 45 |
fsm-send - send an event to a state machine |
| 46 |
fsm-call - send an event and wait for reply |
| 47 |
. |
| 48 |
fsm.el is similar to but different from Distel: |
| 49 |
<URL:http://fresh.homeunix.net/~luke/distel/> |
| 50 |
Emacs' tq library is a similar idea. |