Subject: Re: bug#24585: 25.1; avoid hack in ggtags.el to run compilation-auto-jump timer

From: Leo Liu <[email-masked]>
Date: Fri, 07 Oct 2016 00:12:57 +0800

On 2016-10-05 13:25 +0300, Eli Zaretskii wrote:
> Instead of adding another timer, and then dealing with their order
> issues, is it possible to reuse the same time for both jobs?  IOW,
> just _add_ the new/additional function you need to be done to whatever
> the single timer does.  If you do that, you get to control the order
> in which things are done by the single timer, because you write the
> code of the timer function(s).

probably not.

ggtags-global-handle-exit needs to consider these situations:

1. when matches are large jump to first match should not wait until
   compilation finishes

2. on failure keep the compilation window popped-up so users can see the
   errors

3. 0 matches, nothing to show so clean up

4. 1 match, wait until compilation-auto-jump and clean up

A solution has to cover all of them. I think this could work:

1. In compilation-error-properties save the jump pos like this

  (setq-local compilation-auto-jump-pos (match-beginning 0))
  (run-with-timer 0 nil 'compilation-auto-jump
                        (current-buffer) compilation-auto-jump-pos)

2. Make compilation-auto-jump do nothing if the buffer is killed.

WDYT?

Leo