unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#21443: 24.5; etags' complete-tag changes the global value of tags-file-name
@ 2015-09-09 13:18 HuangMario
  2015-09-10 19:06 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: HuangMario @ 2015-09-09 13:18 UTC (permalink / raw)
  To: 21443


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))





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

* bug#21443: 24.5; etags' complete-tag changes the global value of tags-file-name
  2015-09-09 13:18 bug#21443: 24.5; etags' complete-tag changes the global value of tags-file-name HuangMario
@ 2015-09-10 19:06 ` Eli Zaretskii
  2015-09-11  0:30   ` Dmitry Gutov
       [not found]   ` <4b3df5cb.21a.14fbb06425d.Coremail.mohu3g@163.com>
  0 siblings, 2 replies; 8+ messages in thread
From: Eli Zaretskii @ 2015-09-10 19:06 UTC (permalink / raw)
  To: HuangMario; +Cc: 21443

> From: HuangMario <guiyang.huang@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.





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

* bug#21443: 24.5; etags' complete-tag changes the global value of tags-file-name
  2015-09-10 19:06 ` Eli Zaretskii
@ 2015-09-11  0:30   ` Dmitry Gutov
  2015-09-11  4:56     ` Eli Zaretskii
       [not found]   ` <4b3df5cb.21a.14fbb06425d.Coremail.mohu3g@163.com>
  1 sibling, 1 reply; 8+ messages in thread
From: Dmitry Gutov @ 2015-09-11  0:30 UTC (permalink / raw)
  To: Eli Zaretskii, HuangMario; +Cc: 21443

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.






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

* bug#21443: 24.5; etags' complete-tag changes the global value of tags-file-name
  2015-09-11  0:30   ` Dmitry Gutov
@ 2015-09-11  4:56     ` Eli Zaretskii
  2015-09-11 13:59       ` Dmitry Gutov
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2015-09-11  4:56 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 21443, guiyang.huang

> Cc: 21443@debbugs.gnu.org
> From: Dmitry Gutov <dgutov@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.





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

* bug#21443: 24.5; etags' complete-tag changes the global value of tags-file-name
       [not found]   ` <4b3df5cb.21a.14fbb06425d.Coremail.mohu3g@163.com>
@ 2015-09-11  6:57     ` Eli Zaretskii
  2015-11-23 22:03       ` Dmitry Gutov
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2015-09-11  6:57 UTC (permalink / raw)
  To: HGY; +Cc: 21443

> Date: Fri, 11 Sep 2015 14:09:53 +0800 (CST)
> From: HGY <mohu3g@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.





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

* bug#21443: 24.5; etags' complete-tag changes the global value of tags-file-name
  2015-09-11  4:56     ` Eli Zaretskii
@ 2015-09-11 13:59       ` Dmitry Gutov
  2015-09-16  2:33         ` HGY
  0 siblings, 1 reply; 8+ messages in thread
From: Dmitry Gutov @ 2015-09-11 13:59 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 21443, guiyang.huang

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.





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

* bug#21443: 24.5; etags' complete-tag changes the global value of tags-file-name
  2015-09-11 13:59       ` Dmitry Gutov
@ 2015-09-16  2:33         ` HGY
  0 siblings, 0 replies; 8+ messages in thread
From: HGY @ 2015-09-16  2:33 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 21443, guiyang.huang

[-- Attachment #1: Type: text/plain, Size: 407 bytes --]

Yeah, I think so.


Best Regards.

Guiyang Huang






在2015年09月11 21时59分, "Dmitry Gutov"<dgutov@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.




[-- Attachment #2: Type: text/html, Size: 929 bytes --]

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

* bug#21443: 24.5; etags' complete-tag changes the global value of tags-file-name
  2015-09-11  6:57     ` Eli Zaretskii
@ 2015-11-23 22:03       ` Dmitry Gutov
  0 siblings, 0 replies; 8+ messages in thread
From: Dmitry Gutov @ 2015-11-23 22:03 UTC (permalink / raw)
  To: Eli Zaretskii, HGY; +Cc: 21443

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.





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

end of thread, other threads:[~2015-11-23 22:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-09 13:18 bug#21443: 24.5; etags' complete-tag changes the global value of tags-file-name HuangMario
2015-09-10 19:06 ` Eli Zaretskii
2015-09-11  0:30   ` Dmitry Gutov
2015-09-11  4:56     ` Eli Zaretskii
2015-09-11 13:59       ` Dmitry Gutov
2015-09-16  2:33         ` HGY
     [not found]   ` <4b3df5cb.21a.14fbb06425d.Coremail.mohu3g@163.com>
2015-09-11  6:57     ` Eli Zaretskii
2015-11-23 22:03       ` Dmitry Gutov

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).