Subject: bug#17326: 24.3.90; find-tag sets global value of tags-file-name

From: Jarvis Schultz <[email-masked]>
Date: Wed, 23 Apr 2014 08:41:16 -0500

Steps to reproduce:
 - Open emacs with `emacs -Q'
 - Open source file in a directory with an already-generated TAGS file
 - Set tags-file-name locally using 'C-u M-x visit-tags-table' and
 selecting local TAGS
 - Use 'C-h v tags-file-name' to view value, and it says you have a
 buffer-local value set to the TAGS file just visited, and global value
 is nil
 - Run find-tag with 'M-.', using TAB brings up correct list of tags,
 and everthing is great
 - Re-check value of tags-file-name using 'C-h v tags-file-name', and
 see that the global value is now the same as the local value

This causes huge problems when trying to have different tags tables
associated with different buffers. Because it seems that once the global
value is set, further use of find-tag does not overwrite its value, but
its global value takes precedence over the local value. The only way I
have been able to get around this is by explicitly setting
tags-file-name and tags-table-list in .dir-local.el files in every
directory that contains a TAGS table.

Also note the documentation explicitly says to not set both
tags-file-name and tags-table-list, but using interactive function
visit-tags-table ends up setting both anyway. I have experienced this
bug both in git build of emacs 24.3.90.1 listed below and in the
following build from a PPA:

  GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.4.2) of 2014-02-22
  on king, modified by Debian

In GNU Emacs 24.3.90.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10)
 of 2014-04-22 on newton
Windowing system distributor `The X.Org Foundation', version 11.0.11300000
System Description: Ubuntu 12.04.4 LTS

Configured using:
 `configure --without-makeinfo'

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

Major mode: C/l

Minor modes in effect:
  tooltip-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 input:
C-x C-f <M-backspace> <M-backspace> f <tab> <M-backspace>
a l <tab> f <tab> <return> M-x t a g <backspace> <backspace>
<backspace> C-g C-u M-x v i s i t - t a g s <tab> <return>
<return> C-h v t a g s - f <tab> <return> M-. s t o
p _ a l l _ m o <tab> <return> M-* C-h v M-p M-p <return>
<help-echo> <down-mouse-2> <mouse-1> <help-echo> <down-mouse-1>
<mouse-1> q <down-mouse-1> <mouse-1> M-x r e p o r
t <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Quit
Starting a new list of tags tables
Type C-x 1 to delete the help window.
Making tags completion table for
/home/jarvis/Desktop/aluminum_puppeteer/TAGS...done
Mark set
 [2 times]

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message cl-macs gv format-spec
rfc822 mml mml-sec 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-mode help-fns etags ring vc-git
cc-langs cl cl-loaddefs cl-lib cc-mode cc-fonts easymenu cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs time-date
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 system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 110255 6347)
 (symbols 48 20801 0)
 (miscs 40 54 210)
 (strings 32 19268 4385)
 (string-bytes 1 626660)
 (vectors 16 12190)
 (vector-slots 8 407628 5169)
 (floats 8 65 216)
 (intervals 56 529 16)
 (buffers 960 14)
 (heap 1024 45108 661))