Lisp Knowledgebase
Title: Action Lists
ID: 16007
Product: All Version: All OS: All | |
Description: The Action List facility is documented in the LispWorks User Guide and Reference Manual, and you can define your own action lists following that. There are already a number of action lists in the image shipped and you can use some of these to run your own routines. Examples follow. ---------------------------------------------------------------------- (in-package "CL-USER") (defvar *session-time-log* nil) (defvar *session-start* nil) (defvar *session-end-time* nil) (defvar *session-end* nil) (define-action "When starting image" "Log start time" #'(lambda () (setq *session-time-log* "~/.lisp-sessions") (with-open-file (ss *session-time-log* :direction :output :if-does-not-exist :create :if-exists :append) (format ss "~&Start: ~10T~D" (setq *session-start* (get-universal-time)))))) (define-action "When quitting image" "Log quit time" #'(lambda () (and *session-start* *session-time-log* (with-open-file (ss *session-time-log* :direction :output :if-exists :append) (format ss "~10TEnd: ~10T~D~10TSession time: ~5T~D seconds~%" (setq *session-end* (get-universal-time)) (- *session-end* *session-start*))))) :once ; because "When quitting image" is actually run twice ) (define-action "Initialize LispWorks Tools" "Make an Editor" #'(lambda (screen) (capi:display (make-instance 'lw-tools:editor) :screen screen))) ---------------------------------------------------------------------- | |
See Also: Workaround: Patch: | |
Hardware:N/A | |
Summary:How to add to existing action lists | |
Bug#: | |
Patch Enhancement#: | |
Reported: |