diff options
| author | Stefan Kangas | 2025-03-01 06:28:17 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2025-03-01 06:36:43 +0100 |
| commit | 7ec6531c7bd99ff13e73b9cc2f00d49d2472565f (patch) | |
| tree | 823217aeee183096d4578d9b596b688964cc3f26 | |
| parent | 8b804011275f9f7b5dda1f03e1d6118cae2846c5 (diff) | |
| download | emacs-7ec6531c7bd99ff13e73b9cc2f00d49d2472565f.tar.gz emacs-7ec6531c7bd99ff13e73b9cc2f00d49d2472565f.zip | |
keymaps.texi: Move "Key Sequences" section down
* doc/lispref/keymaps.texi (Key Sequences): Move section
down. (Bug#52821)
| -rw-r--r-- | doc/lispref/keymaps.texi | 133 |
1 files changed, 66 insertions, 67 deletions
diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi index 56bfb550974..ac63f296958 100644 --- a/doc/lispref/keymaps.texi +++ b/doc/lispref/keymaps.texi | |||
| @@ -14,7 +14,6 @@ used to look up the next input event; this continues until a command | |||
| 14 | is found. The whole process is called @dfn{key lookup}. | 14 | is found. The whole process is called @dfn{key lookup}. |
| 15 | 15 | ||
| 16 | @menu | 16 | @menu |
| 17 | * Key Sequences:: Key sequences as Lisp objects. | ||
| 18 | * Keymap Basics:: Basic concepts of keymaps. | 17 | * Keymap Basics:: Basic concepts of keymaps. |
| 19 | * Format of Keymaps:: What a keymap looks like as a Lisp object. | 18 | * Format of Keymaps:: What a keymap looks like as a Lisp object. |
| 20 | * Creating Keymaps:: Functions to create and copy keymaps. | 19 | * Creating Keymaps:: Functions to create and copy keymaps. |
| @@ -30,6 +29,7 @@ is found. The whole process is called @dfn{key lookup}. | |||
| 30 | * Key Lookup:: Finding a key's binding in one keymap. | 29 | * Key Lookup:: Finding a key's binding in one keymap. |
| 31 | * Functions for Key Lookup:: How to request key lookup. | 30 | * Functions for Key Lookup:: How to request key lookup. |
| 32 | * Changing Key Bindings:: Redefining a key in a keymap. | 31 | * Changing Key Bindings:: Redefining a key in a keymap. |
| 32 | * Key Sequences:: Key sequences as Lisp objects. | ||
| 33 | * Low-Level Key Binding:: Legacy key syntax description. | 33 | * Low-Level Key Binding:: Legacy key syntax description. |
| 34 | * Remapping Commands:: A keymap can translate one command to another. | 34 | * Remapping Commands:: A keymap can translate one command to another. |
| 35 | * Translation Keymaps:: Keymaps for translating sequences of events. | 35 | * Translation Keymaps:: Keymaps for translating sequences of events. |
| @@ -38,72 +38,6 @@ is found. The whole process is called @dfn{key lookup}. | |||
| 38 | * Menu Keymaps:: Defining a menu as a keymap. | 38 | * Menu Keymaps:: Defining a menu as a keymap. |
| 39 | @end menu | 39 | @end menu |
| 40 | 40 | ||
| 41 | @node Key Sequences | ||
| 42 | @section Key Sequences | ||
| 43 | @cindex key | ||
| 44 | @cindex keystroke | ||
| 45 | @cindex key sequence | ||
| 46 | |||
| 47 | A @dfn{key sequence}, or @dfn{key} for short, is a sequence of one | ||
| 48 | or more input events that form a unit. Input events include | ||
| 49 | characters, function keys, mouse actions, or system events external to | ||
| 50 | Emacs, such as @code{iconify-frame} (@pxref{Input Events}). | ||
| 51 | The Emacs Lisp representation for a key sequence is a string or | ||
| 52 | vector. Unless otherwise stated, any Emacs Lisp function that accepts | ||
| 53 | a key sequence as an argument can handle both representations. | ||
| 54 | |||
| 55 | In the string representation, alphanumeric characters ordinarily | ||
| 56 | stand for themselves; for example, @code{"a"} represents @kbd{a} | ||
| 57 | and @code{"2"} represents @kbd{2}. Control character events are | ||
| 58 | prefixed by the substring @code{"\C-"}, and meta characters by | ||
| 59 | @code{"\M-"}; for example, @code{"\C-x"} represents the key @kbd{C-x}. | ||
| 60 | In addition, the @key{TAB}, @key{RET}, @key{ESC}, and @key{DEL} events | ||
| 61 | are represented by @code{"\t"}, @code{"\r"}, @code{"\e"}, and | ||
| 62 | @code{"\d"} respectively. The string representation of a complete key | ||
| 63 | sequence is the concatenation of the string representations of the | ||
| 64 | constituent events; thus, @code{"\C-xl"} represents the key sequence | ||
| 65 | @kbd{C-x l}. | ||
| 66 | |||
| 67 | Key sequences containing function keys, mouse button events, system | ||
| 68 | events, or non-@acronym{ASCII} characters such as @kbd{C-=} or | ||
| 69 | @kbd{H-a} cannot be represented as strings; they have to be | ||
| 70 | represented as vectors. | ||
| 71 | |||
| 72 | In the vector representation, each element of the vector represents | ||
| 73 | an input event, in its Lisp form. @xref{Input Events}. For example, | ||
| 74 | the vector @code{[?\C-x ?l]} represents the key sequence @kbd{C-x l}. | ||
| 75 | |||
| 76 | For examples of key sequences written in string and vector | ||
| 77 | representations, @ref{Init Rebinding,,, emacs, The GNU Emacs Manual}. | ||
| 78 | |||
| 79 | @defun kbd keyseq-text | ||
| 80 | This function converts the text @var{keyseq-text} (a string constant) | ||
| 81 | into a key sequence (a string or vector constant). The contents of | ||
| 82 | @var{keyseq-text} should use the same syntax as in the buffer invoked | ||
| 83 | by the @kbd{C-x C-k @key{RET}} (@code{kmacro-edit-macro}) command; in | ||
| 84 | particular, you must surround function key names with | ||
| 85 | @samp{<@dots{}>}. @xref{Edit Keyboard Macro,,, emacs, The GNU Emacs | ||
| 86 | Manual}. | ||
| 87 | |||
| 88 | @example | ||
| 89 | (kbd "C-x") @result{} "\C-x" | ||
| 90 | (kbd "C-x C-f") @result{} "\C-x\C-f" | ||
| 91 | (kbd "C-x 4 C-f") @result{} "\C-x4\C-f" | ||
| 92 | (kbd "X") @result{} "X" | ||
| 93 | (kbd "RET") @result{} "^M" | ||
| 94 | (kbd "C-c SPC") @result{} "\C-c@ " | ||
| 95 | (kbd "<f1> SPC") @result{} [f1 32] | ||
| 96 | (kbd "C-M-<down>") @result{} [C-M-down] | ||
| 97 | @end example | ||
| 98 | |||
| 99 | @findex key-valid-p | ||
| 100 | The @code{kbd} function is very permissive, and will try to return | ||
| 101 | something sensible even if the syntax used isn't completely | ||
| 102 | conforming. To check whether the syntax is actually valid, use the | ||
| 103 | @code{key-valid-p} function. | ||
| 104 | @end defun | ||
| 105 | |||
| 106 | |||
| 107 | @node Keymap Basics | 41 | @node Keymap Basics |
| 108 | @section Keymap Basics | 42 | @section Keymap Basics |
| 109 | @cindex key binding | 43 | @cindex key binding |
| @@ -1697,6 +1631,71 @@ Modes}); then its keymap will automatically inherit from | |||
| 1697 | @end smallexample | 1631 | @end smallexample |
| 1698 | @end defun | 1632 | @end defun |
| 1699 | 1633 | ||
| 1634 | @node Key Sequences | ||
| 1635 | @section Key Sequences | ||
| 1636 | @cindex key | ||
| 1637 | @cindex keystroke | ||
| 1638 | @cindex key sequence | ||
| 1639 | |||
| 1640 | A @dfn{key sequence}, or @dfn{key} for short, is a sequence of one | ||
| 1641 | or more input events that form a unit. Input events include | ||
| 1642 | characters, function keys, mouse actions, or system events external to | ||
| 1643 | Emacs, such as @code{iconify-frame} (@pxref{Input Events}). | ||
| 1644 | The Emacs Lisp representation for a key sequence is a string or | ||
| 1645 | vector. Unless otherwise stated, any Emacs Lisp function that accepts | ||
| 1646 | a key sequence as an argument can handle both representations. | ||
| 1647 | |||
| 1648 | In the string representation, alphanumeric characters ordinarily | ||
| 1649 | stand for themselves; for example, @code{"a"} represents @kbd{a} | ||
| 1650 | and @code{"2"} represents @kbd{2}. Control character events are | ||
| 1651 | prefixed by the substring @code{"\C-"}, and meta characters by | ||
| 1652 | @code{"\M-"}; for example, @code{"\C-x"} represents the key @kbd{C-x}. | ||
| 1653 | In addition, the @key{TAB}, @key{RET}, @key{ESC}, and @key{DEL} events | ||
| 1654 | are represented by @code{"\t"}, @code{"\r"}, @code{"\e"}, and | ||
| 1655 | @code{"\d"} respectively. The string representation of a complete key | ||
| 1656 | sequence is the concatenation of the string representations of the | ||
| 1657 | constituent events; thus, @code{"\C-xl"} represents the key sequence | ||
| 1658 | @kbd{C-x l}. | ||
| 1659 | |||
| 1660 | Key sequences containing function keys, mouse button events, system | ||
| 1661 | events, or non-@acronym{ASCII} characters such as @kbd{C-=} or | ||
| 1662 | @kbd{H-a} cannot be represented as strings; they have to be | ||
| 1663 | represented as vectors. | ||
| 1664 | |||
| 1665 | In the vector representation, each element of the vector represents | ||
| 1666 | an input event, in its Lisp form. @xref{Input Events}. For example, | ||
| 1667 | the vector @code{[?\C-x ?l]} represents the key sequence @kbd{C-x l}. | ||
| 1668 | |||
| 1669 | For examples of key sequences written in string and vector | ||
| 1670 | representations, @ref{Init Rebinding,,, emacs, The GNU Emacs Manual}. | ||
| 1671 | |||
| 1672 | @defun kbd keyseq-text | ||
| 1673 | This function converts the text @var{keyseq-text} (a string constant) | ||
| 1674 | into a key sequence (a string or vector constant). The contents of | ||
| 1675 | @var{keyseq-text} should use the same syntax as in the buffer invoked | ||
| 1676 | by the @kbd{C-x C-k @key{RET}} (@code{kmacro-edit-macro}) command; in | ||
| 1677 | particular, you must surround function key names with | ||
| 1678 | @samp{<@dots{}>}. @xref{Edit Keyboard Macro,,, emacs, The GNU Emacs | ||
| 1679 | Manual}. | ||
| 1680 | |||
| 1681 | @example | ||
| 1682 | (kbd "C-x") @result{} "\C-x" | ||
| 1683 | (kbd "C-x C-f") @result{} "\C-x\C-f" | ||
| 1684 | (kbd "C-x 4 C-f") @result{} "\C-x4\C-f" | ||
| 1685 | (kbd "X") @result{} "X" | ||
| 1686 | (kbd "RET") @result{} "^M" | ||
| 1687 | (kbd "C-c SPC") @result{} "\C-c@ " | ||
| 1688 | (kbd "<f1> SPC") @result{} [f1 32] | ||
| 1689 | (kbd "C-M-<down>") @result{} [C-M-down] | ||
| 1690 | @end example | ||
| 1691 | |||
| 1692 | @findex key-valid-p | ||
| 1693 | The @code{kbd} function is very permissive, and will try to return | ||
| 1694 | something sensible even if the syntax used isn't completely | ||
| 1695 | conforming. To check whether the syntax is actually valid, use the | ||
| 1696 | @code{key-valid-p} function. | ||
| 1697 | @end defun | ||
| 1698 | |||
| 1700 | @node Low-Level Key Binding | 1699 | @node Low-Level Key Binding |
| 1701 | @section Low-Level Key Binding | 1700 | @section Low-Level Key Binding |
| 1702 | @cindex low-level key bindings | 1701 | @cindex low-level key bindings |