[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#27772: 25.2; Choosing tags files

From: Daniel Lopez
Subject: bug#27772: 25.2; Choosing tags files
Date: Thu, 20 Jul 2017 14:49:10 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

Having problems while trying to choose multiple tags tables, via tags-table-list, to apply to a specific buffer only by setting that variable in a buffer-local way:

Test case:

Prepare a couple of directories each with with a TAGS file:

### Bash code start ###

mkdir /tmp/emacs_tags_test
cd /tmp/emacs_tags_test

mkdir foo_files
cd foo_files
echo "const int foo_const = 1;" > foo.h
ctags -e foo.h
cd ..

mkdir bar_files
cd bar_files
echo "const int bar_const = 1;" > bar.h
ctags -e bar.h
cd ..

### Bash code end ###

Start emacs -Q and run the following to open a new file and set tags-table-list buffer-locally to reference both TAGS files:

### Elisp start ###

  (find-file "/tmp/emacs_tags_test/main.cpp")  ;;(this is a new file)

  (setq-local tags-table-list

### Elisp end ###

Do M-x xref-find-definitions. I get the prompt "Find definitions of:". I hit TAB hoping to get a list giving the choices of "foo_const" and "bar_const", but instead am prompted:

Visit tags table (default TAGS): /tmp/emacs_tags_test/bar_files/

I press Enter reluctantly to accept the default. I'm returned to the
"Find definitions of:" prompt, and "bar_const" is the sole completion
(no "foo_const" which I also wanted).

An aside: The global value of tags-file-name has now been set to
and the global value of tags-table-list has now been set to
while the local value of tags-table-list is unchanged from what I set it to:
("/tmp/emacs_tags_test/foo_files/TAGS" "/tmp/emacs_tags_test/bar_files/TAGS")

If I do another M-x xref-find-definitions now, I still get "bar_const"
as the sole completion (instead of the choice of two I wanted).

(End test case)

I made some incomplete investigations into visit-tags-table-buffer
where this seems to be implemented - I saw that at one point it seems to explicitly look up the local value of tags-file name:

  ;; First, try a local variable.
  (cdr (assq 'tags-file-name (buffer-local-variables)))

Inspired by that I tried changing the part below where it seems to get the value of tags-table-list:

  ;; Fifth, use the user variable giving the table list.
  ;; Find the first element of the list that actually exists.
  (let ((list tags-table-list)

to go explicitly via the (buffer-local-variables) alist as well:

(let ((list (or (cdr (assq 'tags-table-list (buffer-local-variables))) tags-table-list))

but it didn't seem to change the outcome of the above test case at all. The rest of that function seems a bit too complicated for me to delve into right now (and I admit I've worked around this for myself, for now, by setting before-advice on visit-tags-table-buffer to set the global value of tags-table-list to what I want every time).



In GNU Emacs 25.2.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.22.10)
 of 2017-04-22 built on juergen
Windowing system distributor 'The X.Org Foundation', version 11.0.11903000
Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-modules
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe
 -fstack-protector-strong' CPPFLAGS=-D_FORTIFY_SOURCE=2

Configured features:

Important settings:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: C++/l

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t

electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-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
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Recent messages:
("/tmp/emacs_tags_test/foo_files/TAGS" "/tmp/emacs_tags_test/bar_files/TAGS")
Making tags completion table for /tmp/emacs_tags_test/bar_files/TAGS...
Starting a new list of tags tables
Making tags completion table for /tmp/emacs_tags_test/bar_files/TAGS...done
Type C-x 1 to delete the help window.
Making completion list...

completing-read-default: Command attempted to use minibuffer while in minibuffer

Load-path shadows:
None found.

(shadow sort mail-extr emacsbug message dired format-spec rfc822 mml
mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils pp help-fns
thingatpt etags xref cl-seq project ring eieio byte-opt bytecomp
byte-compile cconv eieio-core cl-macs gv cl-extra help-mode cc-mode
cc-fonts easymenu cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs cl-loaddefs pcase cl-lib time-date mule-util tooltip
eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel 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 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 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
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 116530 3695)
 (symbols 48 23070 0)
 (miscs 40 53 111)
 (strings 32 23520 5093)
 (string-bytes 1 794931)
 (vectors 16 16526)
 (vector-slots 8 487720 4910)
 (floats 8 230 253)
 (intervals 56 297 7)
 (buffers 976 23))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]