Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
96a68577
Commit
96a68577
authored
Nov 15, 2012
by
Stefan Monnier
Browse files
* doc/lispref/keymaps.texi (Translation Keymaps): Backport subsection
"Interaction with normal keymaps". Fixes: debbugs:12868
parent
17c083ac
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
13 deletions
+37
-13
doc/lispref/ChangeLog
doc/lispref/ChangeLog
+5
-0
doc/lispref/keymaps.texi
doc/lispref/keymaps.texi
+32
-13
No files found.
doc/lispref/ChangeLog
View file @
96a68577
2012-11-15 Stefan Monnier <monnier@iro.umontreal.ca>
* keymaps.texi (Translation Keymaps): Add a subsection "Interaction
with normal keymaps" (bug#12868).
2012-11-15 Glenn Morris <rgm@gnu.org>
* display.texi (Face Attributes): Fix :underline COLOR description.
...
...
doc/lispref/keymaps.texi
View file @
96a68577
...
...
@@ -1559,14 +1559,11 @@ sequence, to translate certain event sequences into others.
being read, as it is read, against @code{input-decode-map}, then
@code{local-function-key-map}, and then against @code{key-translation-map}.
@defvar input-decode-map
This variable holds a keymap that describes the character sequences sent
by function keys on an ordinary character terminal. This keymap has the
same structure as other keymaps, but is used differently: it specifies
translations to make while reading key sequences, rather than bindings
for key sequences.
These keymaps have the same structure as other keymaps, but they are used
differently: they specify translations to make while reading key sequences,
rather than bindings for key sequences.
If
@code{input-decode-
map
}
``binds'' a key sequence @var{k} to a vector
If
one of these key
map
s
``binds'' a key sequence @var{k} to a vector
@var{v}, then when @var{k} appears as a subsequence @emph{anywhere} in a
key sequence, it is replaced with the events in @var{v}.
...
...
@@ -1581,6 +1578,10 @@ Thus, typing @kbd{C-c @key{PF1}} sends the character sequence @kbd{C-c
this back into @kbd{C-c @key{PF1}}, which it returns as the vector
@code{[?\C-c pf1]}.
@defvar input-decode-map
This variable holds a keymap that describes the character sequences sent
by function keys on an ordinary character terminal.
The value of @code{input-decode-map} is usually set up automatically
according to the terminal's Terminfo or Termcap entry, but sometimes
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:
(let ((symbol (if (symbolp e) e (car e))))
(setq symbol (intern (concat string
(symbol-name symbol))))
@end group
@group
(if (symbolp e)
symbol
(cons symbol (cdr e)))))
...
...
@@ -1666,10 +1665,30 @@ to turn the character that follows into a Hyper character:
@end example
If you have enabled keyboard character set decoding using
@code{set-keyboard-coding-system}, decoding is done after the
translations listed above. @xref{Terminal I/O Encoding}. However, in
future Emacs versions, character set decoding may be done at an
earlier stage.
@code{set-keyboard-coding-system}, decoding is done before the
translations listed above. @xref{Terminal I/O Encoding}.
@subsection Interaction with normal keymaps
The end of a key sequence is detected when that key sequence either is bound
to a command, or when Emacs determines that no additional event can lead
to a sequence that is bound to a command.
This means that, while @code{input-decode-map} and @code{key-translation-map}
apply regardless of whether the original key sequence would have a binding, the
presence of such a binding can still prevent translation from taking place.
For example, let us return to our VT100 example above and add a binding for
@kbd{C-c @key{ESC}} to the global map; now when the user hits @kbd{C-c
@key{PF1}} Emacs will fail to decode @kbd{C-c @key{ESC} O P} into @kbd{C-c
@key{PF1}} because it will stop reading keys right after @kbd{C-x @key{ESC}},
leaving @kbd{O P} for later. This is in case the user really hit @kbd{C-c
@key{ESC}}, in which case Emacs should not sit there waiting for the next key
to decide whether the user really pressed @kbd{@key{ESC}} or @kbd{@key{PF1}}.
For that reason, it is better to avoid binding commands to key sequences where
the end of the key sequence is a prefix of a key translation. The main such
problematic suffixes/prefixes are @kbd{@key{ESC}}, @kbd{M-O} (which is really
@kbd{@key{ESC} O}) and @kbd{M-[} (which is really @kbd{@key{ESC} [}).
@node Key Binding Commands
@section Commands for Binding Keys
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment