Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the exit-hooks Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 04:30:56 2022 GMT+0.
Next: Systems, Previous: The exit-hooks Reference Manual, Up: The exit-hooks Reference Manual [Contents][Index]
* exit-hooks exit-hooks provide a portable way to automatically call some user defined function when exit Common Lisp (Both ~(quit)~ from REPL or kill in shell). Like ~atexit~ in C and Python or Java's ~Runtime.addShutdownHook()~. It currently support SBCL, CCL, ECL, ABCL, Allegro CL, clisp and CMUCL. Before exit-hooks, there is no portable way to doing so and no staightforward way to use an exit hook on ABCL. It can be used for tasks like parmenantly save something when exit Lisp. ** Installation #+BEGIN_SRC lisp (ql:quickload :exit-hooks) #+END_SRC ** Usage To add a function FUNC called when Common Lisp exits: #+BEGIN_SRC lisp (exit-hooks:add-exit-hook #'func) #+END_SRC The function FUNC must be of zero arguments. If several functions are added this way, their calling sequence is not specified. If you want to call them in a specific sequence, you can simply wrap them into a single function and add it. To visit current exit hooks or delete one, you can visit or delete elements from variable ~exit-hooks:*exit-hooks*~, it's a list contains current exit hooks. But you should not add exit hooks by adding elements to ~*exit-hooks*~, use ~add-exit-hook~ only, because elements in ~*exit-hooks*~ is implementation specific. ** Acknowledgements Thanks to Vibhu Mohindra from ABCL mail list and R. Matthew Emerson from OpenMCL mail list. They provide methods for exit-hooks for ABCL and CCL. And Jocelyn Fréchot gives many useful suggestions and support for clisp, Allegro CL and CMUCL. ** Limitations For some implementation, for example SBCL, when you are using SLIME, you need to exit Lisp in ~*inferior-lisp*~, not ~*slime-repl*~. If you directly run Lisp from shell, not in SLIME, there is no problem. Currently exit-hooks support most of popular Lisp implementations, but not all. If your implementation is not supported and you know how to do that, please tell me. Your work maybe helpful to other fellow Lispers. And this Library only provide a calling function when exit Lisp. Previous version of exit-hooks provide ability to add exit hooks with calling priority, but this can be easily done by wrap several functions into a single one and most people only want a portable layer so this is removed. If you want something to deal all kinds of OS signal handling capability you may have a look at [[https://github.com/guicho271828/trivial-signal][trivial-signal]].
Next: Files, Previous: Introduction, Up: The exit-hooks Reference Manual [Contents][Index]
The main system appears first, followed by any subsystem dependency.
Call registered function when Common Lisp Exits.
Bo Yao <icerove@gmail.com>
BSD
Next: Packages, Previous: Systems, Up: The exit-hooks Reference Manual [Contents][Index]
Files are sorted by type and then listed depth-first from the systems components trees.
Next: exit-hooks/package.lisp, Previous: Lisp, Up: Lisp [Contents][Index]
exit-hooks (system).
Next: exit-hooks/exit-hooks.lisp, Previous: exit-hooks/exit-hooks.asd, Up: Lisp [Contents][Index]
exit-hooks (system).
Previous: exit-hooks/package.lisp, Up: Lisp [Contents][Index]
package.lisp (file).
exit-hooks (system).
Next: Definitions, Previous: Files, Up: The exit-hooks Reference Manual [Contents][Index]
Packages are listed by definition order.
common-lisp.
Next: Indexes, Previous: Packages, Up: The exit-hooks Reference Manual [Contents][Index]
Definitions are sorted by export status, category, package, and then by lexicographic order.
Previous: Definitions, Up: Definitions [Contents][Index]
Next: Ordinary functions, Previous: Public Interface, Up: Public Interface [Contents][Index]
Previous: Symbol macros, Up: Public Interface [Contents][Index]
Previous: Definitions, Up: The exit-hooks Reference Manual [Contents][Index]
Jump to: | A F |
---|
Index Entry | Section | ||
---|---|---|---|
| |||
A | |||
add-exit-hook : | Public ordinary functions | ||
| |||
F | |||
Function, add-exit-hook : | Public ordinary functions | ||
|
Jump to: | A F |
---|
Next: Data types, Previous: Functions, Up: Indexes [Contents][Index]
Jump to: | *
S |
---|
Index Entry | Section | ||
---|---|---|---|
| |||
* | |||
*exit-hooks* : | Public symbol macros | ||
| |||
S | |||
Symbol Macro, *exit-hooks* : | Public symbol macros | ||
|
Jump to: | *
S |
---|
Jump to: | E F P S |
---|
Jump to: | E F P S |
---|