diff options
| author | Stefan Monnier | 2007-12-10 03:48:05 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-12-10 03:48:05 +0000 |
| commit | 6d0867e5f54987f3133afce53d35a65adbae99b7 (patch) | |
| tree | 88c8e4c93d16595d276194048899ce7e4b011991 /src | |
| parent | 3709505e05ef3670b630fa3bbb2c154113cbb322 (diff) | |
| download | emacs-6d0867e5f54987f3133afce53d35a65adbae99b7.tar.gz emacs-6d0867e5f54987f3133afce53d35a65adbae99b7.zip | |
(Fcommand_execute): Call Qcall_interactively instead of
manipulating the backtrace manually.
(make_lispy_event): Merge the ASCII and MULTIBYTE cases.
(struct backtrace, backtrace_list): Remove.
(command_loop_1): Remove dead var `no_direct'.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 89 |
1 files changed, 25 insertions, 64 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 7febb3f064f..bcd3b536c57 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -108,21 +108,6 @@ int interrupt_input_pending; | |||
| 108 | #define KBD_BUFFER_SIZE 4096 | 108 | #define KBD_BUFFER_SIZE 4096 |
| 109 | #endif /* No X-windows */ | 109 | #endif /* No X-windows */ |
| 110 | 110 | ||
| 111 | /* Following definition copied from eval.c */ | ||
| 112 | |||
| 113 | struct backtrace | ||
| 114 | { | ||
| 115 | struct backtrace *next; | ||
| 116 | Lisp_Object *function; | ||
| 117 | Lisp_Object *args; /* Points to vector of args. */ | ||
| 118 | int nargs; /* length of vector. If nargs is UNEVALLED, | ||
| 119 | args points to slot holding list of | ||
| 120 | unevalled args */ | ||
| 121 | char evalargs; | ||
| 122 | /* Nonzero means call value of debugger when done with this operation. */ | ||
| 123 | char debug_on_exit; | ||
| 124 | }; | ||
| 125 | |||
| 126 | #ifdef MULTI_KBOARD | 111 | #ifdef MULTI_KBOARD |
| 127 | KBOARD *initial_kboard; | 112 | KBOARD *initial_kboard; |
| 128 | KBOARD *current_kboard; | 113 | KBOARD *current_kboard; |
| @@ -175,8 +160,6 @@ extern int minbuf_level; | |||
| 175 | 160 | ||
| 176 | extern int message_enable_multibyte; | 161 | extern int message_enable_multibyte; |
| 177 | 162 | ||
| 178 | extern struct backtrace *backtrace_list; | ||
| 179 | |||
| 180 | /* If non-nil, the function that implements the display of help. | 163 | /* If non-nil, the function that implements the display of help. |
| 181 | It's called with one argument, the help string to display. */ | 164 | It's called with one argument, the help string to display. */ |
| 182 | 165 | ||
| @@ -1565,7 +1548,6 @@ command_loop_1 () | |||
| 1565 | int nonundocount; | 1548 | int nonundocount; |
| 1566 | Lisp_Object keybuf[30]; | 1549 | Lisp_Object keybuf[30]; |
| 1567 | int i; | 1550 | int i; |
| 1568 | int no_direct; | ||
| 1569 | int prev_modiff = 0; | 1551 | int prev_modiff = 0; |
| 1570 | struct buffer *prev_buffer = NULL; | 1552 | struct buffer *prev_buffer = NULL; |
| 1571 | #if 0 /* This shouldn't be necessary anymore. --lorentey */ | 1553 | #if 0 /* This shouldn't be necessary anymore. --lorentey */ |
| @@ -1625,8 +1607,6 @@ command_loop_1 () | |||
| 1625 | while (pending_malloc_warning) | 1607 | while (pending_malloc_warning) |
| 1626 | display_malloc_warning (); | 1608 | display_malloc_warning (); |
| 1627 | 1609 | ||
| 1628 | no_direct = 0; | ||
| 1629 | |||
| 1630 | Vdeactivate_mark = Qnil; | 1610 | Vdeactivate_mark = Qnil; |
| 1631 | 1611 | ||
| 1632 | /* If minibuffer on and echo area in use, | 1612 | /* If minibuffer on and echo area in use, |
| @@ -1787,7 +1767,7 @@ command_loop_1 () | |||
| 1787 | } | 1767 | } |
| 1788 | else | 1768 | else |
| 1789 | { | 1769 | { |
| 1790 | if (NILP (current_kboard->Vprefix_arg) && ! no_direct) | 1770 | if (NILP (current_kboard->Vprefix_arg)) |
| 1791 | { | 1771 | { |
| 1792 | /* In case we jump to directly_done. */ | 1772 | /* In case we jump to directly_done. */ |
| 1793 | Vcurrent_prefix_arg = current_kboard->Vprefix_arg; | 1773 | Vcurrent_prefix_arg = current_kboard->Vprefix_arg; |
| @@ -5558,41 +5538,32 @@ make_lispy_event (event) | |||
| 5558 | { | 5538 | { |
| 5559 | /* A simple keystroke. */ | 5539 | /* A simple keystroke. */ |
| 5560 | case ASCII_KEYSTROKE_EVENT: | 5540 | case ASCII_KEYSTROKE_EVENT: |
| 5561 | { | ||
| 5562 | Lisp_Object lispy_c; | ||
| 5563 | int c = event->code & 0377; | ||
| 5564 | /* Turn ASCII characters into control characters | ||
| 5565 | when proper. */ | ||
| 5566 | if (event->modifiers & ctrl_modifier) | ||
| 5567 | c = make_ctrl_char (c); | ||
| 5568 | |||
| 5569 | /* Add in the other modifier bits. We took care of ctrl_modifier | ||
| 5570 | just above, and the shift key was taken care of by the X code, | ||
| 5571 | and applied to control characters by make_ctrl_char. */ | ||
| 5572 | c |= (event->modifiers | ||
| 5573 | & (meta_modifier | alt_modifier | ||
| 5574 | | hyper_modifier | super_modifier)); | ||
| 5575 | /* Distinguish Shift-SPC from SPC. */ | ||
| 5576 | if ((event->code & 0377) == 040 | ||
| 5577 | && event->modifiers & shift_modifier) | ||
| 5578 | c |= shift_modifier; | ||
| 5579 | button_down_time = 0; | ||
| 5580 | XSETFASTINT (lispy_c, c); | ||
| 5581 | return lispy_c; | ||
| 5582 | } | ||
| 5583 | |||
| 5584 | case MULTIBYTE_CHAR_KEYSTROKE_EVENT: | 5541 | case MULTIBYTE_CHAR_KEYSTROKE_EVENT: |
| 5585 | { | 5542 | { |
| 5586 | Lisp_Object lispy_c; | 5543 | Lisp_Object lispy_c; |
| 5587 | int c = event->code; | 5544 | int c = event->code; |
| 5545 | if (event->kind == ASCII_KEYSTROKE_EVENT) | ||
| 5546 | { | ||
| 5547 | c &= 0377; | ||
| 5548 | eassert (c == event->code); | ||
| 5549 | /* Turn ASCII characters into control characters | ||
| 5550 | when proper. */ | ||
| 5551 | if (event->modifiers & ctrl_modifier) | ||
| 5552 | { | ||
| 5553 | c = make_ctrl_char (c); | ||
| 5554 | event->modifiers &= ~ctrl_modifier; | ||
| 5555 | } | ||
| 5556 | } | ||
| 5588 | 5557 | ||
| 5589 | /* Add in the other modifier bits. We took care of ctrl_modifier | 5558 | /* Add in the other modifier bits. The shift key was taken care |
| 5590 | just above, and the shift key was taken care of by the X code, | 5559 | of by the X code. */ |
| 5591 | and applied to control characters by make_ctrl_char. */ | ||
| 5592 | c |= (event->modifiers | 5560 | c |= (event->modifiers |
| 5593 | & (meta_modifier | alt_modifier | 5561 | & (meta_modifier | alt_modifier |
| 5594 | | hyper_modifier | super_modifier | ctrl_modifier)); | 5562 | | hyper_modifier | super_modifier | ctrl_modifier)); |
| 5595 | /* What about the `shift' modifier ? */ | 5563 | /* Distinguish Shift-SPC from SPC. */ |
| 5564 | if ((event->code) == 040 | ||
| 5565 | && event->modifiers & shift_modifier) | ||
| 5566 | c |= shift_modifier; | ||
| 5596 | button_down_time = 0; | 5567 | button_down_time = 0; |
| 5597 | XSETFASTINT (lispy_c, c); | 5568 | XSETFASTINT (lispy_c, c); |
| 5598 | return lispy_c; | 5569 | return lispy_c; |
| @@ -9619,7 +9590,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, | |||
| 9619 | } | 9590 | } |
| 9620 | 9591 | ||
| 9621 | GROW_RAW_KEYBUF; | 9592 | GROW_RAW_KEYBUF; |
| 9622 | XVECTOR (raw_keybuf)->contents[raw_keybuf_count++] = key; | 9593 | ASET (raw_keybuf, raw_keybuf_count++, key); |
| 9623 | } | 9594 | } |
| 9624 | 9595 | ||
| 9625 | /* Clicks in non-text areas get prefixed by the symbol | 9596 | /* Clicks in non-text areas get prefixed by the symbol |
| @@ -10371,7 +10342,6 @@ a special event, so ignore the prefix argument and don't clear it. */) | |||
| 10371 | register Lisp_Object final; | 10342 | register Lisp_Object final; |
| 10372 | register Lisp_Object tem; | 10343 | register Lisp_Object tem; |
| 10373 | Lisp_Object prefixarg; | 10344 | Lisp_Object prefixarg; |
| 10374 | struct backtrace backtrace; | ||
| 10375 | extern int debug_on_next_call; | 10345 | extern int debug_on_next_call; |
| 10376 | 10346 | ||
| 10377 | debug_on_next_call = 0; | 10347 | debug_on_next_call = 0; |
| @@ -10437,20 +10407,11 @@ a special event, so ignore the prefix argument and don't clear it. */) | |||
| 10437 | } | 10407 | } |
| 10438 | 10408 | ||
| 10439 | if (CONSP (final) || SUBRP (final) || COMPILEDP (final)) | 10409 | if (CONSP (final) || SUBRP (final) || COMPILEDP (final)) |
| 10440 | { | 10410 | /* Don't call Fcall_interactively directly because we want to make |
| 10441 | backtrace.next = backtrace_list; | 10411 | sure the backtrace has an entry for `call-interactively'. |
| 10442 | backtrace_list = &backtrace; | 10412 | For the same reason, pass `cmd' rather than `final'. */ |
| 10443 | backtrace.function = &Qcall_interactively; | 10413 | return call3 (Qcall_interactively, cmd, record_flag, keys); |
| 10444 | backtrace.args = &cmd; | ||
| 10445 | backtrace.nargs = 1; | ||
| 10446 | backtrace.evalargs = 0; | ||
| 10447 | backtrace.debug_on_exit = 0; | ||
| 10448 | |||
| 10449 | tem = Fcall_interactively (cmd, record_flag, keys); | ||
| 10450 | 10414 | ||
| 10451 | backtrace_list = backtrace.next; | ||
| 10452 | return tem; | ||
| 10453 | } | ||
| 10454 | return Qnil; | 10415 | return Qnil; |
| 10455 | } | 10416 | } |
| 10456 | 10417 | ||
| @@ -10561,7 +10522,7 @@ give to the command you invoke, if it asks for an argument. */) | |||
| 10561 | bindings = Qnil; | 10522 | bindings = Qnil; |
| 10562 | 10523 | ||
| 10563 | value = Qnil; | 10524 | value = Qnil; |
| 10564 | GCPRO2 (bindings, value); | 10525 | GCPRO3 (bindings, value, function); |
| 10565 | value = Fcommand_execute (function, Qt, Qnil, Qnil); | 10526 | value = Fcommand_execute (function, Qt, Qnil, Qnil); |
| 10566 | 10527 | ||
| 10567 | /* If the command has a key binding, print it now. */ | 10528 | /* If the command has a key binding, print it now. */ |