comparison lisp/ilisp/ilisp-key.el @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children b82b59fe008d
comparison
equal deleted inserted replaced
-1:000000000000 0:376386a54a3c
1 ;;; -*- Mode: Emacs-Lisp -*-
2
3 ;;; ilisp-key.el --
4
5 ;;; This file is part of ILISP.
6 ;;; Version: 5.7
7 ;;;
8 ;;; Copyright (C) 1990, 1991, 1992, 1993 Chris McConnell
9 ;;; 1993, 1994 Ivan Vasquez
10 ;;; 1994, 1995 Marco Antoniotti and Rick Busdiecker
11 ;;;
12 ;;; Other authors' names for which this Copyright notice also holds
13 ;;; may appear later in this file.
14 ;;;
15 ;;; Send mail to 'ilisp-request@lehman.com' to be included in the
16 ;;; ILISP mailing list. 'ilisp@lehman.com' is the general ILISP
17 ;;; mailing list were bugs and improvements are discussed.
18 ;;;
19 ;;; ILISP is freely redistributable under the terms found in the file
20 ;;; COPYING.
21
22
23
24 ;;;
25 ;;; ILISP keybinding definitions.
26 ;;;
27
28
29 ;;; ilisp-where-is --
30 ;;; New version provided by yusuf@SPD-13.ils.nwu.edu (Yusuf Pisan)
31 ;;; Note: this used to be in 'ilisp-cpat'. Its definition did not make
32 ;;; much sense. Yusuf noted this and I decided to move it in
33 ;;; this file (where I think is more approriate).
34 ;;; 11/24/94: Marco Antoniotti
35
36 (defun ilisp-where-is (command)
37 (let ((cmd (where-is-internal command nil t)))
38 (if cmd (key-description cmd))))
39
40
41 ;;;
42 ;;;%Bindings
43 (defun ilisp-defkey (keymap key command)
44 "Define KEYMAP ilisp-prefix+KEY as command."
45 (let ((prefix-map (lookup-key keymap ilisp-prefix)))
46 (if (not (keymapp prefix-map))
47 (setq prefix-map
48 (define-key keymap ilisp-prefix (make-sparse-keymap))))
49 (define-key prefix-map key command)))
50
51 (defun defkey-ilisp (key command)
52 "Define KEY as COMMAND in ilisp-mode-map and lisp-mode-map"
53 (if (not ilisp-mode-map) (ilisp-bindings))
54 (define-key ilisp-mode-map key command)
55 (define-key lisp-mode-map key command))
56
57 ;;;
58 (defun lisp-bindings (keymap &optional inferior-p)
59 "Set up the bindings for interacting with an inferior LISP in
60 KEYMAP."
61 (if inferior-p
62 (progn (define-key keymap "\C-m" 'return-ilisp)
63 (define-key keymap "\C-a" 'bol-ilisp)
64 (define-key keymap "\C-c\C-c" 'interrupt-subjob-ilisp)
65 (define-key keymap "\C-d" 'delete-char-or-pop-ilisp)
66 (ilisp-defkey keymap "#" 'raw-keys-ilisp))
67 (ilisp-defkey keymap "\C-c" 'compile-defun-and-go-lisp)
68 (define-key keymap "\C-m" 'newline-and-indent-lisp))
69
70 (define-key keymap "]" 'close-all-lisp)
71 (define-key keymap "\M-q" 'reindent-lisp)
72 (define-key keymap "\C-]" 'close-and-send-lisp)
73 (define-key keymap "\t" 'indent-line-ilisp)
74 (define-key keymap "\n" 'newline-and-indent-lisp)
75 (define-key keymap "\M-\C-q" 'indent-sexp-ilisp)
76 (ilisp-defkey keymap ";" 'comment-region-lisp)
77 (ilisp-defkey keymap ")" 'find-unbalanced-lisp)
78 (define-key keymap "\M-\C-a" 'beginning-of-defun-lisp)
79 (define-key keymap "\M-\C-e" 'end-of-defun-lisp)
80 (define-key keymap "\C-\M-r" 'reposition-window-lisp)
81 (ilisp-defkey keymap "i" 'describe-lisp)
82 (ilisp-defkey keymap "I" 'inspect-lisp)
83 (ilisp-defkey keymap "a" 'arglist-lisp)
84 (ilisp-defkey keymap "d" 'documentation-lisp)
85 (ilisp-defkey keymap "m" 'macroexpand-1-lisp)
86 (ilisp-defkey keymap "M" 'macroexpand-lisp)
87 (define-key keymap "\M-," 'next-definition-lisp)
88 (define-key keymap "\M-." 'edit-definitions-lisp)
89 (define-key keymap "\M-?" 'search-lisp)
90 (define-key keymap "\M-\"" 'replace-lisp)
91 (ilisp-defkey keymap "^" 'edit-callers-lisp)
92 (define-key keymap "\M-`" 'next-caller-lisp)
93 (define-key keymap "\M-\t" 'complete-lisp)
94 (define-key keymap "\M-\C-m" 'complete)
95 (ilisp-defkey keymap "r" 'eval-region-lisp)
96 (define-key keymap "\M-\C-x" 'eval-defun-lisp) ; Gnu convention
97 (ilisp-defkey keymap "e" 'eval-defun-lisp)
98 (ilisp-defkey keymap "n" 'eval-next-sexp-lisp)
99 (ilisp-defkey keymap "p" 'package-lisp)
100 (ilisp-defkey keymap "P" 'set-package-lisp)
101 (ilisp-defkey keymap "w" 'compile-region-lisp)
102 (ilisp-defkey keymap "c" 'compile-defun-lisp)
103 (ilisp-defkey keymap "\C-r" 'eval-region-and-go-lisp)
104 (ilisp-defkey keymap "\C-e" 'eval-defun-and-go-lisp)
105 (ilisp-defkey keymap "\C-n" 'eval-next-sexp-and-go-lisp)
106 (ilisp-defkey keymap "\C-w" 'compile-region-and-go-lisp)
107 (ilisp-defkey keymap "t" 'trace-defun-lisp)
108 (ilisp-defkey keymap "!" 'default-directory-lisp)
109 (ilisp-defkey keymap " " 'mark-change-lisp)
110 (let ((ilisp-prefix (concat ilisp-prefix "*")))
111 (ilisp-defkey keymap "l" 'list-changes-lisp)
112 (ilisp-defkey keymap "e" 'eval-changes-lisp)
113 (ilisp-defkey keymap "c" 'compile-changes-lisp)
114 (ilisp-defkey keymap "0" 'clear-changes-lisp))
115 (ilisp-defkey keymap "b" 'switch-to-lisp)
116 (ilisp-defkey keymap "y" 'call-defun-lisp)
117 (ilisp-defkey keymap "z" 'reset-ilisp)
118 (ilisp-defkey keymap "g" 'abort-commands-lisp)
119 (ilisp-defkey keymap "s" 'status-lisp)
120 (ilisp-defkey keymap "S" 'select-ilisp)
121 (define-key keymap "\C-x\C-f" 'find-file-lisp)
122 (ilisp-defkey keymap "l" 'load-file-lisp)
123 (ilisp-defkey keymap "k" 'compile-file-lisp)
124 (ilisp-defkey keymap "A" 'fi:clman-apropos)
125 (ilisp-defkey keymap "D" 'fi:clman))
126
127
128
129 ;;
130 (defun ilisp-lispm-bindings ()
131 "Setup additional Lisp Machine-like bindings for some ilisp commands"
132 (interactive)
133 ;; Note: Changed the 'ilisp-emacs-version-id' to
134 ;; '+ilisp-emacs-version-id+' and the 'gnu-*' to 'fsf-*'.
135 ;; 25/11/94 Marco Antoniotti
136 (cond ((eq +ilisp-emacs-version-id+ 'fsf-18))
137 ((eq +ilisp-emacs-version-id+ 'fsf-19)
138 (defkey-ilisp (read "[?\\S-\\C-a]") 'arglist-lisp)
139 (defkey-ilisp (read "[?\\S-\\C-c]") 'compile-defun-lisp)
140 (defkey-ilisp (read "[?\\S-\\C-d]") 'documentation-lisp)
141 (defkey-ilisp (read "[?\\S-\\C-e]") 'eval-defun-lisp)
142 (defkey-ilisp (read "[?\\S-\\C-m]") 'macroexpand-1-lisp)
143 (defkey-ilisp (read "[?\\M-M]") 'macroexpand-lisp))
144 (t
145 (defkey-ilisp '(control A) 'arglist-lisp)
146 (defkey-ilisp '(control C) 'compile-defun-lisp)
147 (defkey-ilisp '(control D) 'documentation-lisp)
148 (defkey-ilisp '(control E) 'eval-defun-lisp)
149 (defkey-ilisp '(control M) 'macroexpand-1-lisp)
150 (defkey-ilisp '(meta M) 'macroexpand-lisp))))
151
152 ;; Unfortunately, the read kludges are needed for this function to work
153 ;; for GNU emacs 19 when it was compiled by Lucid.
154
155
156
157
158 ;;;
159 (defun ilisp-bindings ()
160 "Set up the key bindings for LISP and ILISP buffers."
161 (if (fboundp 'set-keymap-parent)
162 (progn
163 (setq ilisp-mode-map (make-sparse-keymap))
164 (set-keymap-parent ilisp-mode-map comint-mode-map))
165 (setq ilisp-mode-map (copy-keymap comint-mode-map)))
166
167 ;; Remove stop and quit subjob from comint
168 (define-key ilisp-mode-map "\C-c\C-z" nil)
169 (define-key ilisp-mode-map "\C-c\C-\\" nil)
170 (if (fboundp 'lisp-mode-commands)
171 (lisp-mode-commands ilisp-mode-map))
172 (lisp-bindings ilisp-mode-map t)
173 (if (boundp 'lisp-mode-map)
174 (lisp-bindings lisp-mode-map))
175 (if (boundp 'scheme-mode-map)
176 (lisp-bindings scheme-mode-map))
177 (ilisp-defkey emacs-lisp-mode-map ";" 'comment-region-lisp)
178
179 (ilisp-defkey global-map "\C-t" 'trace-defun-lisp-break)
180 (ilisp-defkey global-map "b" 'switch-to-lisp)
181
182 ;; Globally defined output-control commands.
183 (ilisp-defkey global-map "1" 'ilisp-bury-output)
184 (ilisp-defkey global-map "v" 'ilisp-scroll-output)
185 (ilisp-defkey global-map "G" 'ilisp-grow-output)
186
187 (if (not (boundp 'fi:clman-mode-map))
188 (setq fi:clman-mode-map (make-sparse-keymap)))
189 (ilisp-defkey fi:clman-mode-map "D" 'fi:clman)
190 (ilisp-defkey fi:clman-mode-map "A" 'fi:clman-apropos))