; File "lisp-init.lisp" for initializing Lucid Common Lisp. (in-package 'user) ; Read all about packages if you want in ; the documentation. If you don't want to ; worry about them, just put this line at ; the beginning of all your lisp files. ; This causes Lucid to assume that any ; file you load ends in ".l". (setq *load-source-pathname-types* '("l" NIL)) (setq *load-if-source-newer* ':load-source) ; This tells Lucid to load the source file ; rather than the binary file if both exist ; and the source is newer. ; All of the following constants are for initializing Lucid's ; window system. You should read the documentation on the ; window system at some point if you are going to use any ; graphics. There is a "root-viewport" which is a window in ; which all other windows reside. My Lisp is set up so that ; I have a Lisp editor window and a graphics window on top of ; the root viewport. ; Width of the root viewport window. ; (defconstant %root-viewport-width% 1152) (defconstant %root-viewport-width% 940) ; Height of the root viewport window. (defconstant %root-viewport-height% 900) ; Coordinates (with respect to the screen) ; of the upper-left-corner of the root viewport window. (defconstant %root-viewport-x% 0) (defconstant %root-viewport-y% 0) ; Width of the lisp-editor window. (defconstant %lisp-window-width% %root-viewport-width%) ; Height of the lisp-editor window. (defconstant %lisp-window-height% 150) ; Coordinates (with respect to the root viewport window) ; of the lisp-editor window. (defconstant %lisp-window-x% 0) (defconstant %lisp-window-y% 0) ; Width of the graphics window. (defconstant %graphics-viewport-width% %root-viewport-width%) ; Height of the graphics window. (defconstant %graphics-viewport-height% (- %root-viewport-height% %lisp-window-height%)) ; Coordinates (with respect to the ; root viewport window) of the graphics window. (defconstant %graphics-viewport-x% %lisp-window-x%) (defconstant %graphics-viewport-y% (+ %lisp-window-y% %lisp-window-height%)) ; Escape sequences sent by the arrow keys. (defconstant up-arrow #(#\ESC #\[ #\A)) (defconstant down-arrow #(#\ESC #\[ #\B)) (defconstant left-arrow #(#\ESC #\[ #\D)) (defconstant right-arrow #(#\ESC #\[ #\C)) ; Escape sequences sent by the mouse buttons. (defconstant mouse-left-down #(#\Mouse-left-down)) (defconstant mouse-middle-down #(#\Mouse-middle-down)) (defconstant mouse-right-down #(#\Mouse-right-down)) (defconstant mouse-left-up #(#\Mouse-left-up)) (defconstant mouse-middle-up #(#\Mouse-middle-up)) (defconstant mouse-right-up #(#\Mouse-right-up)) (defconstant mouse-left #(#\Mouse-left)) (defconstant mouse-middle #(#\Mouse-middle)) (defconstant mouse-right #(#\Mouse-right)) ;--------------------------------------------- (defun production-mode () (proclaim '(optimize (compilation-speed 0) (safety 1) (speed 3))) ; Floating point coprocessor ; (compiler-options :target 'sun-68881)) ) ; This function sets up key bindings for editor. (defun bind-editor-keys () (ed:bind-key "Backward Character" left-arrow) (ed:bind-key "Forward Character" right-arrow) (ed:bind-key "Previous Line" up-arrow) (ed:bind-key "Next Line" down-arrow) (ed:bind-key "Nothing" mouse-left-up) (ed:bind-key "Nothing" mouse-left) (ed:bind-key "Nothing" mouse-middle-up) (ed:bind-key "Nothing" mouse-middle) (ed:bind-key "Nothing" mouse-right-up) (ed:bind-key "Nothing" mouse-right) (ed:bind-key "Scroll Window Up" mouse-middle-down) (ed:bind-key "Scroll Window Down" mouse-left-down) (ed:bind-key "Point to Here" mouse-right-down) (ed:bind-key "Kill Region" #\control-w) ; Use this to scroll backwards through previous Lisp commands. (ed:bind-key "Previous Top-Level Input" #\control-p) ; Use this to scroll forwards through Lisp commands. (ed:bind-key "Next Top-Level Input" #\control-n) ; Use this to search backwards through previous Lisp commands. (ed:bind-key "Searching Previous Top-Level Input" #\control-t) ; Use this to search forwards through Lisp commands. (ed:bind-key "Searching Next Top-Level Input" #\control-j) (ed:bind-key "Forward Search" #\control-s) (ed:bind-key "Reverse Search" #\control-r) (ed:bind-key "Move Editor Frame" #\meta-m) (ed:bind-key "Reshape Editor Frame" #\meta-s) (ed:bind-key "Expand Editor Frame" #\meta-e) (ed:bind-key "go to top-level" #\meta-g) (ed:bind-key "reload" #\meta-l) (ed:bind-key "update" #\meta-u) (ed:bind-key "load ccat-sys" #\meta-k)) ;--------------------------------------------- ; This function initializes the editor. (defun init-editor () ; This defines an editor command that does nothing. I assign ; this to the "mouse-button-up" sequence, etc. so that such ; sequences will be ignored by the editor. (ed:defcommand "Nothing" (a) "Do nothing." ; Do nothing. I put in the parameter "a" because ; the system complained when I had a null argument list. ) (editor:defcommand "load ccat-sys" (editor::p) "this is a saved named keyboard macro" (editor::with-kbdmac-bindings (editor::execute-kbd-macro (editor::insert-string-at-point "(load \"ccat-sys\"") (editor::insert-character-at-point #\))))) (editor:defcommand "reload" (editor::p) "this is a saved named keyboard macro" (editor::with-kbdmac-bindings (editor::execute-kbd-macro (editor::insert-string-at-point "(reload") (editor::insert-character-at-point #\))))) (editor:defcommand "update" (editor::p) "this is a saved named keyboard macro" (editor::with-kbdmac-bindings (editor::execute-kbd-macro (editor::insert-string-at-point "(update") (editor::insert-character-at-point #\))))) (editor:defcommand "go to top-level" (editor::p) "this is a saved named keyboard macro" (editor::with-kbdmac-bindings (editor::execute-kbd-macro (editor::insert-string-at-point ":a :t") (setq editor:*last-character-typed* #\return) (editor:new-line-command nil)))) (ed:setv ed:paren-pause-period 0) ; Make the pause short. (bind-editor-keys)) ; This sets up the root viewport window. (defun init-windows () (initialize-windows :width %root-viewport-width% :height %root-viewport-height% :screen-x %root-viewport-x% :screen-y %root-viewport-y%) ; This sets up the Lisp editor window. (edit :windows t :width %lisp-window-width% :height %lisp-window-height% :x %lisp-window-x% :y %lisp-window-y% :entry-function #'(lambda () (init-editor)))) (setq *print-case* :downcase) ; Output from system is in lower case. ; Use this if starting up the program from scratch, not from a ; lisp that has been "disksaved" with Copycat files loaded into it. (init-windows)