all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* select-window doesn't always make that window's buffer current
@ 2004-06-02 16:25 Don Bashford
  2004-06-03 15:56 ` Richard Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: Don Bashford @ 2004-06-02 16:25 UTC (permalink / raw)
  Cc: Donald Bashford



In GNU Emacs 21.2.1 (i386-redhat-linux-gnu, X toolkit, Xaw3d scroll
bars)
 of 2002-04-08 on porky.devel.redhat.com
configured using `configure  i386-redhat-linux --prefix=/usr
--exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin
--sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include
--libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var
--sharedstatedir=/usr/com --mandir=/usr/share/man
--infodir=/usr/share/info --with-gcc --with-pop --with-sound'
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.iso885915
  locale-coding-system: iso-latin-9
  default-enable-multibyte-characters: t

;; select-window doesn't set the current buffer as expected if
;; current buffer is not the one displayed in the selected window.

(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

;; - Function: select-window window
;;     This function makes WINDOW the selected window.  The cursor then
;;     appears in WINDOW (on redisplay).  The buffer being displayed in
;;     WINDOW is immediately designated the current buffer.

;; so one would expect the return value to be #<buffer B>

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

Emacs 21.3 has the same problem.

-Don

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

* Re: select-window doesn't always make that window's buffer current
  2004-06-02 16:25 select-window doesn't always make that window's buffer current Don Bashford
@ 2004-06-03 15:56 ` Richard Stallman
  2004-06-03 16:18   ` Don Bashford
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Stallman @ 2004-06-03 15:56 UTC (permalink / raw)
  Cc: Don.Bashford, emacs-devel

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

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

* Re: select-window doesn't always make that window's buffer current
  2004-06-03 15:56 ` Richard Stallman
@ 2004-06-03 16:18   ` Don Bashford
  2004-06-05 13:49     ` Richard Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: Don Bashford @ 2004-06-03 16:18 UTC (permalink / raw)
  Cc: Donald Bashford, emacs-devel

On Thu, 2004-06-03 at 10:56, Richard Stallman wrote:
> 
> 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.
> 

Either solution seems OK to me.  It was easy to work around the problem
once I finally figured out what was happening.

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

* Re: select-window doesn't always make that window's buffer current
  2004-06-03 16:18   ` Don Bashford
@ 2004-06-05 13:49     ` Richard Stallman
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Stallman @ 2004-06-05 13:49 UTC (permalink / raw)
  Cc: Don.Bashford, emacs-devel

It looks like people have already documented the current behavior
in the doc string.

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

end of thread, other threads:[~2004-06-05 13:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-02 16:25 select-window doesn't always make that window's buffer current Don Bashford
2004-06-03 15:56 ` Richard Stallman
2004-06-03 16:18   ` Don Bashford
2004-06-05 13:49     ` Richard Stallman

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.