[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/keyboard.c
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] Changes to emacs/src/keyboard.c |
Date: |
Mon, 17 Jun 2002 14:45:45 -0400 |
Index: emacs/src/keyboard.c
diff -c emacs/src/keyboard.c:1.682 emacs/src/keyboard.c:1.683
*** emacs/src/keyboard.c:1.682 Thu Jun 13 10:56:17 2002
--- emacs/src/keyboard.c Mon Jun 17 14:45:44 2002
***************
*** 8051,8061 ****
struct buffer *starting_buffer;
- /* Nonzero if we seem to have got the beginning of a binding
- in function_key_map. */
- volatile int function_key_possible = 0;
- volatile int key_translation_possible = 0;
-
/* List of events for which a fake prefix key has been generated. */
volatile Lisp_Object fake_prefixed_keys = Qnil;
--- 8051,8056 ----
***************
*** 8122,8129 ****
replay_sequence:
starting_buffer = current_buffer;
- function_key_possible = 0;
- key_translation_possible = 0;
first_unbound = bufsize + 1;
/* Build our list of keymaps.
--- 8117,8122 ----
***************
*** 8193,8202 ****
we may be looking at a function key's escape sequence, keep on
reading. */
while ((first_binding < nmaps && ! NILP (submaps[first_binding]))
! || (first_binding >= nmaps
! && fkey_start < t)
! || (first_binding >= nmaps
! && keytran_start < t && key_translation_possible)
/* Don't return in the middle of a possible function key sequence,
if the only bindings we found were via case conversion.
Thus, if ESC O a has a function-key-map translation
--- 8186,8193 ----
we may be looking at a function key's escape sequence, keep on
reading. */
while ((first_binding < nmaps && ! NILP (submaps[first_binding]))
! || (first_binding >= nmaps && fkey_start < t)
! || (first_binding >= nmaps && keytran_start < t)
/* Don't return in the middle of a possible function key sequence,
if the only bindings we found were via case conversion.
Thus, if ESC O a has a function-key-map translation
***************
*** 8626,8632 ****
+ first_binding);
/* If KEY wasn't bound, we'll try some fallbacks. */
! if (first_binding >= nmaps)
{
Lisp_Object head;
--- 8617,8631 ----
+ first_binding);
/* If KEY wasn't bound, we'll try some fallbacks. */
! if (first_binding < nmaps)
! /* This is needed for the following scenario:
! event 0: a down-event that gets dropped by calling replay_key.
! event 1: some normal prefix like C-h.
! After event 0, first_unbound is 0, after event 1 fkey_start
! and keytran_start are both 1, so when we see that C-h is bound,
! we need to update first_unbound. */
! first_unbound = max (t + 1, first_unbound);
! else
{
Lisp_Object head;
***************
*** 8706,8711 ****
--- 8705,8714 ----
generate mouse events, so it's okay to zero
mock_input in that case too.
+ FIXME: The above paragraph seems just plain
+ wrong, if you consider things like
+ xterm-mouse-mode. -stef
+
Isn't this just the most wonderful code ever? */
if (t == last_real_key_start)
{
***************
*** 8758,8782 ****
/* Record what part of this_command_keys is the current key sequence.
*/
this_single_command_key_start = this_command_key_count - t;
! /* If the sequence is unbound, see if we can hang a function key
! off the end of it. We only want to scan real keyboard input
! for function key sequences, so if mock_input says that we're
! re-reading old events, don't examine it. */
! if (first_binding >= nmaps
! && t >= mock_input)
{
Lisp_Object fkey_next;
/* Continue scan from fkey_end until we find a bound suffix.
! If we fail, increment fkey_start
! and start fkey_end from there. */
while (fkey_end < t)
{
Lisp_Object key;
key = keybuf[fkey_end++];
! fkey_next
! = access_keymap (fkey_map, key, 1, 0, 1);
/* Handle symbol with autoload definition. */
if (SYMBOLP (fkey_next) && ! NILP (Ffboundp (fkey_next))
--- 8761,8790 ----
/* Record what part of this_command_keys is the current key sequence.
*/
this_single_command_key_start = this_command_key_count - t;
! if (first_binding < nmaps && NILP (submaps[first_binding]))
! /* There is a binding and it's not a prefix.
! There is thus no function-key in this sequence.
! Moving fkey.start is important in this case to allow keytran.start
! to go over the sequence before we return (since we keep the
! invariant that keytran.end <= fkey.start). */
! {
! if (fkey_start < t)
! (fkey_start = fkey_end = t, fkey_map = Vfunction_key_map);
! }
! else
! /* If the sequence is unbound, see if we can hang a function key
! off the end of it. */
{
Lisp_Object fkey_next;
/* Continue scan from fkey_end until we find a bound suffix.
! If we fail, increment fkey_start and start over from there. */
while (fkey_end < t)
{
Lisp_Object key;
key = keybuf[fkey_end++];
! fkey_next = access_keymap (fkey_map, key, 1, 0, 1);
/* Handle symbol with autoload definition. */
if (SYMBOLP (fkey_next) && ! NILP (Ffboundp (fkey_next))
***************
*** 8804,8810 ****
array, then call the function with no args and use
its value instead. */
if (SYMBOLP (fkey_next) && ! NILP (Ffboundp (fkey_next))
! && fkey_end == t)
{
struct gcpro gcpro1, gcpro2, gcpro3;
Lisp_Object tem;
--- 8812,8820 ----
array, then call the function with no args and use
its value instead. */
if (SYMBOLP (fkey_next) && ! NILP (Ffboundp (fkey_next))
! /* If there's a binding (i.e. first_binding >= nmaps)
! we don't want to apply this function-key-mapping. */
! && fkey_end == t && first_binding >= nmaps)
{
struct gcpro gcpro1, gcpro2, gcpro3;
Lisp_Object tem;
***************
*** 8821,8834 ****
error ("Function in key-translation-map returns invalid key
sequence");
}
- function_key_possible = ! NILP (fkey_next);
-
/* If keybuf[fkey_start..fkey_end] is bound in the
function key map and it's a suffix of the current
sequence (i.e. fkey_end == t), replace it with
the binding and restart with fkey_start at the end. */
if ((VECTORP (fkey_next) || STRINGP (fkey_next))
! && fkey_end == t)
{
int len = XFASTINT (Flength (fkey_next));
--- 8831,8844 ----
error ("Function in key-translation-map returns invalid key
sequence");
}
/* If keybuf[fkey_start..fkey_end] is bound in the
function key map and it's a suffix of the current
sequence (i.e. fkey_end == t), replace it with
the binding and restart with fkey_start at the end. */
if ((VECTORP (fkey_next) || STRINGP (fkey_next))
! /* If there's a binding (i.e. first_binding >= nmaps)
! we don't want to apply this function-key-mapping. */
! && fkey_end == t && first_binding >= nmaps)
{
int len = XFASTINT (Flength (fkey_next));
***************
*** 8870,8889 ****
{
fkey_end = ++fkey_start;
fkey_map = Vfunction_key_map;
- function_key_possible = 0;
}
}
}
- else if (NILP (submaps[first_binding]))
- /* There is a global binding and it's not a prefix.
- There is thus no function-key in this sequence.
- We can probably show that there can't be any afterwards either
- but I can't seem to find a clear reason why not, so I'll
- be conservative.
- Moving fkey.start is important in this case to allow keytran.start
- to go over the sequence before we return (since we keep the
- invariant that keytran.end <= fkey.start). */
- (fkey_start = max (fkey_start, t), fkey_end = max (fkey_end, t));
/* Look for this sequence in key-translation-map. */
{
--- 8880,8888 ----
***************
*** 8932,8939 ****
error ("Function in key-translation-map returns invalid key
sequence");
}
- key_translation_possible = ! NILP (keytran_next);
-
/* If keybuf[keytran_start..keytran_end] is bound in the
key translation map and it's a suffix of the current
sequence (i.e. keytran_end == t), replace it with
--- 8931,8936 ----
***************
*** 8979,8985 ****
{
keytran_end = ++keytran_start;
keytran_map = Vkey_translation_map;
- key_translation_possible = 0;
}
}
}
--- 8976,8981 ----
***************
*** 8988,8995 ****
and cannot be part of a function key or translation,
and is an upper case letter
use the corresponding lower-case letter instead. */
! if (first_binding == nmaps && ! function_key_possible
! && ! key_translation_possible
&& INTEGERP (key)
&& ((((XINT (key) & 0x3ffff)
< XCHAR_TABLE (current_buffer->downcase_table)->size)
--- 8984,8991 ----
and cannot be part of a function key or translation,
and is an upper case letter
use the corresponding lower-case letter instead. */
! if (first_binding >= nmaps
! && fkey_start >= t && keytran_start >= t
&& INTEGERP (key)
&& ((((XINT (key) & 0x3ffff)
< XCHAR_TABLE (current_buffer->downcase_table)->size)
***************
*** 9019,9026 ****
and cannot be part of a function key or translation,
and is a shifted function key,
use the corresponding unshifted function key instead. */
! if (first_binding == nmaps && ! function_key_possible
! && ! key_translation_possible
&& SYMBOLP (key))
{
Lisp_Object breakdown;
--- 9015,9022 ----
and cannot be part of a function key or translation,
and is a shifted function key,
use the corresponding unshifted function key instead. */
! if (first_binding >= nmaps
! && fkey_start >= t && keytran_start >= t
&& SYMBOLP (key))
{
Lisp_Object breakdown;