comparison lisp/cmuscheme.el @ 28066:95a07dc453f4

(inferior-scheme-mode-map): Define it independently from comint-mode-map, so we can just inherit from it. Also, move the initialization into the `defvar' since there's no docstring anyway and it's fairly short. (inferior-scheme-mode): Define it as derived-mode: the code is shorter and this way we inherit from comint-mode-map rather than copying it.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 08 Mar 2000 23:55:36 +0000
parents ac1673121774
children 5668b454db5a
comparison
equal deleted inserted replaced
28065:093dcd5f39b2 28066:95a07dc453f4
107 (defcustom inferior-scheme-mode-hook nil 107 (defcustom inferior-scheme-mode-hook nil
108 "*Hook for customising inferior-scheme mode." 108 "*Hook for customising inferior-scheme mode."
109 :type 'hook 109 :type 'hook
110 :group 'cmuscheme) 110 :group 'cmuscheme)
111 111
112 (defvar inferior-scheme-mode-map nil) 112 (defvar inferior-scheme-mode-map
113 113 (let ((m (make-sparse-keymap)))
114 (cond ((not inferior-scheme-mode-map) 114 (define-key m "\M-\C-x" 'scheme-send-definition) ;gnu convention
115 (setq inferior-scheme-mode-map 115 (define-key m "\C-x\C-e" 'scheme-send-last-sexp)
116 (copy-keymap comint-mode-map)) 116 (define-key m "\C-c\C-l" 'scheme-load-file)
117 (define-key inferior-scheme-mode-map "\M-\C-x" ;gnu convention 117 (define-key m "\C-c\C-k" 'scheme-compile-file)
118 'scheme-send-definition) 118 (scheme-mode-commands m)
119 (define-key inferior-scheme-mode-map "\C-x\C-e" 'scheme-send-last-sexp) 119 m))
120 (define-key inferior-scheme-mode-map "\C-c\C-l" 'scheme-load-file)
121 (define-key inferior-scheme-mode-map "\C-c\C-k" 'scheme-compile-file)
122 (scheme-mode-commands inferior-scheme-mode-map)))
123 120
124 ;; Install the process communication commands in the scheme-mode keymap. 121 ;; Install the process communication commands in the scheme-mode keymap.
125 (define-key scheme-mode-map "\M-\C-x" 'scheme-send-definition);gnu convention 122 (define-key scheme-mode-map "\M-\C-x" 'scheme-send-definition);gnu convention
126 (define-key scheme-mode-map "\C-x\C-e" 'scheme-send-last-sexp);gnu convention 123 (define-key scheme-mode-map "\C-x\C-e" 'scheme-send-last-sexp);gnu convention
127 (define-key scheme-mode-map "\C-c\C-e" 'scheme-send-definition) 124 (define-key scheme-mode-map "\C-c\C-e" 'scheme-send-definition)
158 '("Evaluate Last S-expression" . scheme-send-last-sexp)) 155 '("Evaluate Last S-expression" . scheme-send-last-sexp))
159 ) 156 )
160 157
161 (defvar scheme-buffer) 158 (defvar scheme-buffer)
162 159
163 (defun inferior-scheme-mode () 160 (define-derived-mode inferior-scheme-mode comint-mode "Inferior Scheme"
164 "Major mode for interacting with an inferior Scheme process. 161 "Major mode for interacting with an inferior Scheme process.
165 162
166 The following commands are available: 163 The following commands are available:
167 \\{inferior-scheme-mode-map} 164 \\{inferior-scheme-mode-map}
168 165
195 of expression rigidly with the current line. 192 of expression rigidly with the current line.
196 C-M-q does Tab on each line starting within following expression. 193 C-M-q does Tab on each line starting within following expression.
197 Paragraphs are separated only by blank lines. Semicolons start comments. 194 Paragraphs are separated only by blank lines. Semicolons start comments.
198 If you accidentally suspend your process, use \\[comint-continue-subjob] 195 If you accidentally suspend your process, use \\[comint-continue-subjob]
199 to continue it." 196 to continue it."
200 (interactive)
201 (comint-mode)
202 ;; Customise in inferior-scheme-mode-hook 197 ;; Customise in inferior-scheme-mode-hook
203 (setq comint-prompt-regexp "^[^>\n]*>+ *") ; OK for cscheme, oaklisp, T,... 198 (setq comint-prompt-regexp "^[^>\n]*>+ *") ; OK for cscheme, oaklisp, T,...
204 (scheme-mode-variables) 199 (scheme-mode-variables)
205 (setq major-mode 'inferior-scheme-mode)
206 (setq mode-name "Inferior Scheme")
207 (setq mode-line-process '(":%s")) 200 (setq mode-line-process '(":%s"))
208 (use-local-map inferior-scheme-mode-map)
209 (setq comint-input-filter (function scheme-input-filter)) 201 (setq comint-input-filter (function scheme-input-filter))
210 (setq comint-get-old-input (function scheme-get-old-input)) 202 (setq comint-get-old-input (function scheme-get-old-input)))
211 (run-hooks 'inferior-scheme-mode-hook))
212 203
213 (defcustom inferior-scheme-filter-regexp "\\`\\s *\\S ?\\S ?\\s *\\'" 204 (defcustom inferior-scheme-filter-regexp "\\`\\s *\\S ?\\S ?\\s *\\'"
214 "*Input matching this regexp are not saved on the history list. 205 "*Input matching this regexp are not saved on the history list.
215 Defaults to a regexp ignoring all inputs of 0, 1, or 2 letters." 206 Defaults to a regexp ignoring all inputs of 0, 1, or 2 letters."
216 :type 'regexp 207 :type 'regexp