blob: d5fc71d21d4fe0414ff73862a2cba74efd482b96 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
<h3 class="section">Disabling Commands</h3> <p><em>Disabling a command</em> 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. </p> <p>The low-level mechanism for disabling a command is to put a non-<code>nil</code> <code>disabled</code> property on the Lisp symbol for the command. These properties are normally set up by the user’s init file (see <a href="init-file">Init File</a>) with Lisp expressions such as this: </p> <div class="example"> <pre class="example">(put 'upcase-region 'disabled t)
</pre>
</div> <p>For a few commands, these properties are present by default (you can remove them in your init file if you wish). </p> <p>If the value of the <code>disabled</code> property is a string, the message saying the command is disabled includes that string. For example: </p> <div class="example"> <pre class="example">(put 'delete-region 'disabled
"Text deleted this way cannot be yanked back!\n")
</pre>
</div> <p>See <a href="https://www.gnu.org/software/emacs/manual/html_node/emacs/Disabling.html#Disabling">Disabling</a> in <cite>The GNU Emacs Manual</cite>, 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. </p> <dl> <dt id="enable-command">Command: <strong>enable-command</strong> <em>command</em>
</dt> <dd><p>Allow <var>command</var> (a symbol) to be executed without special confirmation from now on, and alter the user’s init file (see <a href="init-file">Init File</a>) so that this will apply to future sessions. </p></dd>
</dl> <dl> <dt id="disable-command">Command: <strong>disable-command</strong> <em>command</em>
</dt> <dd><p>Require special confirmation to execute <var>command</var> from now on, and alter the user’s init file so that this will apply to future sessions. </p></dd>
</dl> <dl> <dt id="disabled-command-function">Variable: <strong>disabled-command-function</strong>
</dt> <dd>
<p>The value of this variable should be a function. When the user invokes a disabled command interactively, this function is called instead of the disabled command. It can use <code>this-command-keys</code> to determine what the user typed to run the command, and thus find the command itself. </p> <p>The value may also be <code>nil</code>. Then all commands work normally, even disabled ones. </p> <p>By default, the value is a function that asks the user whether to proceed. </p>
</dd>
</dl><div class="_attribution">
<p class="_attribution-p">
Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
<a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Disabling-Commands.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Disabling-Commands.html</a>
</p>
</div>
|