aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorErik Naggum1996-12-09 04:21:11 +0000
committerErik Naggum1996-12-09 04:21:11 +0000
commit4442951c8f7499ca2d59fa989be58a035b42e60e (patch)
tree869c97e395fe8abae7e31e396da51361d8acafcd /lisp
parentc9ac7fca83065ef676864a204fed9a3a412d4e89 (diff)
downloademacs-4442951c8f7499ca2d59fa989be58a035b42e60e.tar.gz
emacs-4442951c8f7499ca2d59fa989be58a035b42e60e.zip
(disabled-command-hook): Use `defvar' and add documentation string.
(disabled-command-hook): New option ! turns off disabled commands.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/novice.el16
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.
41If 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
76Space to try the command just this once, 78Space to try the command just this once, but leave it disabled,
77 but leave it disabled,
78Y to try it and enable it (no questions if you use it again), 79Y 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
79N to do nothing (command remains disabled).") 81N 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))