GNU bug report logs - #24585
25.1; avoid hack in ggtags.el to run compilation-auto-jump timer

Previous Next

Package: emacs;

Reported by: Leo Liu <sdl.web <at> gmail.com>

Date: Sun, 2 Oct 2016 04:58:02 UTC

Severity: normal

Tags: moreinfo

Found in version 25.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 24585 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Subject: bug#24585: 25.1; avoid hack in ggtags.el to run compilation-auto-jump timer
Date: Fri, 04 Sep 2020 14:47:03 +0200
Leo Liu <sdl.web <at> gmail.com> writes:

> On 2016-10-07 14:10 -0400, Stefan Monnier wrote:
>> Hmm... calling compilation--ensure-parse *should* help.
>> More specifically, if you call compilation--ensure-parse up to point-max
>> from compilation-finish-functions, I can't think of any reason why
>> compilation-error-properties should be called afterwards.  If you can
>> get a backtrace of when that happens, it would help.
>>
>> E.g. set a buffer-local var from compilation-finish-functions after
>> calling compilation--ensure-parse, and then add an assert in
>> compilation-error-properties to check that that var is not set yes.
>
> To the best of my knowledge that seems to work with change like this to
> compile.el:

[...]

This was the final message in this bug report, but looking at the patch
that supposedly fixes the problem, I don't understand how it makes a
difference: Putting (match-beginning) in a buffer-local variable
instead of passing it in directly seems like a no-op?

Checking whether the buffer is alive in compilation-auto-jump seems like
a good idea, though (any async function that switches to a buffer should
check whether it's alive first).

> -(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))))
> +(defvar-local compilation-pending-auto-jump nil)
> +
> +(defun compilation-auto-jump (buffer)
> +  (when (buffer-live-p buffer)
> +    (with-current-buffer buffer
> +      (when compilation-pending-auto-jump
> +        (goto-char compilation-pending-auto-jump)
> +        (let ((win (get-buffer-window buffer 0)))
> +          (if win (set-window-point win compilation-pending-auto-jump)))
> +        (setq compilation-pending-auto-jump nil)
> +        (if compilation-auto-jump-to-first-error
> +            (compile-goto-error))))))
>
>  ;; This function is the central driver, called when font-locking to gather
>  ;; all information needed to later jump to corresponding source code.
> @@ -1126,8 +1131,8 @@ POS and RES.")
>      (when (and compilation-auto-jump-to-next
>                 (>= type compilation-skip-threshold))
>        (kill-local-variable 'compilation-auto-jump-to-next)
> -      (run-with-timer 0 nil 'compilation-auto-jump
> -                      (current-buffer) (match-beginning 0)))
> +      (setq compilation-pending-auto-jump (match-beginning 0))
> +      (run-with-timer 0 nil 'compilation-auto-jump (current-buffer)))
>
>      (compilation-internal-error-properties
>       file line end-line col end-col type fmt)))

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 4 years and 227 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.