aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1995-01-10 18:37:06 +0000
committerRichard M. Stallman1995-01-10 18:37:06 +0000
commite0dff5f63e80a434d74a6720f950b1ccdcb3743f (patch)
tree872c5314dd9dc97cf9b115552ce7da3b37797d4c /src
parent00b05a4299c9092fcad82fdf9f0e9834269f4aa6 (diff)
downloademacs-e0dff5f63e80a434d74a6720f950b1ccdcb3743f.tar.gz
emacs-e0dff5f63e80a434d74a6720f950b1ccdcb3743f.zip
(syms_of_keyboard): Doc fix.
(read_key_sequence): If first event is mouse click, use the text property keymap from where the click was. New local var orig_local_map.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c48
1 files changed, 42 insertions, 6 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 2f69514dc24..9f852adbb04 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -4495,6 +4495,13 @@ read_key_sequence (keybuf, bufsize, prompt)
4495 in the current keymaps, or nil where it is not a prefix. */ 4495 in the current keymaps, or nil where it is not a prefix. */
4496 Lisp_Object *submaps; 4496 Lisp_Object *submaps;
4497 4497
4498 /* The local map to start out with at start of key sequence. */
4499 Lisp_Object orig_local_map;
4500
4501 /* 1 if we have already considered switching to the local-map property
4502 of the place where a mouse click occurred. */
4503 int localized_local_map = 0;
4504
4498 /* The index in defs[] of the first keymap that has a binding for 4505 /* The index in defs[] of the first keymap that has a binding for
4499 this key sequence. In other words, the lowest i such that 4506 this key sequence. In other words, the lowest i such that
4500 defs[i] is non-nil. */ 4507 defs[i] is non-nil. */
@@ -4592,6 +4599,8 @@ read_key_sequence (keybuf, bufsize, prompt)
4592 &junk); 4599 &junk);
4593#endif /* GOBBLE_FIRST_EVENT */ 4600#endif /* GOBBLE_FIRST_EVENT */
4594 4601
4602 orig_local_map = get_local_map (PT, current_buffer);
4603
4595 /* We jump here when the key sequence has been thoroughly changed, and 4604 /* We jump here when the key sequence has been thoroughly changed, and
4596 we need to rescan it starting from the beginning. When we jump here, 4605 we need to rescan it starting from the beginning. When we jump here,
4597 keybuf[0..mock_input] holds the sequence we should reread. */ 4606 keybuf[0..mock_input] holds the sequence we should reread. */
@@ -4631,7 +4640,7 @@ read_key_sequence (keybuf, bufsize, prompt)
4631 } 4640 }
4632 bcopy (maps, submaps, (nmaps - 2) * sizeof (submaps[0])); 4641 bcopy (maps, submaps, (nmaps - 2) * sizeof (submaps[0]));
4633#ifdef USE_TEXT_PROPERTIES 4642#ifdef USE_TEXT_PROPERTIES
4634 submaps[nmaps-2] = get_local_map (PT, current_buffer); 4643 submaps[nmaps-2] = orig_local_map;
4635#else 4644#else
4636 submaps[nmaps-2] = current_buffer->keymap; 4645 submaps[nmaps-2] = current_buffer->keymap;
4637#endif 4646#endif
@@ -4821,13 +4830,40 @@ read_key_sequence (keybuf, bufsize, prompt)
4821 record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); 4830 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
4822 4831
4823 set_buffer_internal (XBUFFER (XWINDOW (window)->buffer)); 4832 set_buffer_internal (XBUFFER (XWINDOW (window)->buffer));
4833 orig_local_map = get_local_map (PT, current_buffer);
4824 goto replay_sequence; 4834 goto replay_sequence;
4825 } 4835 }
4826 else if (SYMBOLP (posn)) 4836 /* For a mouse click, get the local text-property keymap
4837 of the place clicked on, rather than point. */
4838 if (last_real_key_start == 0 && CONSP (XCONS (key)->cdr)
4839 && ! localized_local_map)
4827 { 4840 {
4828 /* Expand mode-line and scroll-bar events into two events: 4841 Lisp_Object map_here, start, pos;
4829 use posn as a fake prefix key. */ 4842
4843 localized_local_map = 1;
4844 start = EVENT_START (key);
4845 if (CONSP (start) && CONSP (XCONS (start)->cdr))
4846 {
4847 pos = POSN_BUFFER_POSN (start);
4848 if (INTEGERP (pos))
4849 {
4850 map_here = get_local_map (XINT (pos), current_buffer);
4851 if (!EQ (map_here, orig_local_map))
4852 {
4853 orig_local_map = map_here;
4854 keybuf[t] = key;
4855 mock_input = t + 1;
4830 4856
4857 goto replay_sequence;
4858 }
4859 }
4860 }
4861 }
4862
4863 /* Expand mode-line and scroll-bar events into two events:
4864 use posn as a fake prefix key. */
4865 if (SYMBOLP (posn))
4866 {
4831 if (t + 1 >= bufsize) 4867 if (t + 1 >= bufsize)
4832 error ("key sequence too long"); 4868 error ("key sequence too long");
4833 keybuf[t] = posn; 4869 keybuf[t] = posn;
@@ -6315,11 +6351,11 @@ by position only.");
6315 inhibit_local_menu_bar_menus = 0; 6351 inhibit_local_menu_bar_menus = 0;
6316 6352
6317 DEFVAR_INT ("num-input-keys", &num_input_keys, 6353 DEFVAR_INT ("num-input-keys", &num_input_keys,
6318 "*Number of complete keys read from the keyboard so far."); 6354 "Number of complete keys read from the keyboard so far.");
6319 num_input_keys = 0; 6355 num_input_keys = 0;
6320 6356
6321 DEFVAR_LISP ("last-event-frame", &Vlast_event_frame, 6357 DEFVAR_LISP ("last-event-frame", &Vlast_event_frame,
6322 "*The frame in which the most recently read event occurred.\n\ 6358 "The frame in which the most recently read event occurred.\n\
6323If the last event came from a keyboard macro, this is set to `macro'."); 6359If the last event came from a keyboard macro, this is set to `macro'.");
6324 Vlast_event_frame = Qnil; 6360 Vlast_event_frame = Qnil;
6325 6361