1 ;;; -*- Mode: Emacs-Lisp -*-
3 ;;; ILD: A common Common Lisp debugger user interface for ILisp.
4 ;;; ---Jeffrey Mark Siskind
6 ;;; This file is part of ILISP.
7 ;;; Please refer to the file COPYING for copyrights and licensing
9 ;;; Please refer to the file ACKNOWLEGDEMENTS for an (incomplete) list
10 ;;; of present and past contributors.
12 ;;; $Id: ild.el,v 1.3 2002-06-03 23:36:58 wbd Exp $
14 ;;; Keystroke c-u? What it does
15 ;;; ---------------------------------------------------------
18 ;;; c-m-n * Next stack frame
19 ;;; c-m-p * Previous stack frame
20 ;;; c-c < Top stack frame
21 ;;; c-c > Bottom stack frame
23 ;;; c-m-d Display all locals
24 ;;; c-m-l * Display particular local
27 ;;; c-x t Trap on exit
28 ;;; c-c L Select Lisp interaction buffer
29 ;;; c-z c-s Sets compiler options for maximally debuggablity
30 ;;; c-z c-f Sets compiler options for fastest but least debuggable code
33 ;;; We really just need ILISP Key management.
34 ;;; 19990615 Marco Antoniotti
39 (deflocal ild-abort-string nil)
40 (deflocal ild-continue-string nil)
41 (deflocal ild-step-string nil)
42 (deflocal ild-step-string-arg nil)
43 (deflocal ild-next-string nil)
44 (deflocal ild-next-string-arg nil)
45 (deflocal ild-previous-string nil)
46 (deflocal ild-previous-string-arg nil)
47 (deflocal ild-top-string nil)
48 (deflocal ild-bottom-string nil)
49 (deflocal ild-backtrace-string nil)
50 (deflocal ild-locals-string nil)
51 (deflocal ild-local-string-arg nil)
52 (deflocal ild-return-string nil)
53 (deflocal ild-retry-string nil)
54 (deflocal ild-trap-on-exit-string nil)
56 (defun ild-debugger-command (string)
57 (process-send-string (get-buffer-process (current-buffer))
58 (format "%s\n" string)))
69 (ild-debugger-command ild-abort-string)
72 (defun ild-continue (&optional arg)
75 (if ild-continue-string
76 (ild-debugger-command ild-continue-string)
78 (if arg (capitalize-word arg) (capitalize-word 1))))
80 (defun ild-step (&optional arg)
83 (if ild-step-string-arg
84 (ild-debugger-command (format ild-step-string-arg arg))
87 (ild-debugger-command ild-step-string)
90 (defun ild-next (&optional arg)
93 (if ild-next-string-arg
94 (ild-debugger-command (format ild-next-string-arg arg))
97 (ild-debugger-command ild-next-string)
100 (defun ild-previous (&optional arg)
103 (if ild-previous-string-arg
104 (ild-debugger-command (format ild-previous-string-arg arg))
106 (if ild-previous-string
107 (ild-debugger-command ild-previous-string)
110 (defun ild-top (&optional arg)
113 (ild-debugger-command ild-top-string)
116 (defun ild-bottom (&optional arg)
118 (if ild-bottom-string
119 (ild-debugger-command ild-bottom-string)
122 (defun ild-backtrace (&optional arg)
125 (if ild-backtrace-string
126 (ild-debugger-command ild-backtrace-string)
128 (if arg (backward-word arg) (backward-word 1))))
130 (defun ild-locals (&optional arg)
132 (if ild-locals-string
133 (ild-debugger-command ild-locals-string)
136 (defun ild-local (&optional arg)
139 (if ild-local-string-arg
140 (ild-debugger-command (format ild-local-string-arg arg))
142 (if ild-locals-string
143 (ild-debugger-command ild-locals-string)
148 (if ild-return-string
149 (ild-debugger-command ild-return-string)
155 (ild-debugger-command ild-retry-string)
158 (defun ild-trap-on-exit (&optional arg)
160 (if ild-trap-on-exit-string
161 (ild-debugger-command ild-trap-on-exit-string)
165 "Use the production compiler."
167 (ilisp-send "(progn (proclaim '(optimize (speed 3) (safety 0) (space 0) (compilation-speed 0) (debug 0))) #+akcl (use-fast-links t))"))
170 "Use the development compiler."
172 (ilisp-send "(progn (proclaim '(optimize (speed 0) (safety 3) (space 3) (compilation-speed 3) (debug 3))) #+akcl (use-fast-links nil))"))
174 (defun select-lisp ()
175 "Select the lisp buffer in one window mode"
177 (cond ((and (member* ilisp-buffer (buffer-list)
180 (get-buffer-process (get-buffer ilisp-buffer)))
181 (delete-other-windows)
182 (switch-to-buffer ilisp-buffer))
183 (t (lucid) ; put your favorite Lisp here
184 (delete-other-windows))))
186 (defun select-ilisp (arg)
187 "Select the current ILISP buffer."
190 (member* (buffer-name (current-buffer)) ilisp-buffers
191 :test (function (lambda (x y)
192 (equal x (format "*%s*" (car y)))))))
193 (setq ilisp-buffer (buffer-name (current-buffer)))
194 (let ((new (completing-read
196 (format "Buffer [%s]: "
197 (substring ilisp-buffer
199 (1- (length ilisp-buffer))))
201 ilisp-buffers nil t)))
202 (unless (zerop (length new))
203 (setq ilisp-buffer (format "*%s*" new))))))
205 ;;; This fixes a bug in ILISP 4.1
208 ;;; 19990818 Marco Antoniotti
209 ;;; Fixed in the proper place.
211 ;(defun defkey-ilisp (key command &optional inferior-only)
212 ; "Define KEY as COMMAND in ilisp-mode-map and lisp-mode-map unless
213 ;optional INFERIOR-ONLY is T. If the maps do not exist they will be
214 ;created. This should only be called after ilisp-prefix is set to the
216 ; (if (not ilisp-mode-map) (ilisp-bindings))
217 ; (define-key ilisp-mode-map key command)
218 ; (if (not inferior-only) (define-key lisp-mode-map key command)))
220 ;;; This is a convenient command since c-Z c-W doesn't default to the whole
221 ;;; buffer if there is no region
223 (defun compile-buffer ()
224 "Compile the current buffer"
226 (compile-region-and-go-lisp (point-min) (point-max)))
228 (defkey-ilisp "\M-a" 'ild-abort t 'no-fsf-key)
229 (defkey-ilisp "\M-c" 'ild-continue t 'no-fsf-key)
230 (defkey-ilisp "\C-\M-s" 'ild-step t 'no-fsf-key)
231 (defkey-ilisp "\C-\M-n" 'ild-next t 'no-fsf-key)
232 (defkey-ilisp "\C-\M-p" 'ild-previous t 'no-fsf-key)
233 (defkey-ilisp "\C-c<" 'ild-top t 'no-fsf-key)
234 (defkey-ilisp "\C-c>" 'ild-bottom t 'no-fsf-key)
235 (defkey-ilisp "\M-b" 'ild-backtrace t 'no-fsf-key)
236 (defkey-ilisp "\C-\M-d" 'ild-locals t 'no-fsf-key)
237 (defkey-ilisp "\C-\M-l" 'ild-local t 'no-fsf-key)
238 (defkey-ilisp "\C-cr" 'ild-return t 'no-fsf-key)
239 (defkey-ilisp "\C-\M-r" 'ild-retry t 'no-fsf-key)
240 (defkey-ilisp "\C-xt" 'ild-trap-on-exit t 'no-fsf-key)
242 (ilisp-safe-define-key global-map "\C-cL" 'select-lisp 'no-fsf-key)
244 (ilisp-bind-ilisp-key-for-map lisp-mode-map "\C-f" 'fast-lisp 'no-fsf-key)
245 (ilisp-bind-ilisp-key-for-map ilisp-mode-map "\C-f" 'fast-lisp 'no-fsf-key)
246 (ilisp-bind-ilisp-key-for-map lisp-mode-map "\C-s" 'slow-lisp 'no-fsf-key)
247 (ilisp-bind-ilisp-key-for-map ilisp-mode-map "\C-s" 'slow-lisp 'no-fsf-key)
249 ;;; end of file -- ild.el --