aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2013-02-20 11:37:06 -0500
committerStefan Monnier2013-02-20 11:37:06 -0500
commitb6c2bfff02239197fc855c0575def855afab01c7 (patch)
treed5e7870aeaa28b3bbeb3bdb77b0bcac886b939cc /src
parent5079cfefc0fe7152bae4ea175f5679bca42e0cbd (diff)
downloademacs-b6c2bfff02239197fc855c0575def855afab01c7.tar.gz
emacs-b6c2bfff02239197fc855c0575def855afab01c7.zip
* lisp/simple.el (command-execute): Move from C. Add obsolete check.
(extended-command-history): Move from C. * src/keyboard.c (Qcommand_execute): New var. (command_loop_1, read_char): Use it. (Fcommand_execute): Remove, replace by an Elisp implementation. (syms_of_keyboard): Adjust accordingly.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog13
-rw-r--r--src/keyboard.c101
2 files changed, 16 insertions, 98 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index b04b344edf2..9423484c656 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,12 +1,21 @@
12013-02-20 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * keyboard.c (Qcommand_execute): New var.
4 (command_loop_1, read_char): Use it.
5 (Fcommand_execute): Remove, replace by an Elisp implementation.
6 (syms_of_keyboard): Adjust accordingly.
7
12013-02-19 Daniel Colascione <dancol@dancol.org> 82013-02-19 Daniel Colascione <dancol@dancol.org>
9
2 * sheap.c (report_sheap_usage): Use message, not message1, so 10 * sheap.c (report_sheap_usage): Use message, not message1, so
3 that we don't try to create a buffer while we're in the middle 11 that we don't try to create a buffer while we're in the middle
4 of dumping Emacs. Explain why. 12 of dumping Emacs. Explain why.
13
52013-02-20 Dmitry Antipov <dmantipov@yandex.ru> 142013-02-20 Dmitry Antipov <dmantipov@yandex.ru>
6 * search.c (find_newline): Return byte position in bytepos. 15 * search.c (find_newline): Return byte position in bytepos.
7 Adjust comment. 16 Adjust comment.
8 (find_next_newline_no_quit, find_before_next_newline): Add 17 (find_next_newline_no_quit, find_before_next_newline):
9 bytepos argument. 18 Add bytepos argument.
10 * lisp.h (find_newline, find_next_newline_no_quit) 19 * lisp.h (find_newline, find_next_newline_no_quit)
11 (find_before_next_newline): Adjust prototypes. 20 (find_before_next_newline): Adjust prototypes.
12 * bidi.c (bidi_find_paragraph_start): 21 * bidi.c (bidi_find_paragraph_start):
diff --git a/src/keyboard.c b/src/keyboard.c
index 77037f647e9..9cb9dd0b47b 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -367,7 +367,7 @@ Lisp_Object Qmenu_bar;
367 367
368static Lisp_Object recursive_edit_unwind (Lisp_Object buffer); 368static Lisp_Object recursive_edit_unwind (Lisp_Object buffer);
369static Lisp_Object command_loop (void); 369static Lisp_Object command_loop (void);
370static Lisp_Object Qextended_command_history; 370static Lisp_Object Qcommand_execute;
371EMACS_TIME timer_check (void); 371EMACS_TIME timer_check (void);
372 372
373static void echo_now (void); 373static void echo_now (void);
@@ -1583,11 +1583,11 @@ command_loop_1 (void)
1583 = (EQ (undo, BVAR (current_buffer, undo_list)) 1583 = (EQ (undo, BVAR (current_buffer, undo_list))
1584 ? Qnil : BVAR (current_buffer, undo_list)); 1584 ? Qnil : BVAR (current_buffer, undo_list));
1585 } 1585 }
1586 Fcommand_execute (Vthis_command, Qnil, Qnil, Qnil); 1586 call1 (Qcommand_execute, Vthis_command);
1587 1587
1588#ifdef HAVE_WINDOW_SYSTEM 1588#ifdef HAVE_WINDOW_SYSTEM
1589 /* Do not check display_hourglass_p here, because 1589 /* Do not check display_hourglass_p here, because
1590 Fcommand_execute could change it, but we should cancel 1590 `command-execute' could change it, but we should cancel
1591 hourglass cursor anyway. 1591 hourglass cursor anyway.
1592 But don't cancel the hourglass within a macro 1592 But don't cancel the hourglass within a macro
1593 just because a command in the macro finishes. */ 1593 just because a command in the macro finishes. */
@@ -2842,7 +2842,7 @@ read_char (int commandflag, Lisp_Object map,
2842 { 2842 {
2843 struct buffer *prev_buffer = current_buffer; 2843 struct buffer *prev_buffer = current_buffer;
2844 last_input_event = c; 2844 last_input_event = c;
2845 Fcommand_execute (tem, Qnil, Fvector (1, &last_input_event), Qt); 2845 call4 (Qcommand_execute, tem, Qnil, Fvector (1, &last_input_event), Qt);
2846 2846
2847 if (CONSP (c) && EQ (XCAR (c), Qselect_window) && !end_time) 2847 if (CONSP (c) && EQ (XCAR (c), Qselect_window) && !end_time)
2848 /* We stopped being idle for this event; undo that. This 2848 /* We stopped being idle for this event; undo that. This
@@ -9876,95 +9876,6 @@ DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector,
9876 return unbind_to (count, Fvector (i, keybuf)); 9876 return unbind_to (count, Fvector (i, keybuf));
9877} 9877}
9878 9878
9879DEFUN ("command-execute", Fcommand_execute, Scommand_execute, 1, 4, 0,
9880 doc: /* Execute CMD as an editor command.
9881CMD must be a symbol that satisfies the `commandp' predicate.
9882Optional second arg RECORD-FLAG non-nil
9883means unconditionally put this command in the variable `command-history'.
9884Otherwise, that is done only if an arg is read using the minibuffer.
9885The argument KEYS specifies the value to use instead of (this-command-keys)
9886when reading the arguments; if it is nil, (this-command-keys) is used.
9887The argument SPECIAL, if non-nil, means that this command is executing
9888a special event, so ignore the prefix argument and don't clear it. */)
9889 (Lisp_Object cmd, Lisp_Object record_flag, Lisp_Object keys, Lisp_Object special)
9890{
9891 register Lisp_Object final;
9892 register Lisp_Object tem;
9893 Lisp_Object prefixarg;
9894
9895 debug_on_next_call = 0;
9896
9897 if (NILP (special))
9898 {
9899 prefixarg = KVAR (current_kboard, Vprefix_arg);
9900 Vcurrent_prefix_arg = prefixarg;
9901 kset_prefix_arg (current_kboard, Qnil);
9902 }
9903 else
9904 prefixarg = Qnil;
9905
9906 if (SYMBOLP (cmd))
9907 {
9908 tem = Fget (cmd, Qdisabled);
9909 if (!NILP (tem))
9910 {
9911 tem = Fsymbol_value (Qdisabled_command_function);
9912 if (!NILP (tem))
9913 return Frun_hooks (1, &Qdisabled_command_function);
9914 }
9915 }
9916
9917 while (1)
9918 {
9919 final = Findirect_function (cmd, Qnil);
9920
9921 if (CONSP (final) && (tem = Fcar (final), EQ (tem, Qautoload)))
9922 {
9923 struct gcpro gcpro1, gcpro2;
9924
9925 GCPRO2 (cmd, prefixarg);
9926 Fautoload_do_load (final, cmd, Qnil);
9927 UNGCPRO;
9928 }
9929 else
9930 break;
9931 }
9932
9933 if (STRINGP (final) || VECTORP (final))
9934 {
9935 /* If requested, place the macro in the command history. For
9936 other sorts of commands, call-interactively takes care of
9937 this. */
9938 if (!NILP (record_flag))
9939 {
9940 Vcommand_history
9941 = Fcons (Fcons (Qexecute_kbd_macro,
9942 Fcons (final, Fcons (prefixarg, Qnil))),
9943 Vcommand_history);
9944
9945 /* Don't keep command history around forever. */
9946 if (NUMBERP (Vhistory_length) && XINT (Vhistory_length) > 0)
9947 {
9948 tem = Fnthcdr (Vhistory_length, Vcommand_history);
9949 if (CONSP (tem))
9950 XSETCDR (tem, Qnil);
9951 }
9952 }
9953
9954 return Fexecute_kbd_macro (final, prefixarg, Qnil);
9955 }
9956
9957 if (CONSP (final) || SUBRP (final) || COMPILEDP (final))
9958 /* Don't call Fcall_interactively directly because we want to make
9959 sure the backtrace has an entry for `call-interactively'.
9960 For the same reason, pass `cmd' rather than `final'. */
9961 return call3 (Qcall_interactively, cmd, record_flag, keys);
9962
9963 return Qnil;
9964}
9965
9966
9967
9968/* Return true if input events are pending. */ 9879/* Return true if input events are pending. */
9969 9880
9970bool 9881bool
@@ -11195,8 +11106,7 @@ syms_of_keyboard (void)
11195 raw_keybuf = Fmake_vector (make_number (30), Qnil); 11106 raw_keybuf = Fmake_vector (make_number (30), Qnil);
11196 staticpro (&raw_keybuf); 11107 staticpro (&raw_keybuf);
11197 11108
11198 DEFSYM (Qextended_command_history, "extended-command-history"); 11109 DEFSYM (Qcommand_execute, "command-execute");
11199 Fset (Qextended_command_history, Qnil);
11200 11110
11201 accent_key_syms = Qnil; 11111 accent_key_syms = Qnil;
11202 staticpro (&accent_key_syms); 11112 staticpro (&accent_key_syms);
@@ -11235,7 +11145,6 @@ syms_of_keyboard (void)
11235 defsubr (&Srecursive_edit); 11145 defsubr (&Srecursive_edit);
11236 defsubr (&Strack_mouse); 11146 defsubr (&Strack_mouse);
11237 defsubr (&Sinput_pending_p); 11147 defsubr (&Sinput_pending_p);
11238 defsubr (&Scommand_execute);
11239 defsubr (&Srecent_keys); 11148 defsubr (&Srecent_keys);
11240 defsubr (&Sthis_command_keys); 11149 defsubr (&Sthis_command_keys);
11241 defsubr (&Sthis_command_keys_vector); 11150 defsubr (&Sthis_command_keys_vector);