unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#23164: 25.1.50; xref-find-definitions with local tags-file-name fails
@ 2016-03-30 20:52 Johan Claesson
  2016-04-04  1:29 ` Dmitry Gutov
  2016-11-22 18:49 ` Josiah Schwab
  0 siblings, 2 replies; 9+ messages in thread
From: Johan Claesson @ 2016-03-30 20:52 UTC (permalink / raw)
  To: 23164


Hi,

emacs -Q 

(fundamental-mode)
(setq-local tags-file-name "/dev/zero")
(xref-find-definitions "foo")

Fails with (wrong-type-argument stringp nil) in
visit-tags-table-buffer.

The problem also occurs when tags-file-name points to a valid TAGS
file (the invalid /dev/zero was chosen just to make the recipe
short).

If tags-file-name have a global value there is no problem. 

It is the following line in visit-tags-table-buffer that fails. 

  (setq tags-file-name (tags-expand-table-name tags-file-name))

If this is protected with (when tags-file-name ...) then the problem
do not occur.  The same if the line is moved down and inside the
unless sexp that follows immediately.  If either is the right thing to
do i don't know.  But it seem a bit strange to assume that
tags-file-name shall be non-nil at that point.  The problem occurs
when etags--xref-find-definitions calls visit-tags-table-buffer for
the second time.

Regards,

/Johan



In GNU Emacs 25.1.50.1 (x86_64-unknown-linux-gnu, X toolkit)
 of 2016-03-28 built on goblin
Repository revision: a30e7e12ed8465e2565dd318d921bc87f52ce18e
Windowing system distributor 'The X.Org Foundation', version 11.0.11702000
System Description:	Ubuntu 15.10

Configured using:
 'configure --prefix=/ssd/home/jcl/usr --with-x-toolkit=lucid
 --without-toolkit-scroll-bars --disable-silent-rules
 --without-compress-install --enable-link-time-optimization
 PKG_CONFIG_PATH=/home/jcl/usr/lib/pkgconfig'

Configured features:
XAW3D XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF
GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF
XFT ZLIB LUCID X11

Important settings:
  value of $LC_MONETARY: en_GB.UTF-8
  value of $LC_NUMERIC: en_GB.UTF-8
  value of $LC_TIME: en_GB.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=none
  locale-coding-system: utf-8-unix

Major mode: Text

Minor modes in effect:
  magit-auto-revert-mode: t
  display-time-mode: t
  minibuffer-depth-indicate-mode: t
  num3-mode: t
  minibuffer-electric-default-mode: t
  icomplete-mode: t
  diff-auto-refine-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-networks-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  shell-dirtrack-mode: t
  wc-mode: t
  winner-mode: t
  ido-everywhere: t
  which-function-mode: t
  global-eldoc-mode: t
  electric-layout-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  global-prettify-symbols-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  line-number-mode: t
  auto-fill-function: do-auto-fill
  transient-mark-mode: t
  abbrev-mode: t

Recent messages:
Saving file /home/jcl/.newsrc.eld...
Wrote /home/jcl/.newsrc.eld
Saving file /ssd/home/jcl/TAGS_REPORT...
Wrote /ssd/home/jcl/TAGS_REPORT
Preparing diary...done
Preparing diary...done
No event to add
Mark set [2 times]
Quit
Mark set

Load-path shadows:
None found.

Features:
(nnir emacsbug files-x tramp-cache gnus-dired apropos eieio-opt speedbar
sb-image ezimage dframe hippie-exp edmacro autoload lisp-mnt tabify
nndoc gnus-dup w3m-cookie jcl-replace jcl-games-init jcl-muse-init
htmlize-hack htmlize muse-latex muse-html muse-xml-common muse-colors
cus-edit muse-publish muse-project muse-protocols muse-regexps muse
muse-nested-tags muse-mode jcl-yaoddmuse-init yaoddmuse-extension
yaoddmuse skeleton sgml-mode shadow smiley gnus-cite flow-fill mail-extr
gnus-async linum pulse time-stamp cus-start cus-load tempo misearch
multi-isearch jcl-renegade-goblin jcl-home-boot vc vc-dispatcher vc-git
org-rmail org-mhe org-irc org-info org-gnus org-docview org-bibtex
bibtex org-bbdb org-w3m jcl-load jcl-billboard-init typing-practice
jcl-elisp-init profiler tagbag-init jcl-grep-init jcl-abbrev-init
jcl-ediff-init jcl-term-init jcl-erlang-init jcl-sbg jcl-erlang-log
bookmark jcl-erlang-man man jcl-midnite-init jcl-midnite midnight
jcl-picpocket-init picpocket-test jcl-erc-init jcl-ido-init
jcl-dired-init image-file wdired jcl-register-init
jcl-command-subset-init jcl-generic-init generic-x jcl-eww-init eww
url-queue shr svg dom jcl-org-init poporg ob-latex ox-beamer org-feed
org-capture jcl-shell-init jcl-haskell-init jcl-haskell-old inf-haskell
haskell-decl-scan haskell-mode haskell-cabal haskell-utils
haskell-font-lock haskell-indentation haskell-string
haskell-sort-imports haskell-lexeme haskell-align-imports haskell-compat
haskell-complete-module flymake dabbrev haskell-customize
jcl-mentor-init mentor xml-rpc url-scgi jcl-google-init jcl-modes-init
checkdoc magit-blame magit-stash magit-bisect magit-remote magit-commit
magit-sequence magit magit-apply magit-wip magit-log magit-diff
smerge-mode magit-core magit-autorevert magit-process magit-popup
magit-mode magit-git crm magit-section magit-utils calc calc-loaddefs
calc-macs jcl-rfc rfcview goto-addr proced nroff-mode table picture
python rx jcl-ruby inf-ruby ruby-mode fpl macrostep-c cmacexp cwarn grep
jcl-elpa-init ffap view jcl-global-init time printing mb-depth saveplace
num3-mode minibuf-eldef icomplete jcl-sl-init jcl-keys-init kmacro
diff-mode jcl-sbg-ssit jcl-google google-translate
google-translate-default-ui google-translate-core-ui
google-translate-core google-translate-tk jcl-imenu jcl-wesnoth
wesnoth-mode wesnoth-wml-data wesnoth-update jcl-erlang jcl-sbg-compile
jcl-picpocket jcl-goblin jcl-dired jcl-dired-lexical picpocket
fuzzy-match jcl-ediff jcl-elisp jcl-grep edebug jcl-stumpwm jcl-org
jcl-erc erc-list erc-menu erc-join erc-ring erc-networks erc-pcomplete
erc-track erc-match erc-button erc-fill erc-stamp erc-netsplit
erc-goodies erc erc-backend erc-compat jcl-vbox jcl-lxc jcl-keys
windmove jcl-debbugs-init debbugs-org debbugs-gnu debbugs soap-client
warnings rng-xsd rng-dt rng-util xsd-regexp jcl-isearch jcl-sbg-scan
tagbag sbg filecache jcl-bugfix loadhist git-commit help-fns with-editor
async-bytecomp async tramp-sh tramp tramp-compat tramp-loaddefs trampver
ucs-normalize shell log-edit pcvs-util add-log dash jcl-merge jcl-wip
jcl-work-buffer ediff-merg ediff-wind ediff-diff ediff-mult ediff-help
ediff-init ediff-util ediff jcl-sty jcl-epresent face-remap org-indent
epresent ox-latex ox-icalendar ox-html ox-ascii ox-publish ox
org-element avl-tree diet ps-print ps-print-loaddefs ps-def lpr
jcl-template jcl-copyright jcl-template-lib cperl-mode cc-mode cc-fonts
cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
erlang wc-mode jcl-register jcl-advice jcl-command-subset jcl-duff
clearcase reporter jcl-motion jcl-safe-init jcl-site-start jpt-mode
erlang-start qp gnus-ml gnus-topic cursor-sensor mm-archive
network-stream nsm url-http url-gw puny url-cache url-auth nnrss mm-url
nndraft nnmh nnfolder nnml jcl-master jcl-calendar-init jcl-emms-init
emms-playlist-limit emms-volume emms-volume-amixer emms-i18n
emms-history emms-score emms-stream-info emms-metaplaylist-mode
emms-bookmarks emms-cue emms-mode-line-icon emms-browser sort
emms-playlist-sort emms-last-played emms-player-xine emms-player-mpd tq
emms-streams emms-show-all emms-tag-editor emms-mark emms-cache
emms-info-ogginfo emms-info-mp3info emms-player-vlc emms-player-mplayer
jcl-emms emms-mode-line emms-librefm-stream emms-librefm-scrobbler
emms-playing-time emms-info later-do emms-playlist-mode
emms-source-playlist xml emms-setup emms-lyrics emms-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
emms-source-file locate emms-player-simple emms emms-compat
jcl-gnus-init jcl-gnus jcl-w3m-init jcl-term ange-ftp w3m-search
w3m-bookmark w3m-antenna w3m-rss jcl-org-import-icalendar jcl-status
jcl-buffer-init org-location-google-maps org-agenda google-maps
google-maps-static url-util google-maps-geocode google-maps-base json
map 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 ob-core ob-eval
org-compat org-macs org-loaddefs autorevert filenotify appt jcl-calendar
jcl-swedish-postfix quail holidays hol-loaddefs icalendar diary-lib
diary-loaddefs cal-menu calendar cal-loaddefs w3m doc-view jka-compr
image-mode timezone w3m-hist w3m-fb bookmark-w3m w3m-ems w3m-ccl ccl
w3m-favicon w3m-image w3m-proc w3m-util dired-aux dired-x gnus-agent
gnus-srvr gnus-score score-mode nnvirtual nntp gnus-cache gnus-msg
gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum gnus-group
gnus-undo gnus-start gnus-cloud nnimap nnmail mail-source tls gnutls
utf7 netrc nnoo parse-time gnus-spec gnus-int gnus-range gnus-win
mailcap starttls smtpmail sendmail message format-spec rfc822 mml
mml-sec epa derived epg mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader gnus nnheader gnus-util rmail
rmail-loaddefs rfc2047 rfc2045 ietf-drums mail-utils mm-util mail-prsvr
wid-edit jcl-boot jcl-slime-init slime-fancy slime-trace-dialog
slime-fontifying-fu slime-package-fu slime-references
slime-compiler-notes-tree slime-scratch slime-presentations bridge
slime-macrostep macrostep slime-mdot-fu slime-enclosing-context
slime-fuzzy slime-fancy-trace slime-fancy-inspector slime-c-p-c
slime-autodoc jcl-misc jcl-ert ispell find-lisp jcl-misc-lexical
whitespace winner jcl-windows jcl-buffer ido ert find-func ewoc debug
jcl-compile slime-editing-commands slime-repl slime-parse slime compile
etags xref project arc-mode archive-mode noutline outline easy-mmode pp
comint ansi-color hyperspec thingatpt browse-url jcl-face hi-lock dired
dired-loaddefs paren mic-paren which-func imenu hl-line jcl-times-init
jcl-early-init jcl-compat-init advice jcl-util seq subr-x jcl-times
server term disp-table ehelp ring sh-script smie executable
jcl-load-path tex-site eimp-autoloads gnugo-autoloads
ascii-art-to-unicode-autoloads htmlize-autoloads ipython-autoloads
list-utils-autoloads cl memory-usage-autoloads muse-autoloads
num3-mode-autoloads finder-inf python-autoloads slime-autoloads info
package epg-config url-handlers url-parse auth-source cl-seq eieio
byte-opt bytecomp byte-compile cl-extra help-mode easymenu cconv
eieio-core cl-macs gv eieio-loaddefs cl-loaddefs pcase cl-lib
password-cache url-vars time-date mule-util tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded 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 dbusbind inotify dynamic-setting
system-font-setting font-render-setting x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 2323635 324305)
 (symbols 48 95458 0)
 (miscs 40 4764 9552)
 (strings 32 440421 52479)
 (string-bytes 1 13760818)
 (vectors 16 134524)
 (vector-slots 8 2805790 70429)
 (floats 8 2555 2826)
 (intervals 56 168636 14751)
 (buffers 976 129)
 (heap 1024 200613 154140))





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#23164: 25.1.50; xref-find-definitions with local tags-file-name fails
  2016-03-30 20:52 bug#23164: 25.1.50; xref-find-definitions with local tags-file-name fails Johan Claesson
@ 2016-04-04  1:29 ` Dmitry Gutov
  2016-04-04  1:52   ` Óscar Fuentes
  2016-11-22 18:49 ` Josiah Schwab
  1 sibling, 1 reply; 9+ messages in thread
From: Dmitry Gutov @ 2016-04-04  1:29 UTC (permalink / raw)
  To: Johan Claesson, 23164

Hi there!

On 03/30/2016 11:52 PM, Johan Claesson wrote:

> emacs -Q
>
> (fundamental-mode)
> (setq-local tags-file-name "/dev/zero")
> (xref-find-definitions "foo")
>
> Fails with (wrong-type-argument stringp nil) in
> visit-tags-table-buffer.

I do see the error with tags-file-name set to /dev/zero.

> The problem also occurs when tags-file-name points to a valid TAGS
> file (the invalid /dev/zero was chosen just to make the recipe
> short).

Thanks for the report, but that doesn't seem to be the case here. At 
least if I replace "/dev/zero" with "~/vc/emacs/src/TAGS", the scenario 
doesn't lead to an error (I just get "not found"), and if I also use 
e.g. "CALLN" instead of "foo", the jump to the destination occurs as 
expected.

To be 100% sure we're trying the same code, could you build Emacs from 
the branch emacs-25? Is there anything else you can tell us to help 
reproduce the problem?

> If tags-file-name have a global value there is no problem.
>
> It is the following line in visit-tags-table-buffer that fails.
>
>   (setq tags-file-name (tags-expand-table-name tags-file-name))
>
> If this is protected with (when tags-file-name ...) then the problem
> do not occur.  The same if the line is moved down and inside the
> unless sexp that follows immediately.  If either is the right thing to
> do i don't know.  But it seem a bit strange to assume that
> tags-file-name shall be non-nil at that point.

The preceding form tries to make sure to set it to the current value. 
Depending on the value of CONT, it will ask the user, use the current 
value, or delegate to some guessing logic. It's not 100% solid, though.

> The problem occurs
> when etags--xref-find-definitions calls visit-tags-table-buffer for
> the second time.

The assumption here is that the second time visit-tags-table-buffer is 
called from the tags file buffer. And that the previous invocation 
either set tags-file-name locally in that buffer, or at least set 
tags-table-list.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#23164: 25.1.50; xref-find-definitions with local tags-file-name fails
  2016-04-04  1:29 ` Dmitry Gutov
@ 2016-04-04  1:52   ` Óscar Fuentes
  2016-04-04  8:53     ` Johan Claesson
  2016-04-04 21:14     ` Johan Claesson
  0 siblings, 2 replies; 9+ messages in thread
From: Óscar Fuentes @ 2016-04-04  1:52 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 23164

Dmitry Gutov <dgutov@yandex.ru> writes:

> Thanks for the report, but that doesn't seem to be the case here. At
> least if I replace "/dev/zero" with "~/vc/emacs/src/TAGS", the
> scenario doesn't lead to an error (I just get "not found"), and if I
> also use e.g. "CALLN" instead of "foo", the jump to the destination
> occurs as expected.

I can reproduce it here with an existing TAGS file, on emacs -Q.

GNU Emacs 25.0.92.3 (x86_64-unknown-linux-gnu, X toolkit) of 2016-04-03

at commit fc3cd53900eb5e80b91b6d2615b3800fd2f59c16

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  expand-file-name(nil)
  tags-expand-table-name(nil)
  visit-tags-table-buffer(t)
  etags--xref-find-definitions("foo")
  #[514 "\300!\207" [etags--xref-find-definitions] 4 "\n\n(fn BACKEND SYMBOL)"](etags "foo")
  apply(#[514 "\300!\207" [etags--xref-find-definitions] 4 "\n\n(fn BACKEND SYMBOL)"] etags "foo")
  xref-backend-definitions(etags "foo")
  xref--find-xrefs("foo" definitions "foo" nil)
  xref--find-definitions("foo" nil)
  xref-find-definitions("foo")
  eval((xref-find-definitions "foo") nil)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#23164: 25.1.50; xref-find-definitions with local tags-file-name fails
  2016-04-04  1:52   ` Óscar Fuentes
@ 2016-04-04  8:53     ` Johan Claesson
  2016-04-04 21:14     ` Johan Claesson
  1 sibling, 0 replies; 9+ messages in thread
From: Johan Claesson @ 2016-04-04  8:53 UTC (permalink / raw)
  To: Óscar Fuentes; +Cc: Dmitry Gutov, 23164



I can also reproduce it on emacs-25 (commit f501116).
With valid TAGS file or /dev/zero.
I get the same backtrace.

Regards,

/Johan

Óscar Fuentes <ofv@wanadoo.es> writes:

> Dmitry Gutov <dgutov@yandex.ru> writes:
>
>> Thanks for the report, but that doesn't seem to be the case here. At
>> least if I replace "/dev/zero" with "~/vc/emacs/src/TAGS", the
>> scenario doesn't lead to an error (I just get "not found"), and if I
>> also use e.g. "CALLN" instead of "foo", the jump to the destination
>> occurs as expected.
>
> I can reproduce it here with an existing TAGS file, on emacs -Q.
>
> GNU Emacs 25.0.92.3 (x86_64-unknown-linux-gnu, X toolkit) of 2016-04-03
>
> at commit fc3cd53900eb5e80b91b6d2615b3800fd2f59c16
>
> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>   expand-file-name(nil)
>   tags-expand-table-name(nil)
>   visit-tags-table-buffer(t)
>   etags--xref-find-definitions("foo")
>   #[514 "\300!\207" [etags--xref-find-definitions] 4 "\n\n(fn BACKEND SYMBOL)"](etags "foo")
>   apply(#[514 "\300!\207" [etags--xref-find-definitions] 4 "\n\n(fn BACKEND SYMBOL)"] etags "foo")
>   xref-backend-definitions(etags "foo")
>   xref--find-xrefs("foo" definitions "foo" nil)
>   xref--find-definitions("foo" nil)
>   xref-find-definitions("foo")
>   eval((xref-find-definitions "foo") nil)
>   elisp--eval-last-sexp(nil)
>   eval-last-sexp(nil)
>   funcall-interactively(eval-last-sexp nil)
>   call-interactively(eval-last-sexp nil nil)
>   command-execute(eval-last-sexp)





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#23164: 25.1.50; xref-find-definitions with local tags-file-name fails
  2016-04-04  1:52   ` Óscar Fuentes
  2016-04-04  8:53     ` Johan Claesson
@ 2016-04-04 21:14     ` Johan Claesson
  2016-04-04 21:24       ` Johan Claesson
  1 sibling, 1 reply; 9+ messages in thread
From: Johan Claesson @ 2016-04-04 21:14 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Óscar Fuentes, 23164



Hi again,

I tried again this time with the TAGS of Emacs itself (emacs/src/TAGS).
And like you have already established the problem does not occur in this
scenario.  It does occur with other valid TAGS files, though.  

After a little bit of tracing i think the difference that matters is
that emacs/src/TAGS includes two other TAGS file in the very last lines:

\f
../lisp/TAGS,include
\f
../lwlib/TAGS,include

I was not aware of this feature with TAGS files including other TAGS
files before but after invoking xref-find-definitions emacs is visiting
all 3 TAGS files (src/TAGS, lisp/TAGS and lwlib/TAGS).  And
xref-find-definitions loops through them all.

If these last lines in emacs/src/TAGS are deleted the problem occurs.

It also occur with other simple TAGS files that do not include other
TAGS files.  And the TAGS file i was using when observing the problem
the first time was this kind of simple TAGS file.

Same in master and emacs-25.

Regards,

/Johan




Óscar Fuentes <ofv@wanadoo.es> writes:

> Dmitry Gutov <dgutov@yandex.ru> writes:
>
>> Thanks for the report, but that doesn't seem to be the case here. At
>> least if I replace "/dev/zero" with "~/vc/emacs/src/TAGS", the
>> scenario doesn't lead to an error (I just get "not found"), and if I
>> also use e.g. "CALLN" instead of "foo", the jump to the destination
>> occurs as expected.
>
> I can reproduce it here with an existing TAGS file, on emacs -Q.
>
> GNU Emacs 25.0.92.3 (x86_64-unknown-linux-gnu, X toolkit) of 2016-04-03
>
> at commit fc3cd53900eb5e80b91b6d2615b3800fd2f59c16
>
> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>   expand-file-name(nil)
>   tags-expand-table-name(nil)
>   visit-tags-table-buffer(t)
>   etags--xref-find-definitions("foo")
>   #[514 "\300!\207" [etags--xref-find-definitions] 4 "\n\n(fn BACKEND SYMBOL)"](etags "foo")
>   apply(#[514 "\300!\207" [etags--xref-find-definitions] 4 "\n\n(fn BACKEND SYMBOL)"] etags "foo")
>   xref-backend-definitions(etags "foo")
>   xref--find-xrefs("foo" definitions "foo" nil)
>   xref--find-definitions("foo" nil)
>   xref-find-definitions("foo")
>   eval((xref-find-definitions "foo") nil)
>   elisp--eval-last-sexp(nil)
>   eval-last-sexp(nil)
>   funcall-interactively(eval-last-sexp nil)
>   call-interactively(eval-last-sexp nil nil)
>   command-execute(eval-last-sexp)





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#23164: 25.1.50; xref-find-definitions with local tags-file-name fails
  2016-04-04 21:14     ` Johan Claesson
@ 2016-04-04 21:24       ` Johan Claesson
  2016-04-07  3:15         ` Dmitry Gutov
  0 siblings, 1 reply; 9+ messages in thread
From: Johan Claesson @ 2016-04-04 21:24 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Óscar Fuentes, 23164



Ooops, i see that the formatting of my last email got messed up because 
it includes some form-feeds (^L).  Here is the same message again
without evil form-feeds :)

Hi again,

I tried again this time with the TAGS of Emacs itself (emacs/src/TAGS).
And like you have already established the problem does not occur in this
scenario.  It does occur with other valid TAGS files, though.  

After a little bit of tracing i think the difference that matters is
that emacs/src/TAGS includes two other TAGS file in the very last lines:

^L
../lisp/TAGS,include
^L
../lwlib/TAGS,include

I was not aware of this feature with TAGS files including other TAGS
files before but after invoking xref-find-definitions emacs is visiting
all 3 TAGS files (src/TAGS, lisp/TAGS and lwlib/TAGS).  And
xref-find-definitions loops through them all.

If these last lines in emacs/src/TAGS are deleted the problem occurs.

It also occur with other simple TAGS files that do not include other
TAGS files.  And the TAGS file i was using when observing the problem
the first time was this kind of simple TAGS file.

Same in master and emacs-25.

Regards,

/Johan



> Óscar Fuentes <ofv@wanadoo.es> writes:
>
>> Dmitry Gutov <dgutov@yandex.ru> writes:
>>
>>> Thanks for the report, but that doesn't seem to be the case here. At
>>> least if I replace "/dev/zero" with "~/vc/emacs/src/TAGS", the
>>> scenario doesn't lead to an error (I just get "not found"), and if I
>>> also use e.g. "CALLN" instead of "foo", the jump to the destination
>>> occurs as expected.
>>
>> I can reproduce it here with an existing TAGS file, on emacs -Q.
>>
>> GNU Emacs 25.0.92.3 (x86_64-unknown-linux-gnu, X toolkit) of 2016-04-03
>>
>> at commit fc3cd53900eb5e80b91b6d2615b3800fd2f59c16
>>
>> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>>   expand-file-name(nil)
>>   tags-expand-table-name(nil)
>>   visit-tags-table-buffer(t)
>>   etags--xref-find-definitions("foo")
>>   #[514 "\300!\207" [etags--xref-find-definitions] 4 "\n\n(fn BACKEND SYMBOL)"](etags "foo")
>>   apply(#[514 "\300!\207" [etags--xref-find-definitions] 4 "\n\n(fn BACKEND SYMBOL)"] etags "foo")
>>   xref-backend-definitions(etags "foo")
>>   xref--find-xrefs("foo" definitions "foo" nil)
>>   xref--find-definitions("foo" nil)
>>   xref-find-definitions("foo")
>>   eval((xref-find-definitions "foo") nil)
>>   elisp--eval-last-sexp(nil)
>>   eval-last-sexp(nil)
>>   funcall-interactively(eval-last-sexp nil)
>>   call-interactively(eval-last-sexp nil nil)
>>   command-execute(eval-last-sexp)





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#23164: 25.1.50; xref-find-definitions with local tags-file-name fails
  2016-04-04 21:24       ` Johan Claesson
@ 2016-04-07  3:15         ` Dmitry Gutov
  2016-04-09 15:00           ` Johan Claesson
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Gutov @ 2016-04-07  3:15 UTC (permalink / raw)
  To: Johan Claesson; +Cc: Óscar Fuentes, 23164

On 04/05/2016 12:24 AM, Johan Claesson wrote:

> It also occur with other simple TAGS files that do not include other
> TAGS files.  And the TAGS file i was using when observing the problem
> the first time was this kind of simple TAGS file.

Right, thank you.

Apparently, the long-standing way to make it work is to call 
visit-tags-table with non-nil second argument, instead of just using 
setq-local. So, this seems to work correctly:

(fundamental-mode)
(visit-tags-table "~/examples/ruby/TAGS" t)
(xref-find-definitions "a")

It performs more work in advance, though, and I'm not sure what's the 
big picture with keeping variables like tags-table-list global anyway.

Here's a patch you can try that makes etags--xref-find-definitions work 
with your original scenario, but I'm not 100% sure it's good code. The 
proper solution to setting tags-file-name locally probably looks different.

diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index a2a0df2..856d26b 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -2111,6 +2111,7 @@ etags--xref-find-definitions
                                 tags-case-fold-search
                               case-fold-search)))
      (save-excursion
+      (visit-tags-table-buffer) ; Workaround for bug#23164
        (while (visit-tags-table-buffer (not first-time))
          (setq first-time nil)
          (dolist (order-fun (cond (regexp? find-tag-regexp-tag-order)






^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#23164: 25.1.50; xref-find-definitions with local tags-file-name fails
  2016-04-07  3:15         ` Dmitry Gutov
@ 2016-04-09 15:00           ` Johan Claesson
  0 siblings, 0 replies; 9+ messages in thread
From: Johan Claesson @ 2016-04-09 15:00 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Óscar Fuentes, 23164






Dmitry Gutov <dgutov@yandex.ru> writes:
>
> (fundamental-mode)
> (visit-tags-table "~/examples/ruby/TAGS" t)
> (xref-find-definitions "a")

This does not work for me.  I run into the same error.  

> Here's a patch you can try that makes etags--xref-find-definitions
> work with your original scenario, but I'm not 100% sure it's good
> code. The proper solution to setting tags-file-name locally probably
> looks different.

Thanks, this patch works perfectly as far as i can see. 

Regards,

/Johan






^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#23164: 25.1.50; xref-find-definitions with local tags-file-name fails
  2016-03-30 20:52 bug#23164: 25.1.50; xref-find-definitions with local tags-file-name fails Johan Claesson
  2016-04-04  1:29 ` Dmitry Gutov
@ 2016-11-22 18:49 ` Josiah Schwab
  1 sibling, 0 replies; 9+ messages in thread
From: Josiah Schwab @ 2016-11-22 18:49 UTC (permalink / raw)
  To: 23164; +Cc: ofv, dgutov

Hello,

I receive an error from commands like the original bug

> (setq-local tags-file-name "fruits/TAGS")
> (xref-find-definitions "apple")

and the proposed workaround

> (visit-tags-table "fruits/TAGS" t)
> (xref-find-definitions "apple")

under emacs 25.1 and git master (at c542fab).

I used a trivial TAGS file, available from

  https://github.com/jschwab/emacs-tags-issues/blob/master/fruits/TAGS

but any simple tags file (that doesn't include other TAGS files; see
earlier in this thread) ought to work.

Josiah





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-11-22 18:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-30 20:52 bug#23164: 25.1.50; xref-find-definitions with local tags-file-name fails Johan Claesson
2016-04-04  1:29 ` Dmitry Gutov
2016-04-04  1:52   ` Óscar Fuentes
2016-04-04  8:53     ` Johan Claesson
2016-04-04 21:14     ` Johan Claesson
2016-04-04 21:24       ` Johan Claesson
2016-04-07  3:15         ` Dmitry Gutov
2016-04-09 15:00           ` Johan Claesson
2016-11-22 18:49 ` Josiah Schwab

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).