The integrated cross-platform development tool for ANSI Common Lisp LispWorks logo

Lisp Knowledgebase

Title: Action Lists

ID: 16007

Product: All
Version: All
OS: All

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*
  (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*
 :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:

Summary:How to add to existing action lists
Patch Enhancement#:

Top | Back