emacs-devel
[Top][All Lists]
Advanced

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

Re: select-window doesn't always make that window's buffer current


From: Richard Stallman
Subject: Re: select-window doesn't always make that window's buffer current
Date: Thu, 03 Jun 2004 11:56:47 -0400

    (setq a (get-buffer-create "A"))
    (setq b (get-buffer-create "B"))

    ;; Now arrange the frame so A is in one window and B is in another
    ;; and select B.  Then M-: eval the following:

    (progn 
      (set-buffer a) 
      (select-window (get-buffer-window b))
      (current-buffer))

    ;; the result is #<buffer A>. But the documentation says

This result happens because the window you're trying to select
is already selected.  In that case, select-window doesn't really
do anything.

    ;; The initial (set-buffer a), which gets the current-buffer and the
    ;; selected-window out of sync seems to be needed to trigger this
    ;; effect.

Without that, select-window would still do nothing, but that would
not be surprising since the buffer in that window would already
be selected.

I could change selected-window so that it selects the specified
window's buffer even if that window is already selected.  However, I
think that might break some programs.  We could try it and see.
Perhaps it would be better to document the current behavior.




reply via email to

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