Mercurial > emacs
comparison src/keyboard.c @ 37689:4fe5b946a4af
(read_key_sequence): Don't modify events when
generating fake prefix keys (mode-line, scroll-bar, ...) since
this prevents proper processing of such events when pushed back
into unread-command-events.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Fri, 11 May 2001 16:10:29 +0000 |
parents | df85a76987bb |
children | c3dd00963b46 |
comparison
equal
deleted
inserted
replaced
37688:187a17e0e802 | 37689:4fe5b946a4af |
---|---|
7869 /* Nonzero if we seem to have got the beginning of a binding | 7869 /* Nonzero if we seem to have got the beginning of a binding |
7870 in function_key_map. */ | 7870 in function_key_map. */ |
7871 volatile int function_key_possible = 0; | 7871 volatile int function_key_possible = 0; |
7872 volatile int key_translation_possible = 0; | 7872 volatile int key_translation_possible = 0; |
7873 | 7873 |
7874 /* List of events for which a fake prefix key has been generated. */ | |
7875 volatile Lisp_Object fake_prefixed_keys = Qnil; | |
7876 | |
7874 /* Save the status of key translation before each step, | 7877 /* Save the status of key translation before each step, |
7875 so that we can restore this after downcasing. */ | 7878 so that we can restore this after downcasing. */ |
7876 Lisp_Object prev_fkey_map; | 7879 Lisp_Object prev_fkey_map; |
7877 int prev_fkey_start; | 7880 int prev_fkey_start; |
7878 int prev_fkey_end; | 7881 int prev_fkey_end; |
7883 | 7886 |
7884 #if defined (GOBBLE_FIRST_EVENT) | 7887 #if defined (GOBBLE_FIRST_EVENT) |
7885 int junk; | 7888 int junk; |
7886 #endif | 7889 #endif |
7887 | 7890 |
7891 struct gcpro gcpro1; | |
7892 | |
7893 GCPRO1 (fake_prefixed_keys); | |
7888 raw_keybuf_count = 0; | 7894 raw_keybuf_count = 0; |
7889 | 7895 |
7890 last_nonmenu_event = Qnil; | 7896 last_nonmenu_event = Qnil; |
7891 | 7897 |
7892 delayed_switch_frame = Qnil; | 7898 delayed_switch_frame = Qnil; |
8115 /* read_char returns t when it shows a menu and the user rejects it. | 8121 /* read_char returns t when it shows a menu and the user rejects it. |
8116 Just return -1. */ | 8122 Just return -1. */ |
8117 if (EQ (key, Qt)) | 8123 if (EQ (key, Qt)) |
8118 { | 8124 { |
8119 unbind_to (count, Qnil); | 8125 unbind_to (count, Qnil); |
8126 UNGCPRO; | |
8120 return -1; | 8127 return -1; |
8121 } | 8128 } |
8122 | 8129 |
8123 /* read_char returns -1 at the end of a macro. | 8130 /* read_char returns -1 at the end of a macro. |
8124 Emacs 18 handles this by returning immediately with a | 8131 Emacs 18 handles this by returning immediately with a |
8298 } | 8305 } |
8299 } | 8306 } |
8300 | 8307 |
8301 /* Expand mode-line and scroll-bar events into two events: | 8308 /* Expand mode-line and scroll-bar events into two events: |
8302 use posn as a fake prefix key. */ | 8309 use posn as a fake prefix key. */ |
8303 if (SYMBOLP (posn)) | 8310 if (SYMBOLP (posn) |
8311 && (NILP (fake_prefixed_keys) | |
8312 || NILP (Fmemq (key, fake_prefixed_keys)))) | |
8304 { | 8313 { |
8305 if (t + 1 >= bufsize) | 8314 if (t + 1 >= bufsize) |
8306 error ("Key sequence too long"); | 8315 error ("Key sequence too long"); |
8307 keybuf[t] = posn; | |
8308 keybuf[t+1] = key; | |
8309 mock_input = t + 2; | |
8310 | 8316 |
8311 /* Zap the position in key, so we know that we've | 8317 keybuf[t] = posn; |
8312 expanded it, and don't try to do so again. */ | 8318 keybuf[t + 1] = key; |
8313 POSN_BUFFER_POSN (EVENT_START (key)) | 8319 mock_input = t + 2; |
8314 = Fcons (posn, Qnil); | 8320 |
8321 /* Record that a fake prefix key has been generated | |
8322 for KEY. Don't modify the event; this would | |
8323 prevent proper action when the event is pushed | |
8324 back tino unread-command-events. */ | |
8325 fake_prefixed_keys = Fcons (key, fake_prefixed_keys); | |
8315 | 8326 |
8316 /* If on a mode line string with a local keymap, | 8327 /* If on a mode line string with a local keymap, |
8317 reconsider the key sequence with that keymap. */ | 8328 reconsider the key sequence with that keymap. */ |
8318 if (CONSP (POSN_STRING (EVENT_START (key)))) | 8329 if (CONSP (POSN_STRING (EVENT_START (key)))) |
8319 { | 8330 { |
8878 add_command_key (keybuf[t]); | 8889 add_command_key (keybuf[t]); |
8879 } | 8890 } |
8880 | 8891 |
8881 | 8892 |
8882 | 8893 |
8894 UNGCPRO; | |
8883 return t; | 8895 return t; |
8884 } | 8896 } |
8885 | 8897 |
8886 #if 0 /* This doc string is too long for some compilers. | 8898 #if 0 /* This doc string is too long for some compilers. |
8887 This commented-out definition serves for DOC. */ | 8899 This commented-out definition serves for DOC. */ |