diff options
| author | Erik Naggum | 1996-12-09 04:21:11 +0000 |
|---|---|---|
| committer | Erik Naggum | 1996-12-09 04:21:11 +0000 |
| commit | 4442951c8f7499ca2d59fa989be58a035b42e60e (patch) | |
| tree | 869c97e395fe8abae7e31e396da51361d8acafcd | |
| parent | c9ac7fca83065ef676864a204fed9a3a412d4e89 (diff) | |
| download | emacs-4442951c8f7499ca2d59fa989be58a035b42e60e.tar.gz emacs-4442951c8f7499ca2d59fa989be58a035b42e60e.zip | |
(disabled-command-hook): Use `defvar' and add documentation string.
(disabled-command-hook): New option ! turns off disabled commands.
| -rw-r--r-- | lisp/novice.el | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lisp/novice.el b/lisp/novice.el index eb7c5f20b5b..29594e6b7dc 100644 --- a/lisp/novice.el +++ b/lisp/novice.el | |||
| @@ -36,7 +36,9 @@ | |||
| 36 | ;; and the keys are returned by (this-command-keys). | 36 | ;; and the keys are returned by (this-command-keys). |
| 37 | 37 | ||
| 38 | ;;;###autoload | 38 | ;;;###autoload |
| 39 | (setq disabled-command-hook 'disabled-command-hook) | 39 | (defvar disabled-command-hook 'disabled-command-hook |
| 40 | "Function to call to handle disabled commands. | ||
| 41 | If nil, the feature is disabled, i.e., all commands work normally.") | ||
| 40 | 42 | ||
| 41 | ;;;###autoload | 43 | ;;;###autoload |
| 42 | (defun disabled-command-hook (&rest ignore) | 44 | (defun disabled-command-hook (&rest ignore) |
| @@ -73,19 +75,21 @@ | |||
| 73 | (goto-char (point-max)))) | 75 | (goto-char (point-max)))) |
| 74 | (princ "\n\n") | 76 | (princ "\n\n") |
| 75 | (princ "You can now type | 77 | (princ "You can now type |
| 76 | Space to try the command just this once, | 78 | Space to try the command just this once, but leave it disabled, |
| 77 | but leave it disabled, | ||
| 78 | Y to try it and enable it (no questions if you use it again), | 79 | Y to try it and enable it (no questions if you use it again), |
| 80 | ! to try it and enable all commands in this session, or | ||
| 79 | N to do nothing (command remains disabled).") | 81 | N to do nothing (command remains disabled).") |
| 80 | (save-excursion | 82 | (save-excursion |
| 81 | (set-buffer standard-output) | 83 | (set-buffer standard-output) |
| 82 | (help-mode))) | 84 | (help-mode))) |
| 83 | (message "Type y, n or Space: ") | 85 | (message "Type y, n, ! or Space: ") |
| 84 | (let ((cursor-in-echo-area t)) | 86 | (let ((cursor-in-echo-area t)) |
| 85 | (while (not (memq (setq char (downcase (read-char))) | 87 | (while (not (memq (setq char (downcase (read-char))) |
| 86 | '(? ?y ?n))) | 88 | '(?! ? ?y ?n))) |
| 87 | (ding) | 89 | (ding) |
| 88 | (message "Please type y, n or Space: ")))) | 90 | (message "Please type y, n, ! or Space: ")))) |
| 91 | (if (= char ?!) | ||
| 92 | (setq disabled-command-hook nil)) | ||
| 89 | (if (= char ?y) | 93 | (if (= char ?y) |
| 90 | (if (and user-init-file | 94 | (if (and user-init-file |
| 91 | (not (string= "" user-init-file)) | 95 | (not (string= "" user-init-file)) |