diff options
| author | Stefan Monnier | 2000-03-08 23:55:36 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2000-03-08 23:55:36 +0000 |
| commit | e3f9c7f8fcccc19df43d0326664fcf4c1ea918a5 (patch) | |
| tree | 9379d27ac05f3ebe6838a3789eeac86d7c104efc | |
| parent | a9853251a342e86260db1005fb0b55639ad7a426 (diff) | |
| download | emacs-e3f9c7f8fcccc19df43d0326664fcf4c1ea918a5.tar.gz emacs-e3f9c7f8fcccc19df43d0326664fcf4c1ea918a5.zip | |
(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.
| -rw-r--r-- | lisp/cmuscheme.el | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/lisp/cmuscheme.el b/lisp/cmuscheme.el index a3e1ab5d9f7..71040bd4030 100644 --- a/lisp/cmuscheme.el +++ b/lisp/cmuscheme.el | |||
| @@ -109,17 +109,14 @@ | |||
| 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 |
| @@ -160,7 +157,7 @@ | |||
| 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: |
| @@ -197,18 +194,12 @@ 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. |