Subject: bug#23987: 24.5; Icy with Ggtags Problem

From: Drew Adams <[email-masked]>
Date: Fri, 22 Jul 2016 07:01:35 -0700 (PDT)

> > (defun compilation-auto-jump (buffer pos)
> >   (when (buffer-live-p buffer) ; <=======
...
> This function did not help the use case...

Hm. I thought that the error reported was that some code tried
to use a buffer that was dead (killed).  And that the code
that raised the error was invoked from `compilation-auto-jump'
(which is invoked from an idle timer).

 Error running timer `compilation-auto-jump': (error "Selecting
   deleted buffer")

Are you getting the _same_ error even after changing the code
as indicated?  If so then I might not understand what's going
on.

I'm guessing that the new definition of `compilation-auto-jump'
was not getting invoked.  The old definition was still getting
invoked, as it was built into the original timer (which is not
assigned to any variable, so you cannot easily cancel it).

To test with the suggested code, try something like this:

Make a _copy_ of compile.el, and move the original and any
byte-compiled version (compile.elc) somewhere that is not
in your `load-path' (so you can move them back again after
testing, if need be).

Then replace the original definition in the copy of file
compile.el that _is_ in your `load-path' with the new
definition.  Don't bother to compile the file.  Then test
in a new Emacs session or at least a new compilation buffer.

The point is to be sure to pick up the new version.

You can also add a call to `message' to the new version,
to let you know that it is getting called (the messages
get logged in buffer `*Messages*').  E.g.:

(defun compilation-auto-jump (buffer pos)
  (message "CAJ, BUF: %S, POS: %S" buffer pos) <=======
  (when (buffer-live-p buffer)
    ...))