diff options
| author | Joakim Verona | 2013-02-21 00:04:28 +0100 |
|---|---|---|
| committer | Joakim Verona | 2013-02-21 00:04:28 +0100 |
| commit | f0f34630a4c8b467df3ec7eb445ceedd93a12a71 (patch) | |
| tree | 8a3b203c6f091c698fcfb3ccd055f330e07e539d /src/keyboard.c | |
| parent | 10fc3c3866ede374437a72f2e8c1cd7c0f51a8fa (diff) | |
| parent | e11dacb57703fb8044332d8a3933b815547911ec (diff) | |
| download | emacs-f0f34630a4c8b467df3ec7eb445ceedd93a12a71.tar.gz emacs-f0f34630a4c8b467df3ec7eb445ceedd93a12a71.zip | |
auto upstream
Diffstat (limited to 'src/keyboard.c')
| -rw-r--r-- | src/keyboard.c | 101 |
1 files changed, 5 insertions, 96 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 3c00e017498..38136b57b4b 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -370,7 +370,7 @@ Lisp_Object Qmenu_bar; | |||
| 370 | 370 | ||
| 371 | static Lisp_Object recursive_edit_unwind (Lisp_Object buffer); | 371 | static Lisp_Object recursive_edit_unwind (Lisp_Object buffer); |
| 372 | static Lisp_Object command_loop (void); | 372 | static Lisp_Object command_loop (void); |
| 373 | static Lisp_Object Qextended_command_history; | 373 | static Lisp_Object Qcommand_execute; |
| 374 | EMACS_TIME timer_check (void); | 374 | EMACS_TIME timer_check (void); |
| 375 | 375 | ||
| 376 | static void echo_now (void); | 376 | static void echo_now (void); |
| @@ -1586,11 +1586,11 @@ command_loop_1 (void) | |||
| 1586 | = (EQ (undo, BVAR (current_buffer, undo_list)) | 1586 | = (EQ (undo, BVAR (current_buffer, undo_list)) |
| 1587 | ? Qnil : BVAR (current_buffer, undo_list)); | 1587 | ? Qnil : BVAR (current_buffer, undo_list)); |
| 1588 | } | 1588 | } |
| 1589 | Fcommand_execute (Vthis_command, Qnil, Qnil, Qnil); | 1589 | call1 (Qcommand_execute, Vthis_command); |
| 1590 | 1590 | ||
| 1591 | #ifdef HAVE_WINDOW_SYSTEM | 1591 | #ifdef HAVE_WINDOW_SYSTEM |
| 1592 | /* Do not check display_hourglass_p here, because | 1592 | /* Do not check display_hourglass_p here, because |
| 1593 | Fcommand_execute could change it, but we should cancel | 1593 | `command-execute' could change it, but we should cancel |
| 1594 | hourglass cursor anyway. | 1594 | hourglass cursor anyway. |
| 1595 | But don't cancel the hourglass within a macro | 1595 | But don't cancel the hourglass within a macro |
| 1596 | just because a command in the macro finishes. */ | 1596 | just because a command in the macro finishes. */ |
| @@ -2845,7 +2845,7 @@ read_char (int commandflag, Lisp_Object map, | |||
| 2845 | { | 2845 | { |
| 2846 | struct buffer *prev_buffer = current_buffer; | 2846 | struct buffer *prev_buffer = current_buffer; |
| 2847 | last_input_event = c; | 2847 | last_input_event = c; |
| 2848 | Fcommand_execute (tem, Qnil, Fvector (1, &last_input_event), Qt); | 2848 | call4 (Qcommand_execute, tem, Qnil, Fvector (1, &last_input_event), Qt); |
| 2849 | 2849 | ||
| 2850 | if (CONSP (c) && EQ (XCAR (c), Qselect_window) && !end_time) | 2850 | if (CONSP (c) && EQ (XCAR (c), Qselect_window) && !end_time) |
| 2851 | /* We stopped being idle for this event; undo that. This | 2851 | /* We stopped being idle for this event; undo that. This |
| @@ -9895,95 +9895,6 @@ DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector, | |||
| 9895 | return unbind_to (count, Fvector (i, keybuf)); | 9895 | return unbind_to (count, Fvector (i, keybuf)); |
| 9896 | } | 9896 | } |
| 9897 | 9897 | ||
| 9898 | DEFUN ("command-execute", Fcommand_execute, Scommand_execute, 1, 4, 0, | ||
| 9899 | doc: /* Execute CMD as an editor command. | ||
| 9900 | CMD must be a symbol that satisfies the `commandp' predicate. | ||
| 9901 | Optional second arg RECORD-FLAG non-nil | ||
| 9902 | means unconditionally put this command in the variable `command-history'. | ||
| 9903 | Otherwise, that is done only if an arg is read using the minibuffer. | ||
| 9904 | The argument KEYS specifies the value to use instead of (this-command-keys) | ||
| 9905 | when reading the arguments; if it is nil, (this-command-keys) is used. | ||
| 9906 | The argument SPECIAL, if non-nil, means that this command is executing | ||
| 9907 | a special event, so ignore the prefix argument and don't clear it. */) | ||
| 9908 | (Lisp_Object cmd, Lisp_Object record_flag, Lisp_Object keys, Lisp_Object special) | ||
| 9909 | { | ||
| 9910 | register Lisp_Object final; | ||
| 9911 | register Lisp_Object tem; | ||
| 9912 | Lisp_Object prefixarg; | ||
| 9913 | |||
| 9914 | debug_on_next_call = 0; | ||
| 9915 | |||
| 9916 | if (NILP (special)) | ||
| 9917 | { | ||
| 9918 | prefixarg = KVAR (current_kboard, Vprefix_arg); | ||
| 9919 | Vcurrent_prefix_arg = prefixarg; | ||
| 9920 | kset_prefix_arg (current_kboard, Qnil); | ||
| 9921 | } | ||
| 9922 | else | ||
| 9923 | prefixarg = Qnil; | ||
| 9924 | |||
| 9925 | if (SYMBOLP (cmd)) | ||
| 9926 | { | ||
| 9927 | tem = Fget (cmd, Qdisabled); | ||
| 9928 | if (!NILP (tem)) | ||
| 9929 | { | ||
| 9930 | tem = Fsymbol_value (Qdisabled_command_function); | ||
| 9931 | if (!NILP (tem)) | ||
| 9932 | return Frun_hooks (1, &Qdisabled_command_function); | ||
| 9933 | } | ||
| 9934 | } | ||
| 9935 | |||
| 9936 | while (1) | ||
| 9937 | { | ||
| 9938 | final = Findirect_function (cmd, Qnil); | ||
| 9939 | |||
| 9940 | if (CONSP (final) && (tem = Fcar (final), EQ (tem, Qautoload))) | ||
| 9941 | { | ||
| 9942 | struct gcpro gcpro1, gcpro2; | ||
| 9943 | |||
| 9944 | GCPRO2 (cmd, prefixarg); | ||
| 9945 | Fautoload_do_load (final, cmd, Qnil); | ||
| 9946 | UNGCPRO; | ||
| 9947 | } | ||
| 9948 | else | ||
| 9949 | break; | ||
| 9950 | } | ||
| 9951 | |||
| 9952 | if (STRINGP (final) || VECTORP (final)) | ||
| 9953 | { | ||
| 9954 | /* If requested, place the macro in the command history. For | ||
| 9955 | other sorts of commands, call-interactively takes care of | ||
| 9956 | this. */ | ||
| 9957 | if (!NILP (record_flag)) | ||
| 9958 | { | ||
| 9959 | Vcommand_history | ||
| 9960 | = Fcons (Fcons (Qexecute_kbd_macro, | ||
| 9961 | Fcons (final, Fcons (prefixarg, Qnil))), | ||
| 9962 | Vcommand_history); | ||
| 9963 | |||
| 9964 | /* Don't keep command history around forever. */ | ||
| 9965 | if (NUMBERP (Vhistory_length) && XINT (Vhistory_length) > 0) | ||
| 9966 | { | ||
| 9967 | tem = Fnthcdr (Vhistory_length, Vcommand_history); | ||
| 9968 | if (CONSP (tem)) | ||
| 9969 | XSETCDR (tem, Qnil); | ||
| 9970 | } | ||
| 9971 | } | ||
| 9972 | |||
| 9973 | return Fexecute_kbd_macro (final, prefixarg, Qnil); | ||
| 9974 | } | ||
| 9975 | |||
| 9976 | if (CONSP (final) || SUBRP (final) || COMPILEDP (final)) | ||
| 9977 | /* Don't call Fcall_interactively directly because we want to make | ||
| 9978 | sure the backtrace has an entry for `call-interactively'. | ||
| 9979 | For the same reason, pass `cmd' rather than `final'. */ | ||
| 9980 | return call3 (Qcall_interactively, cmd, record_flag, keys); | ||
| 9981 | |||
| 9982 | return Qnil; | ||
| 9983 | } | ||
| 9984 | |||
| 9985 | |||
| 9986 | |||
| 9987 | /* Return true if input events are pending. */ | 9898 | /* Return true if input events are pending. */ |
| 9988 | 9899 | ||
| 9989 | bool | 9900 | bool |
| @@ -11218,8 +11129,7 @@ syms_of_keyboard (void) | |||
| 11218 | raw_keybuf = Fmake_vector (make_number (30), Qnil); | 11129 | raw_keybuf = Fmake_vector (make_number (30), Qnil); |
| 11219 | staticpro (&raw_keybuf); | 11130 | staticpro (&raw_keybuf); |
| 11220 | 11131 | ||
| 11221 | DEFSYM (Qextended_command_history, "extended-command-history"); | 11132 | DEFSYM (Qcommand_execute, "command-execute"); |
| 11222 | Fset (Qextended_command_history, Qnil); | ||
| 11223 | 11133 | ||
| 11224 | accent_key_syms = Qnil; | 11134 | accent_key_syms = Qnil; |
| 11225 | staticpro (&accent_key_syms); | 11135 | staticpro (&accent_key_syms); |
| @@ -11258,7 +11168,6 @@ syms_of_keyboard (void) | |||
| 11258 | defsubr (&Srecursive_edit); | 11168 | defsubr (&Srecursive_edit); |
| 11259 | defsubr (&Strack_mouse); | 11169 | defsubr (&Strack_mouse); |
| 11260 | defsubr (&Sinput_pending_p); | 11170 | defsubr (&Sinput_pending_p); |
| 11261 | defsubr (&Scommand_execute); | ||
| 11262 | defsubr (&Srecent_keys); | 11171 | defsubr (&Srecent_keys); |
| 11263 | defsubr (&Sthis_command_keys); | 11172 | defsubr (&Sthis_command_keys); |
| 11264 | defsubr (&Sthis_command_keys_vector); | 11173 | defsubr (&Sthis_command_keys_vector); |