emacs-devel
[Top][All Lists]
Advanced

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

Re: which-func causes wrong window selections


From: Richard Stallman
Subject: Re: which-func causes wrong window selections
Date: Sat, 21 Sep 2002 15:39:42 -0400

You have found a real doozie of a problem.


I think the right solution is that selecting a window with
select-window should not select its frame, and should not alter the
frame's selected window unless it is the selected frame.

Could people please think about this and see if they can spot
any bad consequences?  I have a feeling this will break things
which we will need to fix.  But at the same time I don't see any
other good solution.

I will implement it now so we can start to notice what breaks.
Meanwhile, we can still consider other solutions if someone can
propose another.


Envelope-to: address@hidden
Delivery-date: Fri, 20 Sep 2002 20:27:17 -0400
To: address@hidden
Subject: which-func causes wrong window selections
From: address@hidden
Date: Fri, 20 Sep 2002 20:26:42 -0400
Sender: address@hidden
Source-Info: Sender is really address@hidden
X-Spam-Status: No, hits=2.0 required=5.0
        tests=NO_REAL_NAME,DOUBLE_CAPSWORD,GAPPY_TEXT
        version=2.31
X-Spam-Level: **

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

If you are using multiple windows in multiple frames, which-function-mode
can cause the selected window in the non-current frame to change.


Recipe:
  emacs -q -no-site-file

  C-x 4 b foo RET
  C-x o
  C-x 5 b bar RET

At this point in time, switching between frames maintains the
selected window in the first frame (containing "*scratch*").

  M-x which-function-mode

Now, if you switch to the frame containing bar and wait there for a few
seconds, when you switch back to first frame, the window containing
"foo" is selected rather than "*scratch*".


Root cause:
  `which-func-update' calls `which-func-update-1' on all visible
  windows in window order.  Although `which-func-update-1' wraps its
  stuff in `save-selected-window', this is not enough to maintain
  other frames' selected windows.  Sequence goes like this:

Given:
2 frames, frame 1 has window A (selected) and B, and frame 2 has window C.
selected frame is frame 2, selected window is window C.

`save-selected-window' saves window C.
window A is selected by which-func-update-1.
select_window_1 in window.c sets frame 1's selected window to A.

  sf = SELECTED_FRAME ();
  if (XFRAME (WINDOW_FRAME (w)) != sf)
    {
      XFRAME (WINDOW_FRAME (w))->selected_window = window;
      /* Use this rather than Fhandle_switch_frame
         so that FRAME_FOCUS_FRAME is moved appropriately as we
         move around in the state where a minibuffer in a separate
         frame is active.  */
      Fselect_frame (WINDOW_FRAME (w), Qnil);
    }

`save-selected-window' resores frame 2's selected window to C.
`save-selected-window' saves window C.
window B is selected by which-func-update-1.
select_window_1 in window.c sets frame 1's selected window to B.
`save-selected-window' resores frame 2's selected window to C.
`save-selected-window' saves window C.
window C is selected by which-func-update-1.
select_window_1 in window.c sets frame 2's selected window to C.
`save-selected-window' resores frame 2's selected window to C.

We end up with frame 1's selected window having changed to B.


In GNU Emacs 21.3.50.11 (i686-pc-linux-gnu, X toolkit)
 of 2002-09-19 on miyazima.lti.cs.cmu.edu
configured using `configure --prefix=/opt/emacs21 --without-toolkit-scroll-bars 
--x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib --verbose'

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
  locale-coding-system: iso-latin-1
  default-enable-multibyte-characters: t

Recent input:
t - e n m <tab> <backspace> <backspace> m <tab> <return> 
M-p C-k W h i c h - f u n C-a C-k w h i c h - f u n 
c SPC c a u s e s SPC w r o n g SPC w i n d o w SPC 
s e l e c t i o n s <return> C-x k y e s <return> C-n 
C-n C-p C-p C-p C-e C-x 4 b * g u <tab> <return> <escape> 
> M-x r e p o r t - e m <tab> <return>

Recent messages:
Type C-x 4 b RET to restore the other window.  C-M-v to scroll the help.
Undo!
find-function-noselect: select-window is a primitive function
Mark set
Mark saved where search started
Mark set [4 times]
Don't touch it!  It's the History Eraser Button, you fool!
Mark set
Loading emacsbug...done
Mark set

-- 
Michael Welsh Duggan
(address@hidden)






reply via email to

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