diff options
Diffstat (limited to 'devdocs/elisp/creating-keymaps.html')
| -rw-r--r-- | devdocs/elisp/creating-keymaps.html | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/devdocs/elisp/creating-keymaps.html b/devdocs/elisp/creating-keymaps.html deleted file mode 100644 index 4840a168..00000000 --- a/devdocs/elisp/creating-keymaps.html +++ /dev/null @@ -1,44 +0,0 @@ - <h3 class="section">Creating Keymaps</h3> <p>Here we describe the functions for creating keymaps. </p> <dl> <dt id="make-sparse-keymap">Function: <strong>make-sparse-keymap</strong> <em>&optional prompt</em> -</dt> <dd> -<p>This function creates and returns a new sparse keymap with no entries. (A sparse keymap is the kind of keymap you usually want.) The new keymap does not contain a char-table, unlike <code>make-keymap</code>, and does not bind any events. </p> <div class="example"> <pre class="example">(make-sparse-keymap) - ⇒ (keymap) -</pre> -</div> <p>If you specify <var>prompt</var>, that becomes the overall prompt string for the keymap. You should specify this only for menu keymaps (see <a href="defining-menus">Defining Menus</a>). A keymap with an overall prompt string will always present a mouse menu or a keyboard menu if it is active for looking up the next input event. Don’t specify an overall prompt string for the main map of a major or minor mode, because that would cause the command loop to present a keyboard menu every time. </p> -</dd> -</dl> <dl> <dt id="make-keymap">Function: <strong>make-keymap</strong> <em>&optional prompt</em> -</dt> <dd> -<p>This function creates and returns a new full keymap. That keymap contains a char-table (see <a href="char_002dtables">Char-Tables</a>) with slots for all characters without modifiers. The new keymap initially binds all these characters to <code>nil</code>, and does not bind any other kind of event. The argument <var>prompt</var> specifies a prompt string, as in <code>make-sparse-keymap</code>. </p> <div class="example"> <pre class="example">(make-keymap) - ⇒ (keymap #^[nil nil keymap nil nil nil …]) -</pre> -</div> <p>A full keymap is more efficient than a sparse keymap when it holds lots of bindings; for just a few, the sparse keymap is better. </p> -</dd> -</dl> <dl> <dt id="copy-keymap">Function: <strong>copy-keymap</strong> <em>keymap</em> -</dt> <dd> -<p>This function returns a copy of <var>keymap</var>. This is almost never needed. If you want a keymap that’s like another yet with a few changes, you should use map inheritance rather than copying. I.e., something like: </p> <div class="example"> <pre class="example">(let ((map (make-sparse-keymap))) - (set-keymap-parent map <theirmap>) - (define-key map ...) - ...) -</pre> -</div> <p>When performing <code>copy-keymap</code>, any keymaps that appear directly as bindings in <var>keymap</var> are also copied recursively, and so on to any number of levels. However, recursive copying does not take place when the definition of a character is a symbol whose function definition is a keymap; the same symbol appears in the new copy. </p> <div class="example"> <pre class="example">(setq map (copy-keymap (current-local-map))) -⇒ (keymap -</pre> -<pre class="example"> ;; <span class="roman">(This implements meta characters.)</span> - (27 keymap - (83 . center-paragraph) - (115 . center-line)) - (9 . tab-to-tab-stop)) -</pre> - -<pre class="example">(eq map (current-local-map)) - ⇒ nil -</pre> -<pre class="example">(equal map (current-local-map)) - ⇒ t -</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/Creating-Keymaps.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Creating-Keymaps.html</a> - </p> -</div> |
