> The attached patch fixes the observed problem, however, I do not
 > think that it is entirely correct:
 >
 > [...]
 >> !
 >> !     (with-current-buffer (window-buffer outwin)
 >> !       (when (local-variable-p 'compilation-scroll-output)
 >
 > local-variable-p will return t if compilation-scroll-output is
 > nil, but buffer-local.

You're right.

 > I think you mean
 > (when (buffer-local-value 'compilation-scroll-output (current-buffer))

Not really.  This would be t in *test*, I suppose.  Try the attached one
instead, please.

Thanks, martin.