diff options
| author | Stefan Monnier | 2012-11-15 09:20:45 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2012-11-15 09:20:45 -0500 |
| commit | 96a6857705884d96b9026e80d2bc551d9079cee2 (patch) | |
| tree | d808c17c29b8caeab45c35679d3d3d8ab50aeac5 | |
| parent | 17c083ac218b2a560b84a11df22366c0b9f7b636 (diff) | |
| download | emacs-96a6857705884d96b9026e80d2bc551d9079cee2.tar.gz emacs-96a6857705884d96b9026e80d2bc551d9079cee2.zip | |
* doc/lispref/keymaps.texi (Translation Keymaps): Backport subsection
"Interaction with normal keymaps".
Fixes: debbugs:12868
| -rw-r--r-- | doc/lispref/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/lispref/keymaps.texi | 45 |
2 files changed, 37 insertions, 13 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 68d7bee2b64..89b456f5c22 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-11-15 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * keymaps.texi (Translation Keymaps): Add a subsection "Interaction | ||
| 4 | with normal keymaps" (bug#12868). | ||
| 5 | |||
| 1 | 2012-11-15 Glenn Morris <rgm@gnu.org> | 6 | 2012-11-15 Glenn Morris <rgm@gnu.org> |
| 2 | 7 | ||
| 3 | * display.texi (Face Attributes): Fix :underline COLOR description. | 8 | * display.texi (Face Attributes): Fix :underline COLOR description. |
diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi index f6d571ecc68..d01ecba4bed 100644 --- a/doc/lispref/keymaps.texi +++ b/doc/lispref/keymaps.texi | |||
| @@ -1559,14 +1559,11 @@ sequence, to translate certain event sequences into others. | |||
| 1559 | being read, as it is read, against @code{input-decode-map}, then | 1559 | being read, as it is read, against @code{input-decode-map}, then |
| 1560 | @code{local-function-key-map}, and then against @code{key-translation-map}. | 1560 | @code{local-function-key-map}, and then against @code{key-translation-map}. |
| 1561 | 1561 | ||
| 1562 | @defvar input-decode-map | 1562 | These keymaps have the same structure as other keymaps, but they are used |
| 1563 | This variable holds a keymap that describes the character sequences sent | 1563 | differently: they specify translations to make while reading key sequences, |
| 1564 | by function keys on an ordinary character terminal. This keymap has the | 1564 | rather than bindings for key sequences. |
| 1565 | same structure as other keymaps, but is used differently: it specifies | ||
| 1566 | translations to make while reading key sequences, rather than bindings | ||
| 1567 | for key sequences. | ||
| 1568 | 1565 | ||
| 1569 | If @code{input-decode-map} ``binds'' a key sequence @var{k} to a vector | 1566 | If one of these keymaps ``binds'' a key sequence @var{k} to a vector |
| 1570 | @var{v}, then when @var{k} appears as a subsequence @emph{anywhere} in a | 1567 | @var{v}, then when @var{k} appears as a subsequence @emph{anywhere} in a |
| 1571 | key sequence, it is replaced with the events in @var{v}. | 1568 | key sequence, it is replaced with the events in @var{v}. |
| 1572 | 1569 | ||
| @@ -1581,6 +1578,10 @@ Thus, typing @kbd{C-c @key{PF1}} sends the character sequence @kbd{C-c | |||
| 1581 | this back into @kbd{C-c @key{PF1}}, which it returns as the vector | 1578 | this back into @kbd{C-c @key{PF1}}, which it returns as the vector |
| 1582 | @code{[?\C-c pf1]}. | 1579 | @code{[?\C-c pf1]}. |
| 1583 | 1580 | ||
| 1581 | @defvar input-decode-map | ||
| 1582 | This variable holds a keymap that describes the character sequences sent | ||
| 1583 | by function keys on an ordinary character terminal. | ||
| 1584 | |||
| 1584 | The value of @code{input-decode-map} is usually set up automatically | 1585 | The value of @code{input-decode-map} is usually set up automatically |
| 1585 | according to the terminal's Terminfo or Termcap entry, but sometimes | 1586 | according to the terminal's Terminfo or Termcap entry, but sometimes |
| 1586 | those need help from terminal-specific Lisp files. Emacs comes with | 1587 | those need help from terminal-specific Lisp files. Emacs comes with |
| @@ -1655,8 +1656,6 @@ to turn the character that follows into a Hyper character: | |||
| 1655 | (let ((symbol (if (symbolp e) e (car e)))) | 1656 | (let ((symbol (if (symbolp e) e (car e)))) |
| 1656 | (setq symbol (intern (concat string | 1657 | (setq symbol (intern (concat string |
| 1657 | (symbol-name symbol)))) | 1658 | (symbol-name symbol)))) |
| 1658 | @end group | ||
| 1659 | @group | ||
| 1660 | (if (symbolp e) | 1659 | (if (symbolp e) |
| 1661 | symbol | 1660 | symbol |
| 1662 | (cons symbol (cdr e))))) | 1661 | (cons symbol (cdr e))))) |
| @@ -1666,10 +1665,30 @@ to turn the character that follows into a Hyper character: | |||
| 1666 | @end example | 1665 | @end example |
| 1667 | 1666 | ||
| 1668 | If you have enabled keyboard character set decoding using | 1667 | If you have enabled keyboard character set decoding using |
| 1669 | @code{set-keyboard-coding-system}, decoding is done after the | 1668 | @code{set-keyboard-coding-system}, decoding is done before the |
| 1670 | translations listed above. @xref{Terminal I/O Encoding}. However, in | 1669 | translations listed above. @xref{Terminal I/O Encoding}. |
| 1671 | future Emacs versions, character set decoding may be done at an | 1670 | |
| 1672 | earlier stage. | 1671 | @subsection Interaction with normal keymaps |
| 1672 | |||
| 1673 | The end of a key sequence is detected when that key sequence either is bound | ||
| 1674 | to a command, or when Emacs determines that no additional event can lead | ||
| 1675 | to a sequence that is bound to a command. | ||
| 1676 | |||
| 1677 | This means that, while @code{input-decode-map} and @code{key-translation-map} | ||
| 1678 | apply regardless of whether the original key sequence would have a binding, the | ||
| 1679 | presence of such a binding can still prevent translation from taking place. | ||
| 1680 | For example, let us return to our VT100 example above and add a binding for | ||
| 1681 | @kbd{C-c @key{ESC}} to the global map; now when the user hits @kbd{C-c | ||
| 1682 | @key{PF1}} Emacs will fail to decode @kbd{C-c @key{ESC} O P} into @kbd{C-c | ||
| 1683 | @key{PF1}} because it will stop reading keys right after @kbd{C-x @key{ESC}}, | ||
| 1684 | leaving @kbd{O P} for later. This is in case the user really hit @kbd{C-c | ||
| 1685 | @key{ESC}}, in which case Emacs should not sit there waiting for the next key | ||
| 1686 | to decide whether the user really pressed @kbd{@key{ESC}} or @kbd{@key{PF1}}. | ||
| 1687 | |||
| 1688 | For that reason, it is better to avoid binding commands to key sequences where | ||
| 1689 | the end of the key sequence is a prefix of a key translation. The main such | ||
| 1690 | problematic suffixes/prefixes are @kbd{@key{ESC}}, @kbd{M-O} (which is really | ||
| 1691 | @kbd{@key{ESC} O}) and @kbd{M-[} (which is really @kbd{@key{ESC} [}). | ||
| 1673 | 1692 | ||
| 1674 | @node Key Binding Commands | 1693 | @node Key Binding Commands |
| 1675 | @section Commands for Binding Keys | 1694 | @section Commands for Binding Keys |