diff options
| author | Chong Yidong | 2006-05-25 16:48:37 +0000 |
|---|---|---|
| committer | Chong Yidong | 2006-05-25 16:48:37 +0000 |
| commit | 39a9bed31b4229cdf9bbbd10955df5aa2de4cc54 (patch) | |
| tree | 5e0a4c0a354e45db14098acf38a353e86778755d | |
| parent | 848a925ea6033abd34b1e84aeb64787f34d471ce (diff) | |
| download | emacs-39a9bed31b4229cdf9bbbd10955df5aa2de4cc54.tar.gz emacs-39a9bed31b4229cdf9bbbd10955df5aa2de4cc54.zip | |
* keymaps.texi (Key Sequences): Some clarifications.
| -rw-r--r-- | lispref/ChangeLog | 4 | ||||
| -rw-r--r-- | lispref/keymaps.texi | 43 |
2 files changed, 29 insertions, 18 deletions
diff --git a/lispref/ChangeLog b/lispref/ChangeLog index 41b7afee629..4022efed7ca 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2006-05-25 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * keymaps.texi (Key Sequences): Some clarifications. | ||
| 4 | |||
| 1 | 2006-05-25 Thien-Thi Nguyen <ttn@gnu.org> | 5 | 2006-05-25 Thien-Thi Nguyen <ttn@gnu.org> |
| 2 | 6 | ||
| 3 | * processes.texi (Bindat Functions): Say "unibyte string" | 7 | * processes.texi (Bindat Functions): Say "unibyte string" |
diff --git a/lispref/keymaps.texi b/lispref/keymaps.texi index 808f3a617a6..dd6a796805b 100644 --- a/lispref/keymaps.texi +++ b/lispref/keymaps.texi | |||
| @@ -82,39 +82,36 @@ and can change when bindings are changed. However, a one-event sequence | |||
| 82 | is always a key sequence, because it does not depend on any prefix keys | 82 | is always a key sequence, because it does not depend on any prefix keys |
| 83 | for its well-formedness. | 83 | for its well-formedness. |
| 84 | 84 | ||
| 85 | At any time, several primary keymaps are @dfn{active}---that is, in | 85 | A key sequence can be represented in Emacs Lisp as either a string |
| 86 | use for finding key bindings. These are the @dfn{global map}, which is | 86 | or vector. Unless otherwise stated, any Emacs Lisp function that |
| 87 | shared by all buffers; the @dfn{local keymap}, which is usually | 87 | accepts a key sequence as an argument can handle both representations. |
| 88 | associated with a specific major mode; and zero or more @dfn{minor mode | ||
| 89 | keymaps}, which belong to currently enabled minor modes. (Not all minor | ||
| 90 | modes have keymaps.) The local keymap bindings shadow (i.e., take | ||
| 91 | precedence over) the corresponding global bindings. The minor mode | ||
| 92 | keymaps shadow both local and global keymaps. @xref{Active Keymaps}, | ||
| 93 | for details. | ||
| 94 | |||
| 95 | The Emacs Lisp representation for a key sequence is a string or vector. | ||
| 96 | 88 | ||
| 97 | In the string representation, alphanumeric characters ordinarily | 89 | In the string representation, alphanumeric characters ordinarily |
| 98 | stand for themselves; for example, @code{"a"} represents @key{a} and | 90 | stand for themselves; for example, @code{"a"} represents @key{a} and |
| 99 | and @code{"1"} represents @key{1}. Control character events are | 91 | and @code{"2"} represents @key{2}. Control character events are |
| 100 | prefixed by the substring @code{"\C-"}, and meta characters by | 92 | prefixed by the substring @code{"\C-"}, and meta characters by |
| 101 | @code{"\M-"}; for example, @code{"\C-x"} represents the key @kbd{C-x}. | 93 | @code{"\M-"}; for example, @code{"\C-x"} represents the key @kbd{C-x}. |
| 102 | In addition, the @kbd{<TAB>}, @kbd{<RET>}, @kbd{<ESC>}, and | 94 | In addition, the @kbd{<TAB>}, @kbd{<RET>}, @kbd{<ESC>}, and |
| 103 | @kbd{<DEL>} events are represented by @code{"\t"}, @code{"\r"}, | 95 | @kbd{<DEL>} events are represented by @code{"\t"}, @code{"\r"}, |
| 104 | @code{"\e"}, and @code{"\d"} respectively. The string representation | 96 | @code{"\e"}, and @code{"\d"} respectively. The string representation |
| 105 | of a complete key sequence is then obtained by concatenating the | 97 | of a complete key sequence is then obtained by concatenating the |
| 106 | string representations of each constituent event; thus, @code{"\C-x"} | 98 | string representations of each constituent event; thus, @code{"\C-xl"} |
| 107 | represents the key sequence @kbd{C-x}. | 99 | represents the key sequence @kbd{C-x l}. |
| 108 | 100 | ||
| 109 | Key sequences containing function keys, mouse button events, or | 101 | Key sequences containing function keys, mouse button events, or |
| 110 | non-ASCII characters such as @kbd{C-=} or @kbd{H-a} cannot be | 102 | non-ASCII characters such as @kbd{C-=} or @kbd{H-a} cannot be |
| 111 | represented as strings; they have to be represented as vectors. | 103 | represented by strings; they have to be represented by vectors. |
| 112 | 104 | ||
| 113 | In the vector representation, each element of the vector represents | 105 | In the vector representation, each element of the vector represents |
| 114 | a consecutive input element, in its Lisp form. @xref{Input Events}. | 106 | a consecutive input element, in its Lisp form. @xref{Input Events}. |
| 115 | For example, ordinary keyboard events are represented by Lisp | 107 | For example, the vector @code{[?\C-x ?l]} represents the key sequence |
| 116 | characters (@pxref{Keyboard Events}), so the character @code{?a} | 108 | @kbd{C-x l}. |
| 117 | represents @key{a}. | 109 | |
| 110 | For examples of key sequences written in string and vector | ||
| 111 | representations, @ref{Init Rebinding,,, emacs, The GNU Emacs Manual}. | ||
| 112 | |||
| 113 | The @code{kbd} macro provides a convenient way to generate an Emacs | ||
| 114 | Lisp key sequence: | ||
| 118 | 115 | ||
| 119 | @defmac kbd keyseq-text | 116 | @defmac kbd keyseq-text |
| 120 | This macro converts the text @var{keyseq-text} (a string constant) | 117 | This macro converts the text @var{keyseq-text} (a string constant) |
| @@ -149,6 +146,16 @@ execution by the command loop). Given an event (or an event type) and a | |||
| 149 | keymap, Emacs can get the event's definition. Events include | 146 | keymap, Emacs can get the event's definition. Events include |
| 150 | characters, function keys, and mouse actions (@pxref{Input Events}). | 147 | characters, function keys, and mouse actions (@pxref{Input Events}). |
| 151 | 148 | ||
| 149 | At any time, several primary keymaps are @dfn{active}---that is, in | ||
| 150 | use for finding key bindings. These are the @dfn{global map}, which is | ||
| 151 | shared by all buffers; the @dfn{local keymap}, which is usually | ||
| 152 | associated with a specific major mode; and zero or more @dfn{minor mode | ||
| 153 | keymaps}, which belong to currently enabled minor modes. (Not all minor | ||
| 154 | modes have keymaps.) The local keymap bindings shadow (i.e., take | ||
| 155 | precedence over) the corresponding global bindings. The minor mode | ||
| 156 | keymaps shadow both local and global keymaps. @xref{Active Keymaps}, | ||
| 157 | for details. | ||
| 158 | |||
| 152 | Each keymap is a list whose @sc{car} is the symbol @code{keymap}. The | 159 | Each keymap is a list whose @sc{car} is the symbol @code{keymap}. The |
| 153 | remaining elements of the list define the key bindings of the keymap. | 160 | remaining elements of the list define the key bindings of the keymap. |
| 154 | A symbol whose function definition is a keymap is also a keymap. Use | 161 | A symbol whose function definition is a keymap is also a keymap. Use |