comparison src/keyboard.c @ 43154:241310b1046a

(Vthis_original_command): New variable. (syms_of_keyboard): DEFVAR_LISP it. (command_loop_1): Set it, and perform command remapping.
author Kim F. Storm <storm@cua.dk>
date Wed, 06 Feb 2002 22:59:56 +0000
parents a50d91dfe5f8
children a8329a91e9b5
comparison
equal deleted inserted replaced
43153:d6162a8dc872 43154:241310b1046a
371 Lisp_Object Vthis_command; 371 Lisp_Object Vthis_command;
372 372
373 /* This is like Vthis_command, except that commands never set it. */ 373 /* This is like Vthis_command, except that commands never set it. */
374 Lisp_Object real_this_command; 374 Lisp_Object real_this_command;
375 375
376 /* If the lookup of the command returns a binding, the original
377 command is stored in this-original-command. It is nil otherwise. */
378 Lisp_Object Vthis_original_command;
379
376 /* The value of point when the last command was executed. */ 380 /* The value of point when the last command was executed. */
377 int last_point_position; 381 int last_point_position;
378 382
379 /* The buffer that was current when the last command was started. */ 383 /* The buffer that was current when the last command was started. */
380 Lisp_Object last_point_position_buffer; 384 Lisp_Object last_point_position_buffer;
1500 Vdisable_point_adjustment = Qnil; 1504 Vdisable_point_adjustment = Qnil;
1501 1505
1502 /* Process filters and timers may have messed with deactivate-mark. 1506 /* Process filters and timers may have messed with deactivate-mark.
1503 reset it before we execute the command. */ 1507 reset it before we execute the command. */
1504 Vdeactivate_mark = Qnil; 1508 Vdeactivate_mark = Qnil;
1509
1510 /* Remap command through active keymaps */
1511 Vthis_original_command = cmd;
1512 if (is_command_symbol (cmd))
1513 {
1514 Lisp_Object cmd1;
1515
1516 cmd1 = Fkey_binding (cmd, Qnil, Qt);
1517 if (!NILP (cmd1) && is_command_symbol (cmd1))
1518 cmd = cmd1;
1519 }
1505 1520
1506 /* Execute the command. */ 1521 /* Execute the command. */
1507 1522
1508 Vthis_command = cmd; 1523 Vthis_command = cmd;
1509 real_this_command = cmd; 1524 real_this_command = cmd;
6945 { 6960 {
6946 int chkcache = 0; 6961 int chkcache = 0;
6947 Lisp_Object prefix; 6962 Lisp_Object prefix;
6948 6963
6949 if (!NILP (tem)) 6964 if (!NILP (tem))
6950 tem = Fkey_binding (tem, Qnil); 6965 tem = Fkey_binding (tem, Qnil, Qnil);
6951 6966
6952 prefix = AREF (item_properties, ITEM_PROPERTY_KEYEQ); 6967 prefix = AREF (item_properties, ITEM_PROPERTY_KEYEQ);
6953 if (CONSP (prefix)) 6968 if (CONSP (prefix))
6954 { 6969 {
6955 def = XCAR (prefix); 6970 def = XCAR (prefix);
6991 makes lmenu menus slow. */ 7006 makes lmenu menus slow. */
6992 if (SYMBOLP (def) 7007 if (SYMBOLP (def)
6993 && SYMBOLP (XSYMBOL (def)->function) 7008 && SYMBOLP (XSYMBOL (def)->function)
6994 && ! NILP (Fget (def, Qmenu_alias))) 7009 && ! NILP (Fget (def, Qmenu_alias)))
6995 def = XSYMBOL (def)->function; 7010 def = XSYMBOL (def)->function;
6996 tem = Fwhere_is_internal (def, Qnil, Qt, Qnil); 7011 tem = Fwhere_is_internal (def, Qnil, Qt, Qnil, Qt);
6997 XSETCAR (cachelist, tem); 7012 XSETCAR (cachelist, tem);
6998 if (NILP (tem)) 7013 if (NILP (tem))
6999 { 7014 {
7000 XSETCDR (cachelist, Qnil); 7015 XSETCDR (cachelist, Qnil);
7001 chkcache = 0; 7016 chkcache = 0;
9406 /* If enabled, show which key runs this command. */ 9421 /* If enabled, show which key runs this command. */
9407 if (!NILP (Vsuggest_key_bindings) 9422 if (!NILP (Vsuggest_key_bindings)
9408 && NILP (Vexecuting_macro) 9423 && NILP (Vexecuting_macro)
9409 && SYMBOLP (function)) 9424 && SYMBOLP (function))
9410 bindings = Fwhere_is_internal (function, Voverriding_local_map, 9425 bindings = Fwhere_is_internal (function, Voverriding_local_map,
9411 Qt, Qnil); 9426 Qt, Qnil, Qnil);
9412 else 9427 else
9413 bindings = Qnil; 9428 bindings = Qnil;
9414 9429
9415 value = Qnil; 9430 value = Qnil;
9416 GCPRO2 (bindings, value); 9431 GCPRO2 (bindings, value);
10633 doc: /* The command now being executed. 10648 doc: /* The command now being executed.
10634 The command can set this variable; whatever is put here 10649 The command can set this variable; whatever is put here
10635 will be in `last-command' during the following command. */); 10650 will be in `last-command' during the following command. */);
10636 Vthis_command = Qnil; 10651 Vthis_command = Qnil;
10637 10652
10653 DEFVAR_LISP ("this-original-command", &Vthis_original_command,
10654 doc: /* If non-nil, the original command bound to the current key sequence.
10655 The value of `this-command' is the result of looking up the original
10656 command in the active keymaps. */);
10657 Vthis_original_command = Qnil;
10658
10638 DEFVAR_INT ("auto-save-interval", &auto_save_interval, 10659 DEFVAR_INT ("auto-save-interval", &auto_save_interval,
10639 doc: /* *Number of input events between auto-saves. 10660 doc: /* *Number of input events between auto-saves.
10640 Zero means disable autosaving due to number of characters typed. */); 10661 Zero means disable autosaving due to number of characters typed. */);
10641 auto_save_interval = 300; 10662 auto_save_interval = 300;
10642 10663