diff options
| author | Lute Kamstra | 2005-06-10 12:06:05 +0000 |
|---|---|---|
| committer | Lute Kamstra | 2005-06-10 12:06:05 +0000 |
| commit | 2aa8e74af09da63f7e702bc342d4350ba81ff0ab (patch) | |
| tree | 76881ec6aa3bc6f3063f3c310d97ed954b776666 | |
| parent | 09e9987080371fbab84d6fdca5e5c38ef1b590ba (diff) | |
| download | emacs-2aa8e74af09da63f7e702bc342d4350ba81ff0ab.tar.gz emacs-2aa8e74af09da63f7e702bc342d4350ba81ff0ab.zip | |
(doctor-mode-map): Remove defvar.
(doctor-mode): Use define-derived-mode.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/play/doctor.el | 17 |
2 files changed, 9 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 46a830238a5..689c3c4e936 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -30,6 +30,11 @@ | |||
| 30 | (dungeon-mode-map): Rename to dun-mode-map. Keep old name as an | 30 | (dungeon-mode-map): Rename to dun-mode-map. Keep old name as an |
| 31 | obsolete alias. | 31 | obsolete alias. |
| 32 | 32 | ||
| 33 | * play/doctor.el (doctor-mode-map): Remove defvar. | ||
| 34 | (doctor-mode): Use define-derived-mode. | ||
| 35 | |||
| 36 | * play/blackbox.el (blackbox-mode): Use run-mode-hooks. | ||
| 37 | |||
| 33 | 2005-06-10 Miles Bader <miles@gnu.org> | 38 | 2005-06-10 Miles Bader <miles@gnu.org> |
| 34 | 39 | ||
| 35 | * textmodes/flyspell.el (flyspell-incorrect, flyspell-duplicate): | 40 | * textmodes/flyspell.el (flyspell-incorrect, flyspell-duplicate): |
diff --git a/lisp/play/doctor.el b/lisp/play/doctor.el index 798abbc790a..7b81daa7782 100644 --- a/lisp/play/doctor.el +++ b/lisp/play/doctor.el | |||
| @@ -59,30 +59,21 @@ | |||
| 59 | (set what ww) | 59 | (set what ww) |
| 60 | first)) | 60 | first)) |
| 61 | 61 | ||
| 62 | (defvar doctor-mode-map nil) | 62 | (define-derived-mode doctor-mode text-mode "Doctor" |
| 63 | (if doctor-mode-map | ||
| 64 | nil | ||
| 65 | (setq doctor-mode-map (make-sparse-keymap)) | ||
| 66 | (define-key doctor-mode-map "\n" 'doctor-read-print) | ||
| 67 | (define-key doctor-mode-map "\r" 'doctor-ret-or-read)) | ||
| 68 | |||
| 69 | (defun doctor-mode () | ||
| 70 | "Major mode for running the Doctor (Eliza) program. | 63 | "Major mode for running the Doctor (Eliza) program. |
| 71 | Like Text mode with Auto Fill mode | 64 | Like Text mode with Auto Fill mode |
| 72 | except that RET when point is after a newline, or LFD at any time, | 65 | except that RET when point is after a newline, or LFD at any time, |
| 73 | reads the sentence before point, and prints the Doctor's answer." | 66 | reads the sentence before point, and prints the Doctor's answer." |
| 74 | (interactive) | ||
| 75 | (text-mode) | ||
| 76 | (make-doctor-variables) | 67 | (make-doctor-variables) |
| 77 | (use-local-map doctor-mode-map) | ||
| 78 | (setq major-mode 'doctor-mode) | ||
| 79 | (setq mode-name "Doctor") | ||
| 80 | (turn-on-auto-fill) | 68 | (turn-on-auto-fill) |
| 81 | (doctor-type '(i am the psychotherapist \. | 69 | (doctor-type '(i am the psychotherapist \. |
| 82 | (doc$ please) (doc$ describe) your (doc$ problems) \. | 70 | (doc$ please) (doc$ describe) your (doc$ problems) \. |
| 83 | each time you are finished talking, type \R\E\T twice \.)) | 71 | each time you are finished talking, type \R\E\T twice \.)) |
| 84 | (insert "\n")) | 72 | (insert "\n")) |
| 85 | 73 | ||
| 74 | (define-key doctor-mode-map "\n" 'doctor-read-print) | ||
| 75 | (define-key doctor-mode-map "\r" 'doctor-ret-or-read) | ||
| 76 | |||
| 86 | (defun make-doctor-variables () | 77 | (defun make-doctor-variables () |
| 87 | (make-local-variable 'typos) | 78 | (make-local-variable 'typos) |
| 88 | (setq typos | 79 | (setq typos |