1 |
;;; novice.el --- handling of disabled commands ("novice mode") for Emacs |
;;; novice.el --- handling of disabled commands ("novice mode") for Emacs |
2 |
|
|
3 |
;; Copyright (C) 1985, 1986, 1987, 1994, 2002 Free Software Foundation, Inc. |
;; Copyright (C) 1985, 1986, 1987, 1994, 2002, 2004 |
4 |
|
;; Free Software Foundation, Inc. |
5 |
|
|
6 |
;; Maintainer: FSF |
;; Maintainer: FSF |
7 |
;; Keywords: internal, help |
;; Keywords: internal, help |
37 |
;; and the keys are returned by (this-command-keys). |
;; and the keys are returned by (this-command-keys). |
38 |
|
|
39 |
;;;###autoload |
;;;###autoload |
40 |
(defvar disabled-command-hook 'disabled-command-hook |
(defvar disabled-command-function 'disabled-command-function |
41 |
"Function to call to handle disabled commands. |
"Function to call to handle disabled commands. |
42 |
If nil, the feature is disabled, i.e., all commands work normally.") |
If nil, the feature is disabled, i.e., all commands work normally.") |
43 |
|
|
44 |
|
(defvaralias 'disabled-command-hook 'disabled-command-function) |
45 |
|
(make-obsolete-variable |
46 |
|
'disabled-command-hook |
47 |
|
"use the variable `disabled-command-function' instead." "21.4") |
48 |
|
|
49 |
;;;###autoload |
;;;###autoload |
50 |
(defun disabled-command-hook (&rest ignore) |
(defun disabled-command-function (&rest ignore) |
51 |
(let (char) |
(let (char) |
52 |
(save-window-excursion |
(save-window-excursion |
53 |
(with-output-to-temp-buffer "*Help*" |
(with-output-to-temp-buffer "*Help*" |
97 |
(ding) |
(ding) |
98 |
(message "Please type y, n, ! or SPC (the space bar): ")))) |
(message "Please type y, n, ! or SPC (the space bar): ")))) |
99 |
(if (= char ?!) |
(if (= char ?!) |
100 |
(setq disabled-command-hook nil)) |
(setq disabled-command-function nil)) |
101 |
(if (= char ?y) |
(if (= char ?y) |
102 |
(if (and user-init-file |
(if (and user-init-file |
103 |
(not (string= "" user-init-file)) |
(not (string= "" user-init-file)) |
110 |
;;;###autoload |
;;;###autoload |
111 |
(defun enable-command (command) |
(defun enable-command (command) |
112 |
"Allow COMMAND to be executed without special confirmation from now on. |
"Allow COMMAND to be executed without special confirmation from now on. |
113 |
The user's .emacs file is altered so that this will apply |
COMMAND must be a symbol. |
114 |
|
This command alters the user's .emacs file so that this will apply |
115 |
to future sessions." |
to future sessions." |
116 |
(interactive "CEnable command: ") |
(interactive "CEnable command: ") |
117 |
(put command 'disabled nil) |
(put command 'disabled nil) |
148 |
;;;###autoload |
;;;###autoload |
149 |
(defun disable-command (command) |
(defun disable-command (command) |
150 |
"Require special confirmation to execute COMMAND from now on. |
"Require special confirmation to execute COMMAND from now on. |
151 |
The user's .emacs file is altered so that this will apply |
COMMAND must be a symbol. |
152 |
|
This command alters the user's .emacs file so that this will apply |
153 |
to future sessions." |
to future sessions." |
154 |
(interactive "CDisable command: ") |
(interactive "CDisable command: ") |
155 |
(if (not (commandp command)) |
(if (not (commandp command)) |