GNU bug report logs - #21443
24.5; etags' complete-tag changes the global value of tags-file-name

Previous Next

Package: emacs;

Reported by: HuangMario <guiyang.huang <at> me.com>

Date: Wed, 9 Sep 2015 15:40:02 UTC

Severity: normal

Merged with 17326

Found in versions 24.3.90, 24.5

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 21443 in the body.
You can then email your comments to 21443 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#21443; Package emacs. (Wed, 09 Sep 2015 15:40:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to HuangMario <guiyang.huang <at> me.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 09 Sep 2015 15:40:02 GMT) Full text and rfc822 format available.

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

From: HuangMario <guiyang.huang <at> me.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.5; etags' complete-tag changes the global value of tags-file-name
Date: Wed, 09 Sep 2015 21:18:04 +0800
I'm using etags and found that:

Step 0. Set the 'tags-file-name' as buffer local to a specified TAGS file, and the global value is nil.

Step 1. Press M-. to find tags.

Step 2. Input some characters in the mini-buffer and press the TAB key for completion, then the mini-buffer will display "Making tags completion table for ...done".

After that, the global value of 'tags-file-name' is set to the same as its local value.

How can I keep the global value nil ?



In GNU Emacs 24.5.1 (x86_64-apple-darwin13.4.0, NS apple-appkit-1265.21)
of 2015-04-11 on builder10-9.porkrind.org
Windowing system distributor `Apple', version 10.3.1348
Configured using:
`configure --with-ns '--enable-locallisppath=/Library/Application
Support/Emacs/${version}/site-lisp:/Library/Application
Support/Emacs/site-lisp''

Important settings:
  locale-coding-system: utf-8-unix

Major mode: C/l

Minor modes in effect:
  etags-update-minor-mode: t
  irony-mode: t
  global-company-mode: t
  company-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  global-auto-revert-mode: t
  show-paren-mode: t
  global-linum-mode: t
  linum-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-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
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Recent messages:
Undo! [3 times]
Saving file /Users/mario/Documents/mcc/decl.c...
Wrote /Users/mario/Documents/mcc/decl.c
(No files need saving)
Compilation finished
Mark set
Saving file /Users/mario/Documents/mcc/decl.c...
Wrote /Users/mario/Documents/mcc/decl.c
(No files need saving)
Compilation finished

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message cl-macs 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 help-fns mail-prsvr mail-utils compile comint ansi-color
lisp-mnt irony-cdb-clang-complete irony-cdb vc-git cc-langs cc-mode
cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs etags-update company-files company-oddmuse company-keywords
company-etags etags ring company-gtags company-dabbrev-code
company-dabbrev company-capf company-cmake company-xcode company-clang
company-semantic company-eclim company-template company-css company-nxml
company-bbdb company-irony irony-completion irony-snippet
company-irony-c-headers irony find-func company cl-extra yasnippet
help-mode easymenu cl gv package epg-config leuven-theme edmacro kmacro
cl-loaddefs cl-lib autorevert filenotify paren linum time-date tooltip
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel ns-win
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
cocoa ns multi-tty emacs)

Memory information:
((conses 16 198579 14210)
(symbols 48 27156 0)
(miscs 40 386 764)
(strings 32 44533 8694)
(string-bytes 1 1199266)
(vectors 16 19605)
(vector-slots 8 545370 14451)
(floats 8 484 293)
(intervals 56 2046 340)
(buffers 960 18))




Merged 17326 21443. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 09 Sep 2015 16:40:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21443; Package emacs. (Thu, 10 Sep 2015 19:07:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: HuangMario <guiyang.huang <at> me.com>
Cc: 21443 <at> debbugs.gnu.org
Subject: Re: bug#21443: 24.5;
 etags' complete-tag changes the global value of tags-file-name
Date: Thu, 10 Sep 2015 22:06:03 +0300
> From: HuangMario <guiyang.huang <at> me.com>
> Date: Wed, 09 Sep 2015 21:18:04 +0800
> 
> Step 0. Set the 'tags-file-name' as buffer local to a specified TAGS file, and the global value is nil.
> 
> Step 1. Press M-. to find tags.
> 
> Step 2. Input some characters in the mini-buffer and press the TAB key for completion, then the mini-buffer will display "Making tags completion table for ...done".
> 
> After that, the global value of 'tags-file-name' is set to the same as its local value.
> 
> How can I keep the global value nil ?

According to this doc string:

  (defun visit-tags-table (file &optional local)
    "Tell tags commands to use tags table file FILE.
  FILE should be the name of a file created with the `etags' program.
  A directory name is ok too; it means file TAGS in that directory.

  Normally \\[visit-tags-table] sets the global value of `tags-file-name'.
  With a prefix arg, set the buffer-local value instead.

you are supposed to invoke visit-tags-table manually with a numeric
argument, if you want the local value of tags-file-name set.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21443; Package emacs. (Fri, 11 Sep 2015 00:32:02 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Eli Zaretskii <eliz <at> gnu.org>, HuangMario <guiyang.huang <at> me.com>
Cc: 21443 <at> debbugs.gnu.org
Subject: Re: bug#21443: 24.5; etags' complete-tag changes the global value of
 tags-file-name
Date: Fri, 11 Sep 2015 03:30:48 +0300
On 09/10/2015 10:06 PM, Eli Zaretskii wrote:

> you are supposed to invoke visit-tags-table manually with a numeric
> argument, if you want the local value of tags-file-name set.

Some users prefer to set tags-table-name programmatically.

It appears the problem is that etags--xref-find-definitions calls 
visit-tags-table-buffer unconditionally, and the latter doesn't honor 
the buffer-local value of this variable.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21443; Package emacs. (Fri, 11 Sep 2015 04:57:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 21443 <at> debbugs.gnu.org, guiyang.huang <at> me.com
Subject: Re: bug#21443: 24.5;
 etags' complete-tag changes the global value of tags-file-name
Date: Fri, 11 Sep 2015 07:56:44 +0300
> Cc: 21443 <at> debbugs.gnu.org
> From: Dmitry Gutov <dgutov <at> yandex.ru>
> Date: Fri, 11 Sep 2015 03:30:48 +0300
> 
> On 09/10/2015 10:06 PM, Eli Zaretskii wrote:
> 
> > you are supposed to invoke visit-tags-table manually with a numeric
> > argument, if you want the local value of tags-file-name set.
> 
> Some users prefer to set tags-table-name programmatically.
> 
> It appears the problem is that etags--xref-find-definitions calls 
> visit-tags-table-buffer unconditionally, and the latter doesn't honor 
> the buffer-local value of this variable.

The OP was talking about Emacs 24.5; there's no xref there AFAIK.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21443; Package emacs. (Fri, 11 Sep 2015 06:58:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: HGY <mohu3g <at> 163.com>
Cc: 21443 <at> debbugs.gnu.org
Subject: Re: bug#21443: 24.5;
 etags' complete-tag changes the global value of tags-file-name
Date: Fri, 11 Sep 2015 09:57:44 +0300
> Date: Fri, 11 Sep 2015 14:09:53 +0800 (CST)
> From: HGY <mohu3g <at> 163.com>
> 
> As you say, how can I inhiit the mini-buffer completion to invoke
> 'visit-tags-table' with no prefix arg in step 2 ?

You can't, currently.  You need to invoke visit-tags-table manually,
with a prefix argument, before the mini-buffer completion.  This is
how the code was designed.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21443; Package emacs. (Fri, 11 Sep 2015 14:00:08 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 21443 <at> debbugs.gnu.org, guiyang.huang <at> me.com
Subject: Re: bug#21443: 24.5; etags' complete-tag changes the global value of
 tags-file-name
Date: Fri, 11 Sep 2015 16:59:22 +0300
On 09/11/2015 07:56 AM, Eli Zaretskii wrote:

> The OP was talking about Emacs 24.5; there's no xref there AFAIK.

Right, sorry, there's no xref there.

But the scenario is similar: tags-completion-table calls 
visit-tags-table-buffer, and the latter doesn't honor buffer-local values.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21443; Package emacs. (Wed, 16 Sep 2015 03:55:01 GMT) Full text and rfc822 format available.

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

From: HGY <mohu3g <at> 163.com>
To: "Dmitry Gutov" <dgutov <at> yandex.ru>
Cc: 21443 <21443 <at> debbugs.gnu.org>, Eli Zaretskii <eliz <at> gnu.org>,
 "guiyang.huang" <guiyang.huang <at> me.com>
Subject: Re:bug#21443: 24.5; etags' complete-tag changes the global value of
 tags-file-name
Date: Wed, 16 Sep 2015 10:33:00 +0800 (CST)
[Message part 1 (text/plain, inline)]
Yeah, I think so.


Best Regards.

Guiyang Huang






在2015年09月11 21时59分, "Dmitry Gutov"<dgutov <at> yandex.ru>写道:

On 09/11/2015 07:56 AM, Eli Zaretskii wrote:

> The OP was talking about Emacs 24.5; there's no xref there AFAIK.

Right, sorry, there's no xref there.

But the scenario is similar: tags-completion-table calls
visit-tags-table-buffer, and the latter doesn't honor buffer-local values.



[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21443; Package emacs. (Mon, 23 Nov 2015 22:04:02 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Eli Zaretskii <eliz <at> gnu.org>, HGY <mohu3g <at> 163.com>
Cc: 21443 <at> debbugs.gnu.org
Subject: Re: bug#21443: 24.5; etags' complete-tag changes the global value of
 tags-file-name
Date: Tue, 24 Nov 2015 00:03:12 +0200
On 09/11/2015 09:57 AM, Eli Zaretskii wrote:

> You can't, currently.  You need to invoke visit-tags-table manually,
> with a prefix argument, before the mini-buffer completion.  This is
> how the code was designed.

Unfortunately, this is also broken: you can C-u M-x visit-tags-table, 
and it will set the local value of tags-file-name, but as soon as you 
M-x find-tag, it changes the global value of tags-file-name as well, to 
the last element in tags-table-list.

Apparently because the lambda in tags-lazy-completion-table calls 
visit-tags-table-buffer at least twice, and the latter function modifies 
tags-file-name, _and_ changes the current buffer (and when called the 
second time, it changes tags-file-name in the tags table buffer, thus 
changing the global value).

And I can't simply wrap most of the second half of 
visit-tags-table-buffer in a with-current-buffer, because some code 
assumes that the buffer does indeed change. Otherwise, the value of 
tags-completion-table-function is nil (tags-completion-table calls it 
after calling visit-tags-table-buffer).

Modifications of tags-file-name are also numerous, so changing a couple 
of setq to setq-local inside visit-tags-table-buffer doesn't do the 
trick either.

At this point I'm leaving this to someone else who's more motivated. But 
we'll likely already migrate to e.g. GNU Global before that happens.




bug closed, send any further explanations to 17326 <at> debbugs.gnu.org and Jarvis Schultz <schultzjarvis <at> gmail.com> Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 01 Dec 2016 16:55:02 GMT) Full text and rfc822 format available.

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

This bug report was last modified 8 years and 172 days ago.

Previous Next


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