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)) |