GNU bug report logs - #23987
24.5; Icy with Ggtags Problem

Previous Next

Package: emacs;

Reported by: bvraghav <at> iitk.ac.in (B.V. Raghav)

Date: Thu, 14 Jul 2016 17:29:02 UTC

Severity: minor

Found in version 24.5

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Forwarded to https://github.com/leoliu/ggtags/issues/89

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23987 in the body.
You can then email your comments to 23987 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#23987; Package emacs. (Thu, 14 Jul 2016 17:29:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to bvraghav <at> iitk.ac.in (B.V. Raghav):
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 14 Jul 2016 17:29:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: bvraghav <at> iitk.ac.in (B.V. Raghav)
To: bug-gnu-emacs <at> gnu.org
Subject: 24.5; Icy with Ggtags Problem
Date: Thu, 14 Jul 2016 22:57:47 +0530
======================================================================
Start with a project having GTAGS table, and then starting with
`emacs -Q', navigate to the project :

1. Load the ggtags (in scratch buffer type the following, and `C-M-x'):
   (add-to-list 'load-path "~/.emacs.d/elpa/ggtags-20151214.1344")
   (require 'ggtags)

2. Navigate to a file in project, and `M-. <defin..> TAB RET' --- moves
   to <definition> in the corresponding file.

3. Close emacs `C-x C-c'

Restart `emacs -Q'

1. Load ggtags, and icicles, as in step 1 of prev attempt.

2. Navigate to a file in project, and `M-. <defin..> TAB RET' ---
   crashes with following error:

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



Can anyone reproduce this?



This has been there for a long time. May be related to
https://github.com/leoliu/ggtags/issues/89

There is a workaround suggested in the above link,

> Does it help if you change 0 in (ggtags-navigation-mode-cleanup buf 0)
> of ggtags-global-handle-exit to a greater value, for example, 0.25, 0.5,
> 1 etc?

but it did not work for me.

======================================================================



In GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2016-04-08 on binet, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11803000
System Description:	Debian GNU/Linux testing (stretch)

Configured using:
 `configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
 --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
 --with-x=yes --with-x-toolkit=lucid --with-toolkit-scroll-bars
 --without-gconf --without-gsettings 'CFLAGS=-g -O2
 -fstack-protector-strong -Wformat -Werror=format-security -Wall'
 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Important settings:
  value of $LANG: en_IN
  locale-coding-system: iso-latin-1-unix

Major mode: Lisp Interaction

Minor modes in effect:
  yas-global-mode: t
  yas-minor-mode: t
  icicle-mode: t
  minibuffer-depth-indicate-mode: t
  shell-dirtrack-mode: t
  projectile-global-mode: t
  projectile-mode: t
  TeX-PDF-mode: t
  async-bytecomp-package-mode: t
  global-subword-mode: t
  subword-mode: t
  show-paren-mode: t
  electric-pair-mode: t
  display-time-mode: t
  global-reveal-mode: t
  reveal-mode: t
  global-linum-mode: t
  linum-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Wrote /home/bvr/.emacs.d/elpa/ggtags-20151214.1344/ggtags.el
Saving file /home/bvr/.emacs.d/elpa/ggtags-20151214.1344/ggtags.el...
Wrote /home/bvr/.emacs.d/elpa/ggtags-20151214.1344/ggtags.el
Undo! [13 times]
Redo! [2 times]
Undo! [2 times]
user-error: No further undo information [13 times]
Saving file /home/bvr/.emacs.d/elpa/ggtags-20151214.1344/ggtags.el...
Wrote /home/bvr/.emacs.d/elpa/ggtags-20151214.1344/ggtags.el
Computing completion candidates...

Load-path shadows:
/home/bvr/.emacs.d/elpa/helm-20160520.1124/helm-multi-match hides /home/bvr/.emacs.d/elpa/helm-core-20160519.2213/helm-multi-match
/usr/share/emacs24/site-lisp/cmake-data/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode
/usr/share/emacs/24.5/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs/site-lisp/rst hides /usr/share/emacs/24.5/lisp/textmodes/rst

Features:
(shadow sort bbdb-message org-table mail-extr emacsbug sendmail imenu
filecache tramp-cmds tramp-sh tramp-cache autorevert filenotify misearch
multi-isearch flyspell ispell org-indent org-rmail org-mhe org-irc
org-info org-gnus org-docview doc-view jka-compr image-mode org-bbdb
org-w3m skeleton vc-dispatcher vc-svn ggtags ewoc yasnippet cc-langs
face-remap xterm server smart-mode-line-powerline-theme powerline
powerline-separators color powerline-themes smart-mode-line mule-util
rich-minority dot-mode dabbrev icomplete+ icomplete icicles warnings
two-column icicles-mode dired+ image-file dired-aux mb-depth+ mb-depth
icicles-cmd2 icicles-cmd1 frame-cmds frame-fns avoid icicles-mcmd
image-dired doremi icicles-fn icicles-var apropos-fn+var apropos
icicles-opt ffap fuzzy-match cus-theme cus-edit cus-start cus-load
wid-edit bookmark+ bookmark+-key derived dired-x crosshairs
col-highlight vline hl-line+ bookmark+-1 bookmark+-bmu help-mode
bookmark+-lit pp+ bookmark hexrgb thingatpt+ icicles-face slime-repl
slime-parse slime etags arc-mode archive-mode pp hyperspec message-x
bbdb bbdb-site timezone ob-sqlite ob-gnuplot ob-dot ob-perl ob-python
ob-sh ob-R ess-toolbar ess-mouse mouseme ess-menu ess-swv ess-noweb
ess-noweb-font-lock-mode ess-bugs-l essd-els ess-sas-d ess-sas-l
ess-sas-a ess-sta-d ess-sta-l make-regexp ess-sp6-d ess-dde ess-sp3-d
ess-julia julia-mode ess-r-d ess-r-syntax ess-r-completion ess-roxy
essddr hideshow ess-help ess-r-package eldoc ess-s-l ess ess-inf
ess-tracebug tramp tramp-compat tramp-loaddefs trampver shell ess-mode
ess-noweb-mode ess-utils ess-generics ess-custom executable ess-compat
ess-site projectile grep ibuf-ext ibuffer thingatpt auctex-latexmk latex
tex-style tex-buf tex dbus crm multi-term cl term disp-table ehelp
cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs org-ref org-ref-helm-bibtex helm-bibtex
bibtex-completion biblio biblio-dissemin biblio-hal biblio-dblp
biblio-crossref biblio-arxiv parse-time biblio-doi biblio-core seq
seq-24 let-alist url-queue ido hl-line helm-plugin helm-utils compile
helm-net browse-url xml helm-help org-ref-helm helm helm-source
helm-multi-match helm-lib dired helm-config helm-easymenu async-bytecomp
async reftex-cite reftex reftex-vars parsebib org-ref-glossary
org-ref-utils org-ref-bibtex pcase org-ref-citeproc cl-macs gv message
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 ietf-drums mailabbrev mail-utils gmm-utils mailheader
key-chord hydra advice lv doi-utils org-bibtex json bibtex f s
ucs-normalize dash ox-texinfo ox-icalendar ox-html ox-beamer ox-latex
ox-ascii ox-publish ox org-element org org-macro org-footnote
org-pcomplete pcomplete org-list org-faces org-entities org-version
ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table ob-exp org-src ob-keys
ob-comint comint ansi-color ring ob-core ob-eval org-compat org-macs
org-loaddefs format-spec find-func cal-menu calendar cal-loaddefs
wc-mode edmacro kmacro superword subword paren elec-pair battery time
noutline outline easy-mmode reveal linum tex-site info easymenu
slime-autoloads package epg-config wheatgrass-theme tempo url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util url-parse auth-source eieio byte-opt bytecomp byte-compile
cl-extra cl-loaddefs cl-lib cconv eieio-core gnus-util time-date mm-util
help-fns mail-prsvr password-cache url-vars mailcap xml-parse doxymacs
tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list
newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp
files text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind gfilenotify dynamic-setting font-render-setting x-toolkit x
multi-tty emacs)

Memory information:
((conses 16 813517 87364)
 (symbols 48 66894 7)
 (miscs 40 1832 2461)
 (strings 32 196469 24158)
 (string-bytes 1 5909376)
 (vectors 16 94354)
 (vector-slots 8 1578498 29078)
 (floats 8 1876 396)
 (intervals 56 21904 2668)
 (buffers 960 31)
 (heap 1024 82085 5812))

-- 
--
(B.V. Raghav)
Ph.D. Student,
Design Programme, IIT Kanpur

Ph: +91-9450988137
Email: bvraghav <at> gmail.com




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23987; Package emacs. (Wed, 20 Jul 2016 07:44:02 GMT) Full text and rfc822 format available.

Message #8 received at 23987 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: bvraghav <at> iitk.ac.in (B.V. Raghav)
Cc: 23987 <at> debbugs.gnu.org
Subject: Re: bug#23987: 24.5; Icy with Ggtags Problem
Date: Wed, 20 Jul 2016 03:42:55 -0400
Icicles is not part of Emacs or GNU ELPA.
ggtags is in GNU ELPA, but uses github for bug reports.
You've already found the relevant open github issue, so I suggest
commenting there.




Set bug forwarded-to-address to 'https://github.com/leoliu/ggtags/issues/89'. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 20 Jul 2016 07:45:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 23987 <at> debbugs.gnu.org and bvraghav <at> iitk.ac.in (B.V. Raghav) Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 20 Jul 2016 07:45:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23987; Package emacs. (Thu, 21 Jul 2016 16:45:02 GMT) Full text and rfc822 format available.

Message #15 received at 23987 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: bvraghav <at> iitk.ac.in, 23987 <at> debbugs.gnu.org
Subject: RE: bug#23987: 24.5; Icy with Ggtags Problem
Date: Thu, 21 Jul 2016 09:44:44 -0700 (PDT)
>    Error running timer `compilation-auto-jump': (error "Selecting
>    deleted buffer")

This might, as supposed, be a ggtags issue.  But I wonder if this
isn't actually a `compile.el' issue.

It seems like asking for trouble for any function
(e.g. `compilation-auto-jump') that is invoked by an idle timer
to be doing something based on evaluation of `(current-buffer)',
in particular, without testing whether the result of that
evaluation is a live buffer.

In the present case, a user is apparently doing code completion.
And in the case of Icicles, that can involve use of the minibuffer.

I suspect that `compilation-auto-jump' should control itself, and
act only in the buffer that it apparently expects to be acting in.

Seems like fragile code.  Any reason why an idle-timer function
should assume something about what buffer is current or should
not bother to check whether `(current-buffer)' is a live buffer?

My guess is that this is not a ggtags or Icicles issue, but is
just dumb behavior by `compilation-auto-jump'.

This is my suggestion, FWIW:

(defun compilation-auto-jump (buffer pos)
  (when (buffer-live-p buffer) ; <===========================
    (with-current-buffer buffer
      (goto-char pos)
      (let ((win  (get-buffer-window buffer 0)))
        (when win (set-window-point win pos)))
      (when compilation-auto-jump-to-first-error
	 (compile-goto-error)))))

Seems like a no-brainer...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23987; Package emacs. (Fri, 22 Jul 2016 12:07:01 GMT) Full text and rfc822 format available.

Message #18 received at 23987 <at> debbugs.gnu.org (full text, mbox):

From: bvraghav <at> iitk.ac.in (B.V. Raghav)
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 23987 <at> debbugs.gnu.org
Subject: Re: bug#23987: 24.5; Icy with Ggtags Problem
Date: Fri, 22 Jul 2016 17:36:14 +0530
Drew Adams <drew.adams <at> oracle.com> writes:
[I have no knowledge about what was written here.]
>
> This is my suggestion, FWIW:
>
> (defun compilation-auto-jump (buffer pos)
>   (when (buffer-live-p buffer) ; <===========================
>     (with-current-buffer buffer
>       (goto-char pos)
>       (let ((win  (get-buffer-window buffer 0)))
>         (when win (set-window-point win pos)))
>       (when compilation-auto-jump-to-first-error
> 	 (compile-goto-error)))))
>
> Seems like a no-brainer...

This function did not help the use case, but a sanity check does not
seemingly harm. So I keep it as an override in my init.el.

Thanks,
r
-- 
(B.V. Raghav)
Ph.D. Student,
Design Programme, IIT Kanpur




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23987; Package emacs. (Fri, 22 Jul 2016 14:02:02 GMT) Full text and rfc822 format available.

Message #21 received at 23987 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: bvraghav <at> iitk.ac.in
Cc: 23987 <at> debbugs.gnu.org
Subject: RE: bug#23987: 24.5; Icy with Ggtags Problem
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)
    ...))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23987; Package emacs. (Fri, 22 Jul 2016 14:52:01 GMT) Full text and rfc822 format available.

Message #24 received at 23987 <at> debbugs.gnu.org (full text, mbox):

From: bvraghav <at> iitk.ac.in (B.V. Raghav)
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 23987 <at> debbugs.gnu.org
Subject: Re: bug#23987: 24.5; Icy with Ggtags Problem
Date: Fri, 22 Jul 2016 20:21:49 +0530
Drew Adams <drew.adams <at> oracle.com> writes:

>> > (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.
>
Yes, I had thought the same, when I had included this in the init.el, in
the end. Then I sent a print message, and it printed the message, but
that was all.

I had tried it with `emacs -Q',
  added ggtags, and icicles to the load path;
  copied the function to scratch buffer, and C-M-x

But the same result!

Now I am trying your suggestion, using the message instead of print.

(defun compilation-auto-jump (buffer pos)
  "Override suggested by Drew Adams bug#23987 <23987 <at> debbugs.gnu.org>"
  (message "Override for compilation-auto-jump called Buf:%s Pos:%s"
	   buffer pos)
  (when (buffer-live-p buffer) ; <=============
    (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)))))

Here is the output from the *Messages* buffer

> For information about GNU Emacs and the GNU system, type C-h C-a.
> Mark set
> Function icicle-repeat-complex-command is already compiled
> Quit [2 times]
> Making completion list...
> Ggtags mode enabled
> Global found 1 definition
> Override for compilation-auto-jump called Buf:*ggtags-global* Pos:208
> Quit
> Global found 4 references
> Override for compilation-auto-jump called Buf:*ggtags-global* Pos:230
> Global found 1 definition
> Override for compilation-auto-jump called Buf:*ggtags-global* Pos:223
> <backtab> is undefined
> Quit
> Turning OFF Icicle mode...done
> Turning ON Icicle mode...done
> Turning OFF Icicle mode...done
> Turning ON Icicle mode...done
> Turning ON Icicle mode...done
> Computing completion candidates...
> Quit
> Computing completion candidates...
> Global found 1 definition
> Override for compilation-auto-jump called Buf:#<killed buffer> Pos:229
> Computing completion candidates...
> Turning OFF Icicle mode...done
> Global found 1 definition
> Override for compilation-auto-jump called Buf:*ggtags-global* Pos:229

Ggtags works as expected, before icy-mode, but with icy-mode switched
on, the message flashes, saying called for a killed buffer. Then again
after switching off icy-mode, invoking ggtags, for the same definition.

Incidentally this happens only, for sole completions, for example,
func_foo_bar, has single occurence as definition, then this failure
happens. However for multiple completions, it works, seamlessly.

On top of it, when I override the call to
`ggtags-navigation-mode-cleanup' inside of `ggtags-global-handle-exit',
as follows:
(ggtags-navigation-mode-cleanup buf 0.25)
instead of `0'                     /^^^^\-----here

This function works for arbitrarily small numbers 0.006 etc. buf
sometimes also does fail.

There indeed is a jump to the definition, but a split window is left
open at the bottom. This probably is a ggtags affair.

Thanks,
HTH

-- 
(B.V. Raghav)
Ph.D. Student,
Design Programme, IIT Kanpur

Ph: +91-9450988137
Email: bvraghav <at> gmail.com




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 20 Aug 2016 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 249 days ago.

Previous Next


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