diff options
| author | Karl Heuer | 1994-03-22 01:24:14 +0000 |
|---|---|---|
| committer | Karl Heuer | 1994-03-22 01:24:14 +0000 |
| commit | 9b8eb840e1c7d14730a844b8ab49de212b9e03f2 (patch) | |
| tree | 251620a7114ce4f65bc96ebf540013284627d88d /src | |
| parent | 230ac7f6ed68f7a589fb4c82f51d62174c582742 (diff) | |
| download | emacs-9b8eb840e1c7d14730a844b8ab49de212b9e03f2.tar.gz emacs-9b8eb840e1c7d14730a844b8ab49de212b9e03f2.zip | |
(add_command_key, command_loop_1, read_char, kbd_buffer_store_event,
kbd_buffer_get_event, make_lispy_event, make_lispy_movement,
apply_modifiers_uncached, parse_modifiers, apply_modifiers, reorder_modifiers,
read_key_sequence): Use assignment, not initialization.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 83 |
1 files changed, 50 insertions, 33 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index cde60632505..f09b7fadbc2 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -630,8 +630,9 @@ add_command_key (key) | |||
| 630 | 630 | ||
| 631 | if (this_command_key_count >= size) | 631 | if (this_command_key_count >= size) |
| 632 | { | 632 | { |
| 633 | Lisp_Object new_keys = Fmake_vector (make_number (size * 2), Qnil); | 633 | Lisp_Object new_keys; |
| 634 | 634 | ||
| 635 | new_keys = Fmake_vector (make_number (size * 2), Qnil); | ||
| 635 | bcopy (XVECTOR (this_command_keys)->contents, | 636 | bcopy (XVECTOR (this_command_keys)->contents, |
| 636 | XVECTOR (new_keys)->contents, | 637 | XVECTOR (new_keys)->contents, |
| 637 | size * sizeof (Lisp_Object)); | 638 | size * sizeof (Lisp_Object)); |
| @@ -1149,8 +1150,9 @@ command_loop_1 () | |||
| 1149 | 1150 | ||
| 1150 | if (dp) | 1151 | if (dp) |
| 1151 | { | 1152 | { |
| 1152 | Lisp_Object obj = DISP_CHAR_VECTOR (dp, lose); | 1153 | Lisp_Object obj; |
| 1153 | 1154 | ||
| 1155 | obj = DISP_CHAR_VECTOR (dp, lose); | ||
| 1154 | if (XTYPE (obj) == Lisp_Vector | 1156 | if (XTYPE (obj) == Lisp_Vector |
| 1155 | && XVECTOR (obj)->size == 1 | 1157 | && XVECTOR (obj)->size == 1 |
| 1156 | && (XTYPE (obj = XVECTOR (obj)->contents[0]) | 1158 | && (XTYPE (obj = XVECTOR (obj)->contents[0]) |
| @@ -1639,10 +1641,10 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 1639 | putc (XINT (c), dribble); | 1641 | putc (XINT (c), dribble); |
| 1640 | else | 1642 | else |
| 1641 | { | 1643 | { |
| 1642 | Lisp_Object dribblee = c; | 1644 | Lisp_Object dribblee; |
| 1643 | 1645 | ||
| 1644 | /* If it's a structured event, take the event header. */ | 1646 | /* If it's a structured event, take the event header. */ |
| 1645 | dribblee = EVENT_HEAD (dribblee); | 1647 | dribblee = EVENT_HEAD (c); |
| 1646 | 1648 | ||
| 1647 | if (XTYPE (dribblee) == Lisp_Symbol) | 1649 | if (XTYPE (dribblee) == Lisp_Symbol) |
| 1648 | { | 1650 | { |
| @@ -1828,9 +1830,9 @@ kbd_buffer_store_event (event) | |||
| 1828 | get returned to Emacs as an event, the next event read | 1830 | get returned to Emacs as an event, the next event read |
| 1829 | will set Vlast_event_frame again, so this is safe to do. */ | 1831 | will set Vlast_event_frame again, so this is safe to do. */ |
| 1830 | { | 1832 | { |
| 1831 | Lisp_Object focus | 1833 | Lisp_Object focus; |
| 1832 | = FRAME_FOCUS_FRAME (XFRAME (event->frame_or_window)); | ||
| 1833 | 1834 | ||
| 1835 | focus = FRAME_FOCUS_FRAME (XFRAME (event->frame_or_window)); | ||
| 1834 | if (NILP (focus)) | 1836 | if (NILP (focus)) |
| 1835 | internal_last_event_frame = event->frame_or_window; | 1837 | internal_last_event_frame = event->frame_or_window; |
| 1836 | else | 1838 | else |
| @@ -2017,9 +2019,10 @@ kbd_buffer_get_event () | |||
| 2017 | else | 2019 | else |
| 2018 | { | 2020 | { |
| 2019 | #ifdef MULTI_FRAME | 2021 | #ifdef MULTI_FRAME |
| 2020 | Lisp_Object frame = event->frame_or_window; | 2022 | Lisp_Object frame; |
| 2021 | Lisp_Object focus; | 2023 | Lisp_Object focus; |
| 2022 | 2024 | ||
| 2025 | frame = event->frame_or_window; | ||
| 2023 | if (XTYPE (frame) == Lisp_Window) | 2026 | if (XTYPE (frame) == Lisp_Window) |
| 2024 | frame = WINDOW_FRAME (XWINDOW (frame)); | 2027 | frame = WINDOW_FRAME (XWINDOW (frame)); |
| 2025 | 2028 | ||
| @@ -2068,8 +2071,9 @@ kbd_buffer_get_event () | |||
| 2068 | frames. */ | 2071 | frames. */ |
| 2069 | if (f) | 2072 | if (f) |
| 2070 | { | 2073 | { |
| 2071 | Lisp_Object frame = FRAME_FOCUS_FRAME (f); | 2074 | Lisp_Object frame; |
| 2072 | 2075 | ||
| 2076 | frame = FRAME_FOCUS_FRAME (f); | ||
| 2073 | if (NILP (frame)) | 2077 | if (NILP (frame)) |
| 2074 | XSET (frame, Lisp_Frame, f); | 2078 | XSET (frame, Lisp_Frame, f); |
| 2075 | 2079 | ||
| @@ -2630,8 +2634,9 @@ make_lispy_event (event) | |||
| 2630 | { | 2634 | { |
| 2631 | /* The third element of every position should be the (x,y) | 2635 | /* The third element of every position should be the (x,y) |
| 2632 | pair. */ | 2636 | pair. */ |
| 2633 | Lisp_Object down = Fnth (make_number (2), start_pos); | 2637 | Lisp_Object down; |
| 2634 | 2638 | ||
| 2639 | down = Fnth (make_number (2), start_pos); | ||
| 2635 | if (EQ (event->x, XCONS (down)->car) | 2640 | if (EQ (event->x, XCONS (down)->car) |
| 2636 | && EQ (event->y, XCONS (down)->cdr)) | 2641 | && EQ (event->y, XCONS (down)->cdr)) |
| 2637 | { | 2642 | { |
| @@ -2656,14 +2661,14 @@ make_lispy_event (event) | |||
| 2656 | 2661 | ||
| 2657 | { | 2662 | { |
| 2658 | /* Get the symbol we should use for the mouse click. */ | 2663 | /* Get the symbol we should use for the mouse click. */ |
| 2659 | Lisp_Object head | 2664 | Lisp_Object head; |
| 2660 | = modify_event_symbol (button, | 2665 | |
| 2661 | event->modifiers, | 2666 | head = modify_event_symbol (button, |
| 2662 | Qmouse_click, Qnil, | 2667 | event->modifiers, |
| 2663 | lispy_mouse_names, &mouse_syms, | 2668 | Qmouse_click, Qnil, |
| 2664 | (sizeof (lispy_mouse_names) | 2669 | lispy_mouse_names, &mouse_syms, |
| 2665 | / sizeof (lispy_mouse_names[0]))); | 2670 | (sizeof (lispy_mouse_names) |
| 2666 | 2671 | / sizeof (lispy_mouse_names[0]))); | |
| 2667 | if (event->modifiers & drag_modifier) | 2672 | if (event->modifiers & drag_modifier) |
| 2668 | return Fcons (head, | 2673 | return Fcons (head, |
| 2669 | Fcons (start_pos, | 2674 | Fcons (start_pos, |
| @@ -2698,8 +2703,9 @@ make_lispy_movement (frame, bar_window, part, x, y, time) | |||
| 2698 | /* Is it a scroll bar movement? */ | 2703 | /* Is it a scroll bar movement? */ |
| 2699 | if (frame && ! NILP (bar_window)) | 2704 | if (frame && ! NILP (bar_window)) |
| 2700 | { | 2705 | { |
| 2701 | Lisp_Object part_sym = *scroll_bar_parts[(int) part]; | 2706 | Lisp_Object part_sym; |
| 2702 | 2707 | ||
| 2708 | part_sym = *scroll_bar_parts[(int) part]; | ||
| 2703 | return Fcons (Qscroll_bar_movement, | 2709 | return Fcons (Qscroll_bar_movement, |
| 2704 | (Fcons (Fcons (bar_window, | 2710 | (Fcons (Fcons (bar_window, |
| 2705 | Fcons (Qvertical_scroll_bar, | 2711 | Fcons (Qvertical_scroll_bar, |
| @@ -2929,8 +2935,9 @@ apply_modifiers_uncached (modifiers, base, base_len) | |||
| 2929 | } | 2935 | } |
| 2930 | 2936 | ||
| 2931 | { | 2937 | { |
| 2932 | Lisp_Object new_name = make_uninit_string (mod_len + base_len); | 2938 | Lisp_Object new_name; |
| 2933 | 2939 | ||
| 2940 | new_name = make_uninit_string (mod_len + base_len); | ||
| 2934 | bcopy (new_mods, XSTRING (new_name)->data, mod_len); | 2941 | bcopy (new_mods, XSTRING (new_name)->data, mod_len); |
| 2935 | bcopy (base, XSTRING (new_name)->data + mod_len, base_len); | 2942 | bcopy (base, XSTRING (new_name)->data + mod_len, base_len); |
| 2936 | 2943 | ||
| @@ -2977,20 +2984,22 @@ static Lisp_Object | |||
| 2977 | parse_modifiers (symbol) | 2984 | parse_modifiers (symbol) |
| 2978 | Lisp_Object symbol; | 2985 | Lisp_Object symbol; |
| 2979 | { | 2986 | { |
| 2980 | Lisp_Object elements = Fget (symbol, Qevent_symbol_element_mask); | 2987 | Lisp_Object elements; |
| 2981 | 2988 | ||
| 2989 | elements = Fget (symbol, Qevent_symbol_element_mask); | ||
| 2982 | if (CONSP (elements)) | 2990 | if (CONSP (elements)) |
| 2983 | return elements; | 2991 | return elements; |
| 2984 | else | 2992 | else |
| 2985 | { | 2993 | { |
| 2986 | int end; | 2994 | int end; |
| 2987 | int modifiers = parse_modifiers_uncached (symbol, &end); | 2995 | int modifiers = parse_modifiers_uncached (symbol, &end); |
| 2988 | Lisp_Object unmodified | 2996 | Lisp_Object unmodified; |
| 2989 | = Fintern (make_string (XSYMBOL (symbol)->name->data + end, | ||
| 2990 | XSYMBOL (symbol)->name->size - end), | ||
| 2991 | Qnil); | ||
| 2992 | Lisp_Object mask; | 2997 | Lisp_Object mask; |
| 2993 | 2998 | ||
| 2999 | unmodified = Fintern (make_string (XSYMBOL (symbol)->name->data + end, | ||
| 3000 | XSYMBOL (symbol)->name->size - end), | ||
| 3001 | Qnil); | ||
| 3002 | |||
| 2994 | if (modifiers & ~((1<<VALBITS) - 1)) | 3003 | if (modifiers & ~((1<<VALBITS) - 1)) |
| 2995 | abort (); | 3004 | abort (); |
| 2996 | XFASTINT (mask) = modifiers; | 3005 | XFASTINT (mask) = modifiers; |
| @@ -3065,8 +3074,9 @@ apply_modifiers (modifiers, base) | |||
| 3065 | Qevent_kind set right as well. */ | 3074 | Qevent_kind set right as well. */ |
| 3066 | if (NILP (Fget (new_symbol, Qevent_kind))) | 3075 | if (NILP (Fget (new_symbol, Qevent_kind))) |
| 3067 | { | 3076 | { |
| 3068 | Lisp_Object kind = Fget (base, Qevent_kind); | 3077 | Lisp_Object kind; |
| 3069 | 3078 | ||
| 3079 | kind = Fget (base, Qevent_kind); | ||
| 3070 | if (! NILP (kind)) | 3080 | if (! NILP (kind)) |
| 3071 | Fput (new_symbol, Qevent_kind, kind); | 3081 | Fput (new_symbol, Qevent_kind, kind); |
| 3072 | } | 3082 | } |
| @@ -3089,8 +3099,9 @@ reorder_modifiers (symbol) | |||
| 3089 | { | 3099 | { |
| 3090 | /* It's hopefully okay to write the code this way, since everything | 3100 | /* It's hopefully okay to write the code this way, since everything |
| 3091 | will soon be in caches, and no consing will be done at all. */ | 3101 | will soon be in caches, and no consing will be done at all. */ |
| 3092 | Lisp_Object parsed = parse_modifiers (symbol); | 3102 | Lisp_Object parsed; |
| 3093 | 3103 | ||
| 3104 | parsed = parse_modifiers (symbol); | ||
| 3094 | return apply_modifiers (XCONS (XCONS (parsed)->cdr)->car, | 3105 | return apply_modifiers (XCONS (XCONS (parsed)->cdr)->car, |
| 3095 | XCONS (parsed)->car); | 3106 | XCONS (parsed)->car); |
| 3096 | } | 3107 | } |
| @@ -4440,13 +4451,15 @@ read_key_sequence (keybuf, bufsize, prompt) | |||
| 4440 | or when user programs play with this-command-keys. */ | 4451 | or when user programs play with this-command-keys. */ |
| 4441 | if (EVENT_HAS_PARAMETERS (key)) | 4452 | if (EVENT_HAS_PARAMETERS (key)) |
| 4442 | { | 4453 | { |
| 4443 | Lisp_Object kind = EVENT_HEAD_KIND (EVENT_HEAD (key)); | 4454 | Lisp_Object kind; |
| 4444 | 4455 | ||
| 4456 | kind = EVENT_HEAD_KIND (EVENT_HEAD (key)); | ||
| 4445 | if (EQ (kind, Qmouse_click)) | 4457 | if (EQ (kind, Qmouse_click)) |
| 4446 | { | 4458 | { |
| 4447 | Lisp_Object window = POSN_WINDOW (EVENT_START (key)); | 4459 | Lisp_Object window, posn; |
| 4448 | Lisp_Object posn = POSN_BUFFER_POSN (EVENT_START (key)); | ||
| 4449 | 4460 | ||
| 4461 | window = POSN_WINDOW (EVENT_START (key)); | ||
| 4462 | posn = POSN_BUFFER_POSN (EVENT_START (key)); | ||
| 4450 | if (XTYPE (posn) == Lisp_Cons) | 4463 | if (XTYPE (posn) == Lisp_Cons) |
| 4451 | { | 4464 | { |
| 4452 | /* We're looking at the second event of a | 4465 | /* We're looking at the second event of a |
| @@ -4514,8 +4527,9 @@ read_key_sequence (keybuf, bufsize, prompt) | |||
| 4514 | } | 4527 | } |
| 4515 | else | 4528 | else |
| 4516 | { | 4529 | { |
| 4517 | Lisp_Object posn = POSN_BUFFER_POSN (EVENT_START (key)); | 4530 | Lisp_Object posn; |
| 4518 | 4531 | ||
| 4532 | posn = POSN_BUFFER_POSN (EVENT_START (key)); | ||
| 4519 | /* Handle menu-bar events: | 4533 | /* Handle menu-bar events: |
| 4520 | insert the dummy prefix event `menu-bar'. */ | 4534 | insert the dummy prefix event `menu-bar'. */ |
| 4521 | if (EQ (posn, Qmenu_bar)) | 4535 | if (EQ (posn, Qmenu_bar)) |
| @@ -4564,8 +4578,9 @@ read_key_sequence (keybuf, bufsize, prompt) | |||
| 4564 | /* If KEY wasn't bound, we'll try some fallbacks. */ | 4578 | /* If KEY wasn't bound, we'll try some fallbacks. */ |
| 4565 | if (first_binding >= nmaps) | 4579 | if (first_binding >= nmaps) |
| 4566 | { | 4580 | { |
| 4567 | Lisp_Object head = EVENT_HEAD (key); | 4581 | Lisp_Object head; |
| 4568 | 4582 | ||
| 4583 | head = EVENT_HEAD (key); | ||
| 4569 | if (EQ (head, Vhelp_char)) | 4584 | if (EQ (head, Vhelp_char)) |
| 4570 | { | 4585 | { |
| 4571 | read_key_sequence_cmd = Vprefix_help_command; | 4586 | read_key_sequence_cmd = Vprefix_help_command; |
| @@ -4576,9 +4591,11 @@ read_key_sequence (keybuf, bufsize, prompt) | |||
| 4576 | 4591 | ||
| 4577 | if (XTYPE (head) == Lisp_Symbol) | 4592 | if (XTYPE (head) == Lisp_Symbol) |
| 4578 | { | 4593 | { |
| 4579 | Lisp_Object breakdown = parse_modifiers (head); | 4594 | Lisp_Object breakdown; |
| 4580 | int modifiers = XINT (XCONS (XCONS (breakdown)->cdr)->car); | 4595 | int modifiers; |
| 4581 | 4596 | ||
| 4597 | breakdown = parse_modifiers (head); | ||
| 4598 | modifiers = XINT (XCONS (XCONS (breakdown)->cdr)->car); | ||
| 4582 | /* Attempt to reduce an unbound mouse event to a simpler | 4599 | /* Attempt to reduce an unbound mouse event to a simpler |
| 4583 | event that is bound: | 4600 | event that is bound: |
| 4584 | Drags reduce to clicks. | 4601 | Drags reduce to clicks. |