Subject: 23.3; iswitchb

From: Stephen Eglen <[email-masked]>
Date: Sat, 04 Jun 2011 10:42:00 +0100

The following bug report was sent to me by Trevor Spiteri (thank you!).

----------------------------------------------------------------------
The documentation for iswitchb-window-buffer-p states that it should 
return nil if BUFFER is visible in the current frame. Sometimes this 
does not happen.

Suppose I am in a frame with two windows, one for buffer1 and the other 
for buffer2, and I am currently in the window for buffer1. If I type:
C-x b b u f f e r 2 <return>
this works correctly, iswitchb-window-buffer-p returns nil, and 
consequently both windows will show buffer2.

If instead of <return> I use C-j, that is, I am in the window for 
buffer1 and buffer2 is in the other window, and I type:
C-x b b u f f e r 2 C-j
iswitchb-window-buffer-p does not return nil, and consequently not both 
windows will show buffer2, but the window for buffer2 becomes the 
current window.

To fix this, in the defun for iswitchb-window-buffer-p, the line

     (if (memq buffer blist)

should be changed to:

     (if (member buffer blist)

What I guess is happening is that using <return>, buffer is a string 
obtained from the list of buffers, so it is eq to the corresponding 
element in blist. When C-j is used, buffer is taken from user input, and 
is thus not eq to the corresponding element in blist. Although it is not 
eq, it is still equal, so changing memq to member fixes the issue.
----------------------------------------------------------------------