summaryrefslogtreecommitdiff
path: root/devdocs/elisp/key-sequences.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/elisp/key-sequences.html')
-rw-r--r--devdocs/elisp/key-sequences.html18
1 files changed, 18 insertions, 0 deletions
diff --git a/devdocs/elisp/key-sequences.html b/devdocs/elisp/key-sequences.html
new file mode 100644
index 00000000..f0a31596
--- /dev/null
+++ b/devdocs/elisp/key-sequences.html
@@ -0,0 +1,18 @@
+ <h3 class="section">Key Sequences</h3> <p>A <em>key sequence</em>, or <em>key</em> for short, is a sequence of one or more input events that form a unit. Input events include characters, function keys, mouse actions, or system events external to Emacs, such as <code>iconify-frame</code> (see <a href="input-events">Input Events</a>). The Emacs Lisp representation for a key sequence is a string or vector. Unless otherwise stated, any Emacs Lisp function that accepts a key sequence as an argument can handle both representations. </p> <p>In the string representation, alphanumeric characters ordinarily stand for themselves; for example, <code>"a"</code> represents <kbd>a</kbd> and <code>"2"</code> represents <kbd>2</kbd>. Control character events are prefixed by the substring <code>"\C-"</code>, and meta characters by <code>"\M-"</code>; for example, <code>"\C-x"</code> represents the key <kbd>C-x</kbd>. In addition, the <tt class="key">TAB</tt>, <tt class="key">RET</tt>, <tt class="key">ESC</tt>, and <tt class="key">DEL</tt> events are represented by <code>"\t"</code>, <code>"\r"</code>, <code>"\e"</code>, and <code>"\d"</code> respectively. The string representation of a complete key sequence is the concatenation of the string representations of the constituent events; thus, <code>"\C-xl"</code> represents the key sequence <kbd>C-x l</kbd>. </p> <p>Key sequences containing function keys, mouse button events, system events, or non-<acronym>ASCII</acronym> characters such as <kbd>C-=</kbd> or <kbd>H-a</kbd> cannot be represented as strings; they have to be represented as vectors. </p> <p>In the vector representation, each element of the vector represents an input event, in its Lisp form. See <a href="input-events">Input Events</a>. For example, the vector <code>[?\C-x ?l]</code> represents the key sequence <kbd>C-x l</kbd>. </p> <p>For examples of key sequences written in string and vector representations, <a href="https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-Rebinding.html#Init-Rebinding">Init Rebinding</a> in <cite>The GNU Emacs Manual</cite>. </p> <dl> <dt id="kbd">Function: <strong>kbd</strong> <em>keyseq-text</em>
+</dt> <dd>
+<p>This function converts the text <var>keyseq-text</var> (a string constant) into a key sequence (a string or vector constant). The contents of <var>keyseq-text</var> should use the same syntax as in the buffer invoked by the <kbd>C-x C-k <span class="key">RET</span></kbd> (<code>kmacro-edit-macro</code>) command; in particular, you must surround function key names with ‘<samp>&lt;…&gt;</samp>’. See <a href="https://www.gnu.org/software/emacs/manual/html_node/emacs/Edit-Keyboard-Macro.html#Edit-Keyboard-Macro">Edit Keyboard Macro</a> in <cite>The GNU Emacs Manual</cite>. </p> <div class="example"> <pre class="example">(kbd "C-x") ⇒ "\C-x"
+(kbd "C-x C-f") ⇒ "\C-x\C-f"
+(kbd "C-x 4 C-f") ⇒ "\C-x4\C-f"
+(kbd "X") ⇒ "X"
+(kbd "RET") ⇒ "\^M"
+(kbd "C-c SPC") ⇒ "\C-c "
+(kbd "&lt;f1&gt; SPC") ⇒ [f1 32]
+(kbd "C-M-&lt;down&gt;") ⇒ [C-M-down]
+</pre>
+</div> </dd>
+</dl><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 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-Sequences.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Sequences.html</a>
+ </p>
+</div>