Previous: Rebinding, Up: Key Bindings [Contents][Index]
Disabling a command marks it as requiring confirmation before it can be executed. The purpose of disabling a command is to prevent beginning users from executing it by accident and being confused.
The direct mechanism for disabling a command is to have a non-nil
disabled
property on the Lisp symbol for the command. These
properties are normally set by the user’s init file with
Lisp expressions such as:
(put 'delete-region 'disabled t)
See Init File.
If the value of the disabled
property is a string, that string
is included in the message printed when the command is used:
(put 'delete-region 'disabled "Text deleted this way cannot be yanked back!\n")
You can disable a command either by editing the init file directly or with the command M-x disable-command, which edits the init file for you. See Init File.
When you attempt to invoke a disabled command interactively in Emacs, a window is displayed containing the command’s name, its documentation, and some instructions on what to do next; then Emacs asks for input saying whether to execute the command as requested, enable it and execute, or cancel it. If you decide to enable the command, you are asked whether to do this permanently or just for the current session. Enabling permanently works by automatically editing your init file. You can use M-x enable-command at any time to enable any command permanently.
Whether a command is disabled is independent of what key is used to invoke it; it also applies if the command is invoked using M-x. Disabling a command has no effect on calling it as a function from Lisp programs.
Previous: Rebinding, Up: Key Bindings [Contents][Index]