aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChong Yidong2008-04-02 20:14:57 +0000
committerChong Yidong2008-04-02 20:14:57 +0000
commit025ae9533de941cd045374c1639d20e9b830284a (patch)
tree35f73eadfd5df63940c4b3dbf625d91a4ca8c10a /src
parent9bdb1538a5700b6bf26f3c7ed06e2e750760978a (diff)
downloademacs-025ae9533de941cd045374c1639d20e9b830284a.tar.gz
emacs-025ae9533de941cd045374c1639d20e9b830284a.zip
(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.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c47
1 files changed, 32 insertions, 15 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index a930fe74289..526586f17f2 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -132,6 +132,9 @@ int this_command_key_count_reset;
132Lisp_Object raw_keybuf; 132Lisp_Object raw_keybuf;
133int raw_keybuf_count; 133int raw_keybuf_count;
134 134
135/* Non-nil if the present key sequence was obtained by shift translation. */
136Lisp_Object Vthis_command_keys_shift_translated;
137
135#define GROW_RAW_KEYBUF \ 138#define GROW_RAW_KEYBUF \
136 if (raw_keybuf_count == XVECTOR (raw_keybuf)->size) \ 139 if (raw_keybuf_count == XVECTOR (raw_keybuf)->size) \
137 raw_keybuf = larger_vector (raw_keybuf, raw_keybuf_count * 2, Qnil) \ 140 raw_keybuf = larger_vector (raw_keybuf, raw_keybuf_count * 2, Qnil) \
@@ -658,8 +661,6 @@ static int store_user_signal_events P_ ((void));
658/* Nonzero means don't try to suspend even if the operating system seems 661/* Nonzero means don't try to suspend even if the operating system seems
659 to support it. */ 662 to support it. */
660static int cannot_suspend; 663static int cannot_suspend;
661
662extern Lisp_Object Qidentity, Qonly;
663 664
664/* Install the string STR as the beginning of the string of echoing, 665/* Install the string STR as the beginning of the string of echoing,
665 so that it serves as a prompt for the next character. 666 so that it serves as a prompt for the next character.
@@ -1648,6 +1649,7 @@ command_loop_1 ()
1648 Vthis_command = Qnil; 1649 Vthis_command = Qnil;
1649 real_this_command = Qnil; 1650 real_this_command = Qnil;
1650 Vthis_original_command = Qnil; 1651 Vthis_original_command = Qnil;
1652 Vthis_command_keys_shift_translated = Qnil;
1651 1653
1652 /* Read next key sequence; i gets its length. */ 1654 /* Read next key sequence; i gets its length. */
1653 i = read_key_sequence (keybuf, sizeof keybuf / sizeof keybuf[0], 1655 i = read_key_sequence (keybuf, sizeof keybuf / sizeof keybuf[0],
@@ -1761,7 +1763,9 @@ command_loop_1 ()
1761 1763
1762 /* Recognize some common commands in common situations and 1764 /* Recognize some common commands in common situations and
1763 do them directly. */ 1765 do them directly. */
1764 if (EQ (Vthis_command, Qforward_char) && PT < ZV) 1766 if (EQ (Vthis_command, Qforward_char) && PT < ZV
1767 && NILP (Vthis_command_keys_shift_translated)
1768 && !CONSP (Vtransient_mark_mode))
1765 { 1769 {
1766 struct Lisp_Char_Table *dp 1770 struct Lisp_Char_Table *dp
1767 = window_display_table (XWINDOW (selected_window)); 1771 = window_display_table (XWINDOW (selected_window));
@@ -1801,7 +1805,9 @@ command_loop_1 ()
1801 direct_output_forward_char (1); 1805 direct_output_forward_char (1);
1802 goto directly_done; 1806 goto directly_done;
1803 } 1807 }
1804 else if (EQ (Vthis_command, Qbackward_char) && PT > BEGV) 1808 else if (EQ (Vthis_command, Qbackward_char) && PT > BEGV
1809 && NILP (Vthis_command_keys_shift_translated)
1810 && !CONSP (Vtransient_mark_mode))
1805 { 1811 {
1806 struct Lisp_Char_Table *dp 1812 struct Lisp_Char_Table *dp
1807 = window_display_table (XWINDOW (selected_window)); 1813 = window_display_table (XWINDOW (selected_window));
@@ -1961,14 +1967,6 @@ command_loop_1 ()
1961 1967
1962 if (!NILP (current_buffer->mark_active) && !NILP (Vrun_hooks)) 1968 if (!NILP (current_buffer->mark_active) && !NILP (Vrun_hooks))
1963 { 1969 {
1964 /* Setting transient-mark-mode to `only' is a way of
1965 turning it on for just one command. */
1966
1967 if (EQ (Vtransient_mark_mode, Qidentity))
1968 Vtransient_mark_mode = Qnil;
1969 if (EQ (Vtransient_mark_mode, Qonly))
1970 Vtransient_mark_mode = Qidentity;
1971
1972 if (!NILP (Vdeactivate_mark) && !NILP (Vtransient_mark_mode)) 1970 if (!NILP (Vdeactivate_mark) && !NILP (Vtransient_mark_mode))
1973 { 1971 {
1974 /* We could also call `deactivate'mark'. */ 1972 /* We could also call `deactivate'mark'. */
@@ -9209,6 +9207,11 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
9209 /* Likewise, for key_translation_map and input-decode-map. */ 9207 /* Likewise, for key_translation_map and input-decode-map. */
9210 volatile keyremap keytran, indec; 9208 volatile keyremap keytran, indec;
9211 9209
9210 /* Non-zero if we are trying to map a key by changing an upper-case
9211 letter to lower case, or a shifted function key to an unshifted
9212 one. */
9213 volatile int shift_translated = 0;
9214
9212 /* If we receive a `switch-frame' or `select-window' event in the middle of 9215 /* If we receive a `switch-frame' or `select-window' event in the middle of
9213 a key sequence, we put it off for later. 9216 a key sequence, we put it off for later.
9214 While we're reading, we keep the event here. */ 9217 While we're reading, we keep the event here. */
@@ -10127,6 +10130,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
10127 might get translated through function-key-map. */ 10130 might get translated through function-key-map. */
10128 keybuf[t - 1] = new_key; 10131 keybuf[t - 1] = new_key;
10129 mock_input = max (t, mock_input); 10132 mock_input = max (t, mock_input);
10133 shift_translated = 1;
10130 10134
10131 goto replay_sequence; 10135 goto replay_sequence;
10132 } 10136 }
@@ -10168,6 +10172,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
10168 input-decode-map doesn't need to go through it again. */ 10172 input-decode-map doesn't need to go through it again. */
10169 fkey.start = fkey.end = 0; 10173 fkey.start = fkey.end = 0;
10170 keytran.start = keytran.end = 0; 10174 keytran.start = keytran.end = 0;
10175 shift_translated = 1;
10171 10176
10172 goto replay_sequence; 10177 goto replay_sequence;
10173 } 10178 }
@@ -10186,7 +10191,13 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
10186 if ((dont_downcase_last || first_binding >= nmaps) 10191 if ((dont_downcase_last || first_binding >= nmaps)
10187 && t > 0 10192 && t > 0
10188 && t - 1 == original_uppercase_position) 10193 && t - 1 == original_uppercase_position)
10189 keybuf[t - 1] = original_uppercase; 10194 {
10195 keybuf[t - 1] = original_uppercase;
10196 shift_translated = 0;
10197 }
10198
10199 if (shift_translated)
10200 Vthis_command_keys_shift_translated = Qt;
10190 10201
10191 /* Occasionally we fabricate events, perhaps by expanding something 10202 /* Occasionally we fabricate events, perhaps by expanding something
10192 according to function-key-map, or by adding a prefix symbol to a 10203 according to function-key-map, or by adding a prefix symbol to a
@@ -10205,8 +10216,6 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
10205 add_command_key (keybuf[t]); 10216 add_command_key (keybuf[t]);
10206 } 10217 }
10207 10218
10208
10209
10210 UNGCPRO; 10219 UNGCPRO;
10211 return t; 10220 return t;
10212} 10221}
@@ -12100,6 +12109,14 @@ The command can set this variable; whatever is put here
12100will be in `last-command' during the following command. */); 12109will be in `last-command' during the following command. */);
12101 Vthis_command = Qnil; 12110 Vthis_command = Qnil;
12102 12111
12112 DEFVAR_LISP ("this-command-keys-shift-translated",
12113 &Vthis_command_keys_shift_translated,
12114 doc: /* Non-nil if the key sequence activating this command was shift-translated.
12115Shift-translation occurs when there is no binding for the key sequence
12116as entered, but a binding was found by changing an upper-case letter
12117to lower-case, or a shifted function key to an unshifted one. */);
12118 Vthis_command_keys_shift_translated = Qnil;
12119
12103 DEFVAR_LISP ("this-original-command", &Vthis_original_command, 12120 DEFVAR_LISP ("this-original-command", &Vthis_original_command,
12104 doc: /* The command bound to the current key sequence before remapping. 12121 doc: /* The command bound to the current key sequence before remapping.
12105It equals `this-command' if the original command was not remapped through 12122It equals `this-command' if the original command was not remapped through