emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compilation auto-jump bug


From: Stefan Monnier
Subject: Re: Compilation auto-jump bug
Date: Tue, 22 Apr 2008 21:51:35 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

> 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))))


-- Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]