emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C-x z is useless after switching frames


From: martin rudalics
Subject: Re: C-x z is useless after switching frames
Date: Sun, 26 Aug 2007 12:26:07 +0200
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

>     Inherently, changing `real-last-command' is not "nice".
>
> I wasn't thinking of changing it; rather, not setting it at all for
> those kinds of events.

I meant "changing the semantics of `real-last-command'".  We'd change
the semantics by _not_ setting it.

> That probably works in practice, because the only other package
> that tests `real-last-command' is table.el, and I think it could
> just as well use `last-command'.

Yes.  But if we were to suggest not testing `real-last-command' in Lisp
code (aside from repeat.el) we probably shouldn't mention that variable
in the manual in the first place.

> But you are right that this isn't entirely clean.
> What could be a cleaner method?
>
> Perhaps to make a new variable and set it at the C level, almost like
> `real-last-command' but excluding certain commands, or certain events.

We could call it `last-repeatable-command' and have repeat.el use that
instead of `real-last-command'.  I attached a patch for keyboard.c.

>     Disregarding my scruples, how do I tell whether `real-this-command' was
>     bound to an input event at the time of executing
>
>          current_kboard->Vreal_last_command = real_this_command;
>
> My idea was to test last_command_char.

We maybe should say somewhere that it's a bad idea to change
`last-command-char' (and probably `real-last-command' and
`last-repeatable-command' as well) while executing a command.
*** keyboard.c  Sun Jun 10 17:46:54 2007
--- keyboard.c  Sun Aug 26 11:22:14 2007
***************
*** 1536,1542 ****
    /* Do this after running Vpost_command_hook, for consistency.  */
    current_kboard->Vlast_command = Vthis_command;
    current_kboard->Vreal_last_command = real_this_command;
! 
    while (1)
      {
        if (! FRAME_LIVE_P (XFRAME (selected_frame)))
--- 1536,1544 ----
    /* Do this after running Vpost_command_hook, for consistency.  */
    current_kboard->Vlast_command = Vthis_command;
    current_kboard->Vreal_last_command = real_this_command;
!   if (!CONSP (last_command_char))
!     current_kboard->Vlast_repeatable_command = real_this_command;
!     
    while (1)
      {
        if (! FRAME_LIVE_P (XFRAME (selected_frame)))
***************
*** 1916,1921 ****
--- 1918,1925 ----
        {
          current_kboard->Vlast_command = Vthis_command;
          current_kboard->Vreal_last_command = real_this_command;
+         if (!CONSP (last_command_char))
+           current_kboard->Vlast_repeatable_command = real_this_command;
          cancel_echoing ();
          this_command_key_count = 0;
          this_command_key_count_reset = 0;
***************
*** 11053,11058 ****
--- 11057,11063 ----
    kb->Voverriding_terminal_local_map = Qnil;
    kb->Vlast_command = Qnil;
    kb->Vreal_last_command = Qnil;
+   kb->Vlast_repeatable_command = Qnil;
    kb->Vprefix_arg = Qnil;
    kb->Vlast_prefix_arg = Qnil;
    kb->kbd_queue = Qnil;
***************
*** 11540,11545 ****
--- 11545,11555 ----
    DEFVAR_KBOARD ("real-last-command", Vreal_last_command,
                 doc: /* Same as `last-command', but never altered by Lisp 
code.  */);
  
+   DEFVAR_KBOARD ("last-repeatable-command", Vlast_repeatable_command,
+                doc: /* Last command that may be repeated.
+ The last command executed that was not bound to an input event.
+ This is the command `repeat' will try to repeat.  */);
+ 
    DEFVAR_LISP ("this-command", &Vthis_command,
               doc: /* The command now being executed.
  The command can set this variable; whatever is put here
***************
*** 11938,11943 ****
--- 11948,11954 ----
        mark_object (kb->Voverriding_terminal_local_map);
        mark_object (kb->Vlast_command);
        mark_object (kb->Vreal_last_command);
+       mark_object (kb->Vlast_repeatable_command);
        mark_object (kb->Vprefix_arg);
        mark_object (kb->Vlast_prefix_arg);
        mark_object (kb->kbd_queue);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]