Subject: bug#1073: 23.0.60; Bad interaction between compilation-scroll-output and dedicated windows

From: Lawrence Mitchell <[email-masked]>
Date: Fri, 03 Oct 2008 10:20:21 +0100

In GNU Emacs 23.0.60.3 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2008-09-24 on lamacq.ph.ed.ac.uk
Windowing system distributor `The X.Org Foundation', version 11.0.60802000
configured using `configure  '-C' '--prefix=/scratch/s0198183/applications/emacs-trunk/' 'CFLAGS=-ggdb3 -O0' '--without-rsvg''

If an Emacs frame is split into multiple windows (two will do) of
which one is dedicated and compilation-scroll-output is t then
`compile' in the non-dedicated window will end up moving point.

Steps to reproduce:

emacs -Q --eval \
'(progn 
  (split-window-vertically)
  (set-window-dedicated-p (selected-window) t)
  (switch-to-buffer-other-window "*test*")
  (insert initial-scratch-message)
  (goto-char (point-min))
  (setq compilation-scroll-output t)
  (compile "echo \"test\"")
  (kill-buffer "*compilation*"))'

Note how point is left at the /end/ of the buffer *test* rather
than the beginning.  This appears to be a problem with a mismatch
between what `selected-window' and `current-buffer' return.

When this code in `compilation-start' is executed:

    (if (buffer-local-value 'compilation-scroll-output outbuf)
	(save-selected-window
	  (select-window outwin)
	  (goto-char (point-max))))

outwin is #<window 13 on *compilation*>
and after the select-window call (selected-window) is #<window 13
on *compilation*>.  However, at this point (current-buffer)
returns *test*, rather than *compilation*.

Cheers,
Lawrence
-- 
Lawrence Mitchell <[email-masked]>