[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Compilation auto-jump bug
From: |
Juri Linkov |
Subject: |
Re: Compilation auto-jump bug |
Date: |
Wed, 23 Apr 2008 11:54:14 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu) |
>> BTW, there is also the opposite bug: when `compilation-scroll-output' is
>> `first-error', but `compilation-auto-jump-to-first-error' is nil, when
>> the current buffer is not the *compilation* buffer, then it doesn't keep
>> point on the first error. This means when I switch to the *compilation*
>> buffer, point is at the beginning of the *compilation* buffer instead of
>> the position of the first error. But when the current buffer is the
>> *compilation* buffer at the time when compilation moves point, then it
>> keeps the correct position of the first error. This is due to the code:
>
>> (defun compilation-auto-jump (buffer pos)
>> (with-current-buffer buffer
>> (goto-char pos)
>> (if compilation-auto-jump-to-first-error
>> (compile-goto-error))))
>
>> It doesn't use `save-excursion', so it is strange that it doesn't keep
>> point on the new position after `goto-char'.
>
> I guess the problem is that we need to affect the window-point of the
> window that's showing the compilation buffer and this only happens when
> we do `goto-char' if that window is the selected one.
> So maybe something like:
>
> (defun compilation-auto-jump (buffer pos)
> (with-current-buffer buffer
> (goto-char pos)
> (let ((win (get-buffer-window buffer 0)))
> (if win (set-window-point win pos)))
> (if compilation-auto-jump-to-first-error
> (compile-goto-error))))
Yes, it works. Maybe we should add a primitive for this additional code
with a name like `save-window-point'? If this name can be confused with
a function that keeps the old window point before entering its body, then
maybe some other name would be more clear.
--
Juri Linkov
http://www.jurta.org/emacs/
Re: Info bug, Chong Yidong, 2008/04/21
Re: Info bug, Stefan Monnier, 2008/04/21
Re: Info bug, David Kastrup, 2008/04/22