unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* C-x z is useless after switching frames
@ 2007-08-17  8:09 David Kastrup
  2007-08-17 12:30 ` martin rudalics
  0 siblings, 1 reply; 10+ messages in thread
From: David Kastrup @ 2007-08-17  8:09 UTC (permalink / raw)
  To: emacs-pretest-bug


Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the emacs-pretest-bug@gnu.org mailing list.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

This is on a focus-follows-mouse window manager: After switching
frames, C-x z spews an error message.  See below.

In GNU Emacs 22.1.50.4 (i686-pc-linux-gnu, GTK+ Version 2.10.11)
 of 2007-08-14 on lisa
Windowing system distributor `The X.Org Foundation', version 11.0.70200000
configured using `configure  '--prefix=/usr/local/emacs-21' '--without-toolkit-scroll-bars''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Major mode: Shell-script

Minor modes in effect:
  shell-dirtrack-mode: t
  TeX-PDF-mode: t
  server-mode: t
  desktop-save-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent input:
<up> <up> <up> <up> <up> C-x z <switch-frame> C-x z 
M-x r e p o r t - e m a c s - b u g <return>

Recent messages:
Repeating command previous-line
Repeating command handle-switch-frame
repeat: handle-switch-frame must be bound to an event with parameters
Loading emacsbug...done

-- 
David Kastrup

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: C-x z is useless after switching frames
  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
  0 siblings, 2 replies; 10+ messages in thread
From: martin rudalics @ 2007-08-17 12:30 UTC (permalink / raw)
  To: David Kastrup; +Cc: emacs-pretest-bug

 > repeat: handle-switch-frame must be bound to an event with parameters

`repeat' can also produce things like

   handle-select-window must be bound to an event with parameters

   mouse-popup-menubar-stuff must be bound to an event with parameters

Probably `repeat' should ignore event bound commands.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: C-x z is useless after switching frames
  2007-08-17 12:30 ` martin rudalics
@ 2007-08-17 20:17   ` Richard Stallman
  2007-08-25  4:07   ` Richard Stallman
  1 sibling, 0 replies; 10+ messages in thread
From: Richard Stallman @ 2007-08-17 20:17 UTC (permalink / raw)
  To: martin rudalics; +Cc: emacs-pretest-bug

       handle-select-window must be bound to an event with parameters

       mouse-popup-menubar-stuff must be bound to an event with parameters

    Probably `repeat' should ignore event bound commands.

The way to fix this is to prevent those commands
from getting into real-last-command.

Would someone please implement that and ack?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: C-x z is useless after switching frames
  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
  1 sibling, 1 reply; 10+ messages in thread
From: Richard Stallman @ 2007-08-25  4:07 UTC (permalink / raw)
  To: martin rudalics; +Cc: emacs-pretest-bug

[I sent this message a week ago but did not get a response.]

       handle-select-window must be bound to an event with parameters

       mouse-popup-menubar-stuff must be bound to an event with parameters

    Probably `repeat' should ignore event bound commands.

The way to fix this is to prevent those commands
from getting into real-last-command.

Would someone please implement that and ack?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: C-x z is useless after switching frames
  2007-08-25  4:07   ` Richard Stallman
@ 2007-08-25 11:52     ` martin rudalics
  2007-08-26  1:08       ` Richard Stallman
  0 siblings, 1 reply; 10+ messages in thread
From: martin rudalics @ 2007-08-25 11:52 UTC (permalink / raw)
  To: rms; +Cc: emacs-pretest-bug

 > [I sent this message a week ago but did not get a response.]
 >
 >        handle-select-window must be bound to an event with parameters
 >
 >        mouse-popup-menubar-stuff must be bound to an event with parameters
 >
 >     Probably `repeat' should ignore event bound commands.
 >
 > The way to fix this is to prevent those commands
 >>from getting into real-last-command.
 >
 > Would someone please implement that and ack?

Inherently, changing `real-last-command' is not "nice".  There might be
some code around that relies on telling whether `real-last-command' was
trying to handle a window or frame selection.  Suppose also I tried to
compare `last-command' and `real-last-command' to detect whether some
code has deliberately changed `last-command'.  The comparison would not
fail because someone did, but because `real-last-command' was reset
(resetting `last-command' together with `real-last-command' seems hardly
the right solution for this).

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;

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: C-x z is useless after switching frames
  2007-08-25 11:52     ` martin rudalics
@ 2007-08-26  1:08       ` Richard Stallman
  2007-08-26 10:26         ` martin rudalics
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Stallman @ 2007-08-26  1:08 UTC (permalink / raw)
  To: martin rudalics; +Cc: emacs-pretest-bug

    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.

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

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.

    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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: C-x z is useless after switching frames
  2007-08-26  1:08       ` Richard Stallman
@ 2007-08-26 10:26         ` martin rudalics
  2007-08-26 22:46           ` Richard Stallman
  0 siblings, 1 reply; 10+ messages in thread
From: martin rudalics @ 2007-08-26 10:26 UTC (permalink / raw)
  To: rms; +Cc: emacs-pretest-bug

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: C-x z is useless after switching frames
  2007-08-26 10:26         ` martin rudalics
@ 2007-08-26 22:46           ` Richard Stallman
  2007-08-29 12:09             ` martin rudalics
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Stallman @ 2007-08-26 22:46 UTC (permalink / raw)
  To: martin rudalics; +Cc: emacs-pretest-bug

Please install your patch in Emacs 22, and fix repeat.el too.

    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.

That is a good idea.  Please propose a patch.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: C-x z is useless after switching frames
  2007-08-26 22:46           ` Richard Stallman
@ 2007-08-29 12:09             ` martin rudalics
  2007-08-30  7:15               ` Richard Stallman
  0 siblings, 1 reply; 10+ messages in thread
From: martin rudalics @ 2007-08-29 12:09 UTC (permalink / raw)
  To: rms; +Cc: emacs-pretest-bug

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

Attached find a patch for commands.texi.

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

*** commands.texi.~1.105.~	Tue Jun  5 22:41:18 2007
--- commands.texi	Wed Aug 29 14:01:42 2007
***************
*** 716,722 ****
  @section Information from the Command Loop
  
  The editor command loop sets several Lisp variables to keep status
! records for itself and for commands that are run.
  
  @defvar last-command
  This variable records the name of the previous command executed by the
--- 716,724 ----
  @section Information from the Command Loop
  
  The editor command loop sets several Lisp variables to keep status
! records for itself and for commands that are run.  With the exception of
! @code{this-command} and @code{last-command} it's generally a bad idea to
! change any of these variables in a Lisp program.
  
  @defvar last-command
  This variable records the name of the previous command executed by the
***************
*** 736,741 ****
--- 738,749 ----
  but never altered by Lisp programs.
  @end defvar
  
+ @defvar last-repeatable-command
+ This variable stores the most recently executed command that was not
+ part of an input event.  This is the command @code{repeat} will try to
+ repeat, @xref{Repeating,,, emacs, The GNU Emacs Manual}.
+ @end defvar
+ 
  @defvar this-command
  @cindex current command
  This variable records the name of the command now being executed by

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

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: C-x z is useless after switching frames
  2007-08-29 12:09             ` martin rudalics
@ 2007-08-30  7:15               ` Richard Stallman
  0 siblings, 0 replies; 10+ messages in thread
From: Richard Stallman @ 2007-08-30  7:15 UTC (permalink / raw)
  To: martin rudalics; +Cc: emacs-pretest-bug

The change is good.

    *** commands.texi.~1.105.~	Tue Jun  5 22:41:18 2007
    --- commands.texi	Wed Aug 29 14:01:42 2007

Please install it.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-08-30  7:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2007-08-26 22:46           ` Richard Stallman
2007-08-29 12:09             ` martin rudalics
2007-08-30  7:15               ` Richard Stallman

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