diff options
| author | Richard M. Stallman | 2005-03-06 18:29:10 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2005-03-06 18:29:10 +0000 |
| commit | 72287c23ef993fc3248deba670da1bab4882f3f7 (patch) | |
| tree | c3ec83b617269ee254ad12f387824120c439d6fe | |
| parent | 6a37fcbfa145ee2226016fa9342759efdb049dd6 (diff) | |
| download | emacs-72287c23ef993fc3248deba670da1bab4882f3f7.tar.gz emacs-72287c23ef993fc3248deba670da1bab4882f3f7.zip | |
(disabled-command-function): Output in *Disabled Command*.
Explicitly ignore non-keyboard events, and explicitly handle C-g.
| -rw-r--r-- | lisp/novice.el | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lisp/novice.el b/lisp/novice.el index de92857980b..3e63f0a7bc6 100644 --- a/lisp/novice.el +++ b/lisp/novice.el | |||
| @@ -49,7 +49,7 @@ If nil, the feature is disabled, i.e., all commands work normally.") | |||
| 49 | (defun disabled-command-function (&rest ignore) | 49 | (defun disabled-command-function (&rest ignore) |
| 50 | (let (char) | 50 | (let (char) |
| 51 | (save-window-excursion | 51 | (save-window-excursion |
| 52 | (with-output-to-temp-buffer "*Help*" | 52 | (with-output-to-temp-buffer "*Disabled Command*" |
| 53 | (let ((keys (this-command-keys))) | 53 | (let ((keys (this-command-keys))) |
| 54 | (if (or (eq (aref keys 0) | 54 | (if (or (eq (aref keys 0) |
| 55 | (if (stringp keys) | 55 | (if (stringp keys) |
| @@ -68,7 +68,7 @@ If nil, the feature is disabled, i.e., all commands work normally.") | |||
| 68 | (princ "It is disabled because new users often find it confusing.\n") | 68 | (princ "It is disabled because new users often find it confusing.\n") |
| 69 | (princ "Here's the first part of its description:\n\n") | 69 | (princ "Here's the first part of its description:\n\n") |
| 70 | ;; Keep only the first paragraph of the documentation. | 70 | ;; Keep only the first paragraph of the documentation. |
| 71 | (with-current-buffer "*Help*" | 71 | (with-current-buffer "*Disabled Command*" |
| 72 | (goto-char (point-max)) | 72 | (goto-char (point-max)) |
| 73 | (let ((start (point))) | 73 | (let ((start (point))) |
| 74 | (save-excursion | 74 | (save-excursion |
| @@ -91,10 +91,15 @@ SPC to try the command just this once, but leave it disabled. | |||
| 91 | (help-mode))) | 91 | (help-mode))) |
| 92 | (message "Type y, n, ! or SPC (the space bar): ") | 92 | (message "Type y, n, ! or SPC (the space bar): ") |
| 93 | (let ((cursor-in-echo-area t)) | 93 | (let ((cursor-in-echo-area t)) |
| 94 | (while (not (memq (setq char (downcase (read-char))) | 94 | (while (progn (setq char (read-event)) |
| 95 | '(?! ?y ?n ?\ ))) | 95 | (or (not (numberp char)) |
| 96 | (not (memq (downcase char) | ||
| 97 | '(?! ?y ?n ?\ ?\C-g))))) | ||
| 96 | (ding) | 98 | (ding) |
| 97 | (message "Please type y, n, ! or SPC (the space bar): ")))) | 99 | (message "Please type y, n, ! or SPC (the space bar): ")))) |
| 100 | (setq char (downcase char)) | ||
| 101 | (if (= char ?\C-g) | ||
| 102 | (setq quit-flag t)) | ||
| 98 | (if (= char ?!) | 103 | (if (= char ?!) |
| 99 | (setq disabled-command-function nil)) | 104 | (setq disabled-command-function nil)) |
| 100 | (if (= char ?y) | 105 | (if (= char ?y) |