Mercurial > emacs
changeset 93543:ae83caf43667
(Vthis_command_keys_shift_translated): New var.
(command_loop_1): Avoid running the direct display versions of
forward-char and backward-char if shift-selection may occur.
Don't change the value of transient-mark-mode; this is now handled
by handle-shift-selection.
(read_key_sequence): Set Vthis_command_keys_shift_translated if
shift-translation takes place.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Wed, 02 Apr 2008 20:14:57 +0000 |
parents | 5dd7fdf8c27e |
children | b75140e5e267 |
files | src/keyboard.c |
diffstat | 1 files changed, 32 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/keyboard.c Wed Apr 02 20:14:40 2008 +0000 +++ b/src/keyboard.c Wed Apr 02 20:14:57 2008 +0000 @@ -132,6 +132,9 @@ Lisp_Object raw_keybuf; int raw_keybuf_count; +/* Non-nil if the present key sequence was obtained by shift translation. */ +Lisp_Object Vthis_command_keys_shift_translated; + #define GROW_RAW_KEYBUF \ if (raw_keybuf_count == XVECTOR (raw_keybuf)->size) \ raw_keybuf = larger_vector (raw_keybuf, raw_keybuf_count * 2, Qnil) \ @@ -658,8 +661,6 @@ /* Nonzero means don't try to suspend even if the operating system seems to support it. */ static int cannot_suspend; - -extern Lisp_Object Qidentity, Qonly; /* Install the string STR as the beginning of the string of echoing, so that it serves as a prompt for the next character. @@ -1648,6 +1649,7 @@ Vthis_command = Qnil; real_this_command = Qnil; Vthis_original_command = Qnil; + Vthis_command_keys_shift_translated = Qnil; /* Read next key sequence; i gets its length. */ i = read_key_sequence (keybuf, sizeof keybuf / sizeof keybuf[0], @@ -1761,7 +1763,9 @@ /* Recognize some common commands in common situations and do them directly. */ - if (EQ (Vthis_command, Qforward_char) && PT < ZV) + if (EQ (Vthis_command, Qforward_char) && PT < ZV + && NILP (Vthis_command_keys_shift_translated) + && !CONSP (Vtransient_mark_mode)) { struct Lisp_Char_Table *dp = window_display_table (XWINDOW (selected_window)); @@ -1801,7 +1805,9 @@ direct_output_forward_char (1); goto directly_done; } - else if (EQ (Vthis_command, Qbackward_char) && PT > BEGV) + else if (EQ (Vthis_command, Qbackward_char) && PT > BEGV + && NILP (Vthis_command_keys_shift_translated) + && !CONSP (Vtransient_mark_mode)) { struct Lisp_Char_Table *dp = window_display_table (XWINDOW (selected_window)); @@ -1961,14 +1967,6 @@ if (!NILP (current_buffer->mark_active) && !NILP (Vrun_hooks)) { - /* Setting transient-mark-mode to `only' is a way of - turning it on for just one command. */ - - if (EQ (Vtransient_mark_mode, Qidentity)) - Vtransient_mark_mode = Qnil; - if (EQ (Vtransient_mark_mode, Qonly)) - Vtransient_mark_mode = Qidentity; - if (!NILP (Vdeactivate_mark) && !NILP (Vtransient_mark_mode)) { /* We could also call `deactivate'mark'. */ @@ -9209,6 +9207,11 @@ /* Likewise, for key_translation_map and input-decode-map. */ volatile keyremap keytran, indec; + /* Non-zero if we are trying to map a key by changing an upper-case + letter to lower case, or a shifted function key to an unshifted + one. */ + volatile int shift_translated = 0; + /* If we receive a `switch-frame' or `select-window' event in the middle of a key sequence, we put it off for later. While we're reading, we keep the event here. */ @@ -10127,6 +10130,7 @@ might get translated through function-key-map. */ keybuf[t - 1] = new_key; mock_input = max (t, mock_input); + shift_translated = 1; goto replay_sequence; } @@ -10168,6 +10172,7 @@ input-decode-map doesn't need to go through it again. */ fkey.start = fkey.end = 0; keytran.start = keytran.end = 0; + shift_translated = 1; goto replay_sequence; } @@ -10186,7 +10191,13 @@ if ((dont_downcase_last || first_binding >= nmaps) && t > 0 && t - 1 == original_uppercase_position) - keybuf[t - 1] = original_uppercase; + { + keybuf[t - 1] = original_uppercase; + shift_translated = 0; + } + + if (shift_translated) + Vthis_command_keys_shift_translated = Qt; /* Occasionally we fabricate events, perhaps by expanding something according to function-key-map, or by adding a prefix symbol to a @@ -10205,8 +10216,6 @@ add_command_key (keybuf[t]); } - - UNGCPRO; return t; } @@ -12100,6 +12109,14 @@ will be in `last-command' during the following command. */); Vthis_command = Qnil; + DEFVAR_LISP ("this-command-keys-shift-translated", + &Vthis_command_keys_shift_translated, + doc: /* Non-nil if the key sequence activating this command was shift-translated. +Shift-translation occurs when there is no binding for the key sequence +as entered, but a binding was found by changing an upper-case letter +to lower-case, or a shifted function key to an unshifted one. */); + Vthis_command_keys_shift_translated = Qnil; + DEFVAR_LISP ("this-original-command", &Vthis_original_command, doc: /* The command bound to the current key sequence before remapping. It equals `this-command' if the original command was not remapped through