diff options
Diffstat (limited to 'devdocs/elisp/key-binding-commands.html')
| -rw-r--r-- | devdocs/elisp/key-binding-commands.html | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/devdocs/elisp/key-binding-commands.html b/devdocs/elisp/key-binding-commands.html deleted file mode 100644 index b0a59552..00000000 --- a/devdocs/elisp/key-binding-commands.html +++ /dev/null @@ -1,52 +0,0 @@ - <h3 class="section">Commands for Binding Keys</h3> <p>This section describes some convenient interactive interfaces for changing key bindings. They work by calling <code>define-key</code>. </p> <p>People often use <code>global-set-key</code> in their init files (see <a href="init-file">Init File</a>) for simple customization. For example, </p> <div class="example"> <pre class="example">(global-set-key (kbd "C-x C-\\") 'next-line) -</pre> -</div> <p>or </p> <div class="example"> <pre class="example">(global-set-key [?\C-x ?\C-\\] 'next-line) -</pre> -</div> <p>or </p> <div class="example"> <pre class="example">(global-set-key [(control ?x) (control ?\\)] 'next-line) -</pre> -</div> <p>redefines <kbd>C-x C-\</kbd> to move down a line. </p> <div class="example"> <pre class="example">(global-set-key [M-mouse-1] 'mouse-set-point) -</pre> -</div> <p>redefines the first (leftmost) mouse button, entered with the Meta key, to set point where you click. </p> <p>Be careful when using non-<acronym>ASCII</acronym> text characters in Lisp specifications of keys to bind. If these are read as multibyte text, as they usually will be in a Lisp file (see <a href="loading-non_002dascii">Loading Non-ASCII</a>), you must type the keys as multibyte too. For instance, if you use this: </p> <div class="example"> <pre class="example">(global-set-key "ö" 'my-function) ; bind o-umlaut -</pre> -</div> <p>or </p> <div class="example"> <pre class="example">(global-set-key ?ö 'my-function) ; bind o-umlaut -</pre> -</div> <p>and your language environment is multibyte Latin-1, these commands actually bind the multibyte character with code 246, not the byte code 246 (<kbd>M-v</kbd>) sent by a Latin-1 terminal. In order to use this binding, you need to teach Emacs how to decode the keyboard by using an appropriate input method (see <a href="https://www.gnu.org/software/emacs/manual/html_node/emacs/Input-Methods.html#Input-Methods">Input Methods</a> in <cite>The GNU Emacs Manual</cite>). </p> <dl> <dt id="global-set-key">Command: <strong>global-set-key</strong> <em>key binding</em> -</dt> <dd> -<p>This function sets the binding of <var>key</var> in the current global map to <var>binding</var>. </p> <div class="example"> <pre class="example">(global-set-key <var>key</var> <var>binding</var>) -≡ -(define-key (current-global-map) <var>key</var> <var>binding</var>) -</pre> -</div> </dd> -</dl> <dl> <dt id="global-unset-key">Command: <strong>global-unset-key</strong> <em>key</em> -</dt> <dd> - <p>This function removes the binding of <var>key</var> from the current global map. </p> <p>One use of this function is in preparation for defining a longer key that uses <var>key</var> as a prefix—which would not be allowed if <var>key</var> has a non-prefix binding. For example: </p> <div class="example"> <pre class="example">(global-unset-key "\C-l") - ⇒ nil -</pre> -<pre class="example">(global-set-key "\C-l\C-l" 'redraw-display) - ⇒ nil -</pre> -</div> <p>This function is equivalent to using <code>define-key</code> as follows: </p> <div class="example"> <pre class="example">(global-unset-key <var>key</var>) -≡ -(define-key (current-global-map) <var>key</var> nil) -</pre> -</div> </dd> -</dl> <dl> <dt id="local-set-key">Command: <strong>local-set-key</strong> <em>key binding</em> -</dt> <dd> -<p>This function sets the binding of <var>key</var> in the current local keymap to <var>binding</var>. </p> <div class="example"> <pre class="example">(local-set-key <var>key</var> <var>binding</var>) -≡ -(define-key (current-local-map) <var>key</var> <var>binding</var>) -</pre> -</div> </dd> -</dl> <dl> <dt id="local-unset-key">Command: <strong>local-unset-key</strong> <em>key</em> -</dt> <dd> -<p>This function removes the binding of <var>key</var> from the current local map. </p> <div class="example"> <pre class="example">(local-unset-key <var>key</var>) -≡ -(define-key (current-local-map) <var>key</var> nil) -</pre> -</div> </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/Key-Binding-Commands.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Binding-Commands.html</a> - </p> -</div> |
