(lispref.info)Disabling Commands


Next: Command History Prev: Recursive Editing Up: Command Loop

Disabling Commands
==================

   "Disabling a command" marks the command as requiring user
confirmation before it can be executed.  Disabling is used for commands
which might be confusing to beginning users, to prevent them from using
the commands by accident.

   The low-level mechanism for disabling a command is to put a
non-`nil' `disabled' property on the Lisp symbol for the command.
These properties are normally set up by the user's `.emacs' file with
Lisp expressions such as this:

     (put 'upcase-region 'disabled t)

For a few commands, these properties are present by default and may be
removed by the `.emacs' 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")

   Note: Disabling, for the details on what happens
when a disabled command is invoked interactively.  Disabling a command
has no effect on calling it as a function from Lisp programs.

 - Command: enable-command COMMAND
     Allow COMMAND to be executed without special confirmation from now
     on.  The user's `.emacs' file is optionally altered so that this
     will apply to future sessions.

 - Command: disable-command COMMAND
     Require special confirmation to execute COMMAND from now on.  The
     user's `.emacs' file is optionally altered so that this will apply
     to future sessions.

 - Variable: disabled-command-hook
     This variable is a normal hook that is run instead of a disabled
     command, when the user runs the disabled command interactively.
     The hook functions can use `this-command-keys' to determine what
     the user typed to run the command, and thus find the command
     itself.

     By default, `disabled-command-hook' contains a function that asks
     the user whether to proceed.


automatically generated by info2www