unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: rms@gnu.org
Cc: emacs-pretest-bug@gnu.org
Subject: Re: C-x z is useless after switching frames
Date: Sun, 26 Aug 2007 12:26:07 +0200	[thread overview]
Message-ID: <46D1553F.5020405@gmx.at> (raw)
In-Reply-To: <E1IP6bl-000424-5z@fencepost.gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1431 bytes --]

 >     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.

[-- Attachment #2: keyboard.patch --]
[-- Type: text/plain, Size: 2408 bytes --]

*** 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);

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2007-08-26 10:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-17  8:09 C-x z is useless after switching frames David Kastrup
2007-08-17 12:30 ` martin rudalics
2007-08-17 20:17   ` Richard Stallman
2007-08-25  4:07   ` Richard Stallman
2007-08-25 11:52     ` martin rudalics
2007-08-26  1:08       ` Richard Stallman
2007-08-26 10:26         ` martin rudalics [this message]
2007-08-26 22:46           ` Richard Stallman
2007-08-29 12:09             ` martin rudalics
2007-08-30  7:15               ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46D1553F.5020405@gmx.at \
    --to=rudalics@gmx.at \
    --cc=emacs-pretest-bug@gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).