GNU bug report logs -
#1073
23.0.60; Bad interaction between compilation-scroll-output and dedicated windows
Previous Next
Reported by: Lawrence Mitchell <wence <at> gmx.li>
Date: Fri, 3 Oct 2008 09:30:02 UTC
Severity: normal
Done: martin rudalics <rudalics <at> gmx.at>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1073 in the body.
You can then email your comments to 1073 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1073
; Package
emacs
.
Full text and
rfc822 format available.
Acknowledgement sent to
Lawrence Mitchell <wence <at> gmx.li>
:
New bug report received and forwarded. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
Full text and
rfc822 format available.
Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
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 <wence <at> gmx.li>
Information forwarded to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1073
; Package
emacs
.
Full text and
rfc822 format available.
Acknowledgement sent to
martin rudalics <rudalics <at> gmx.at>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
Full text and
rfc822 format available.
Message #10 received at 1073 <at> emacsbugs.donarmstrong.com (full text, mbox):
[Message part 1 (text/plain, inline)]
> 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*.
This is a very, very great nuisance of `select-window'. Would the
attached patch DTRT?
martin
[1073.diff (text/plain, inline)]
*** progmodes/compile.el.~1.476.~ 2008-06-13 18:22:16.000000000 +0200
--- progmodes/compile.el 2008-10-03 14:31:45.718750000 +0200
***************
*** 1280,1289 ****
(cons proc compilation-in-progress))))
;; Now finally cd to where the shell started make/grep/...
(setq default-directory thisdir))
! (if (buffer-local-value 'compilation-scroll-output outbuf)
! (save-selected-window
! (select-window outwin)
! (goto-char (point-max))))
;; Make it so the next C-x ` will use this buffer.
(setq next-error-last-buffer outbuf)))
--- 1280,1290 ----
(cons proc compilation-in-progress))))
;; Now finally cd to where the shell started make/grep/...
(setq default-directory thisdir))
!
! (with-current-buffer (window-buffer outwin)
! (when (local-variable-p 'compilation-scroll-output)
! (goto-char (point-max))))
!
;; Make it so the next C-x ` will use this buffer.
(setq next-error-last-buffer outbuf)))
Information forwarded to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1073
; Package
emacs
.
Full text and
rfc822 format available.
Acknowledgement sent to
Lawrence Mitchell <wence <at> gmx.li>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
Full text and
rfc822 format available.
Message #15 received at 1073 <at> emacsbugs.donarmstrong.com (full text, mbox):
martin rudalics wrote:
>> 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*.
> This is a very, very great nuisance of `select-window'. Would the
> attached patch DTRT?
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. I think you mean
(when (buffer-local-value 'compilation-scroll-output (current-buffer))
...)
?
[...]
Cheers,
Lawrence
Information forwarded to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1073
; Package
emacs
.
Full text and
rfc822 format available.
Acknowledgement sent to
"Lennart Borgman (gmail)" <lennart.borgman <at> gmail.com>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
Full text and
rfc822 format available.
Message #20 received at 1073 <at> emacsbugs.donarmstrong.com (full text, mbox):
martin rudalics wrote:
>> 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*.
>
> This is a very, very great nuisance of `select-window'. Would the
> attached patch DTRT?
I did not try the patch so maybe I misunderstand it. But is not the
problem that (current-buffer) is not the same as (window-buffer)?
If so then perhaps using
(save-selected-window
(select-window outwin)
(with-current-buffer (window-buffer)
(goto-char (point-max)))
would do the expected thing?
But it looks strange to me. How does one know that this will change the
point in outwin? It would be much cleaner with something like a defmacro
`with-window-buffer' which would take a window as its first argument.
With that defmacro the code would be
(with-window-buffer outwin
(goto-char (point-max))
Information forwarded to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1073
; Package
emacs
.
Full text and
rfc822 format available.
Acknowledgement sent to
martin rudalics <rudalics <at> gmx.at>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
Full text and
rfc822 format available.
Message #25 received at 1073 <at> emacsbugs.donarmstrong.com (full text, mbox):
[Message part 1 (text/plain, inline)]
> 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.
[1073.diff (text/plain, inline)]
*** progmodes/compile.el.~1.476.~ 2008-06-13 18:22:16.000000000 +0200
--- progmodes/compile.el 2008-10-03 15:11:15.406250000 +0200
***************
*** 1280,1289 ****
(cons proc compilation-in-progress))))
;; Now finally cd to where the shell started make/grep/...
(setq default-directory thisdir))
! (if (buffer-local-value 'compilation-scroll-output outbuf)
! (save-selected-window
! (select-window outwin)
! (goto-char (point-max))))
;; Make it so the next C-x ` will use this buffer.
(setq next-error-last-buffer outbuf)))
--- 1280,1291 ----
(cons proc compilation-in-progress))))
;; Now finally cd to where the shell started make/grep/...
(setq default-directory thisdir))
!
! (with-current-buffer (window-buffer outwin)
! (when (and (local-variable-p 'compilation-scroll-output)
! compilation-scroll-output)
! (goto-char (point-max))))
!
;; Make it so the next C-x ` will use this buffer.
(setq next-error-last-buffer outbuf)))
Information forwarded to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1073
; Package
emacs
.
Full text and
rfc822 format available.
Acknowledgement sent to
martin rudalics <rudalics <at> gmx.at>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
Full text and
rfc822 format available.
Message #30 received at 1073 <at> emacsbugs.donarmstrong.com (full text, mbox):
> I did not try the patch so maybe I misunderstand it. But is not the
> problem that (current-buffer) is not the same as (window-buffer)?
Yes. But the real problem is that `select-window' returns immediately
(that is, without making its buffer current) when its argument is the
selected window.
martin
Information forwarded to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1073
; Package
emacs
.
Full text and
rfc822 format available.
Acknowledgement sent to
"Lennart Borgman (gmail)" <lennart.borgman <at> gmail.com>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
Full text and
rfc822 format available.
Message #35 received at 1073 <at> emacsbugs.donarmstrong.com (full text, mbox):
martin rudalics wrote:
>> I did not try the patch so maybe I misunderstand it. But is not the
>> problem that (current-buffer) is not the same as (window-buffer)?
>
> Yes. But the real problem is that `select-window' returns immediately
> (that is, without making its buffer current) when its argument is the
> selected window.
Thanks, that was what I thought. That is why I am suggesting the
defmacro. I think it would be useful and it is not dangerous to
introduce it. Even in a feature freeze and can be of value to fixing
problems with this strange behaviour of select-window. And the semantic
of the defmacro could be the same even if select-window is "corrected".
And the changes, but since you did not answer to that I guess I was
misunderstanding something there.
Information forwarded to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1073
; Package
emacs
.
Full text and
rfc822 format available.
Acknowledgement sent to
martin rudalics <rudalics <at> gmx.at>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
Full text and
rfc822 format available.
Message #40 received at 1073 <at> emacsbugs.donarmstrong.com (full text, mbox):
> And the changes, but since you did not answer to that I guess I was
> misunderstanding something there.
I'm not sure what you mean but the change you proposed missed the
local-variable issue completely.
martin
Information forwarded to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1073
; Package
emacs
.
Full text and
rfc822 format available.
Acknowledgement sent to
"Lennart Borgman (gmail)" <lennart.borgman <at> gmail.com>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
Full text and
rfc822 format available.
Message #45 received at 1073 <at> emacsbugs.donarmstrong.com (full text, mbox):
martin rudalics wrote:
>> And the changes, but since you did not answer to that I guess I was
>> misunderstanding something there.
>
> I'm not sure what you mean but the change you proposed missed the
> local-variable issue completely.
Ah, my bad. I was just misreading. And the macro is of course pointless
since one can always do what you did, ie
(with-current-buffer (window-buffer outwin)
...
Information forwarded to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1073
; Package
emacs
.
Full text and
rfc822 format available.
Acknowledgement sent to
Lawrence Mitchell <wence <at> gmx.li>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
Full text and
rfc822 format available.
Message #50 received at 1073 <at> emacsbugs.donarmstrong.com (full text, mbox):
martin rudalics wrote:
>> 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.
Ah yes. The updated patch does work correctly.
Cheers,
Lawrence
Reply sent to
martin rudalics <rudalics <at> gmx.at>
:
You have taken responsibility.
Full text and
rfc822 format available.
Notification sent to
Lawrence Mitchell <wence <at> gmx.li>
:
bug acknowledged by developer.
Full text and
rfc822 format available.
Message #55 received at 1073-done <at> emacsbugs.donarmstrong.com (full text, mbox):
I checked in a slightly different fix. Please have a look.
Thanks, martin.
Information forwarded to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1073
; Package
emacs
.
Full text and
rfc822 format available.
Acknowledgement sent to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
Full text and
rfc822 format available.
Message #60 received at 1073 <at> emacsbugs.donarmstrong.com (full text, mbox):
>> 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*.
> This is a very, very great nuisance of `select-window'. Would the
> attached patch DTRT?
> martin
> *** progmodes/compile.el.~1.476.~ 2008-06-13 18:22:16.000000000 +0200
> --- progmodes/compile.el 2008-10-03 14:31:45.718750000 +0200
> ***************
> *** 1280,1289 ****
> (cons proc compilation-in-progress))))
> ;; Now finally cd to where the shell started make/grep/...
> (setq default-directory thisdir))
> ! (if (buffer-local-value 'compilation-scroll-output outbuf)
> ! (save-selected-window
> ! (select-window outwin)
> ! (goto-char (point-max))))
> ;; Make it so the next C-x ` will use this buffer.
> (setq next-error-last-buffer outbuf)))
> --- 1280,1290 ----
> (cons proc compilation-in-progress))))
> ;; Now finally cd to where the shell started make/grep/...
> (setq default-directory thisdir))
> !
> ! (with-current-buffer (window-buffer outwin)
> ! (when (local-variable-p 'compilation-scroll-output)
> ! (goto-char (point-max))))
> !
> ;; Make it so the next C-x ` will use this buffer.
> (setq next-error-last-buffer outbuf)))
I think the select-window thingy is/was needed in order to make sure we
move point in the relevant window, rather than just moving point in the
relevant buffer.
So maye something like:
(with-selected-window outwin
(with-current-buffer (window-buffer outwin)
...))
would be better.
Stefan
Information forwarded to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1073
; Package
emacs
.
Full text and
rfc822 format available.
Acknowledgement sent to
martin rudalics <rudalics <at> gmx.at>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
Full text and
rfc822 format available.
Message #65 received at 1073 <at> emacsbugs.donarmstrong.com (full text, mbox):
> I think the select-window thingy is/was needed in order to make sure we
> move point in the relevant window, rather than just moving point in the
> relevant buffer.
> So maye something like:
>
> (with-selected-window outwin
> (with-current-buffer (window-buffer outwin)
> ...))
>
> would be better.
The original code had
(goto-char (point-max))
which moves point in all windows showing the relevant buffer. In that
sense I didn't change the semantics of the original code.
IIUC you want something similar to the
;; Position point as the user will see it.
(let ((desired-visible-point
;; Put it at the end if `compilation-scroll-output' is set.
(if compilation-scroll-output
(point-max)
;; Normally put it at the top.
(point-min))))
(if (eq outwin (selected-window))
(goto-char desired-visible-point)
(set-window-point outwin desired-visible-point)))
stuff a few lines above? Or am I missing something?
martin
bug archived.
Request was from
Debbugs Internal Request <don <at> donarmstrong.com>
to
internal_control <at> emacsbugs.donarmstrong.com
.
(Mon, 03 Nov 2008 15:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 16 years and 234 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.