unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: Daniel Lopez <daniel.lopez999@gmail.com>
Cc: 27772@debbugs.gnu.org
Subject: bug#27772: 25.2; Choosing tags files
Date: Sun, 06 Aug 2017 21:45:56 -0400	[thread overview]
Message-ID: <87mv7c40bv.fsf@users.sourceforge.net> (raw)
In-Reply-To: <bbb38fe0-a89f-3d57-a538-06ac62568f38@gmail.com> (Daniel Lopez's message of "Thu, 20 Jul 2017 14:49:10 +0100")

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

tags 27772 + patch
severity 27772 minor
quit

Daniel Lopez <daniel.lopez999@gmail.com> writes:

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

Hmm...

    $ ctags -e foo.h 
    ctags: invalid option -- 'e'
        Try 'ctags --help' for a complete list of options.
    $ ctags --version
    ctags (GNU Emacs 25.2.50)
    Copyright (C) 2017 Free Software Foundation, Inc.
    This program is distributed under the terms in ETAGS.README

Using 'etags foo.h' I can reproduce your results.

> 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 problem is that the buffer gets changed by the time we reach there.
The following patch seems to fix it (no need to explicitly use
`buffer-local-variables' since normal variable access will check the
buffer-local value first.  I think the use of `buffer-local-variables'
above is meant to ignore the global value of `tags-file-name').


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1668 bytes --]

From 884e23043dc263126341f297953d89ce28d7dd9a Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sun, 6 Aug 2017 21:35:04 -0400
Subject: [PATCH v1] Respect buffer-local value of tags-table-list (Bug#27772)

* lisp/progmodes/etags.el (visit-tags-table-buffer): Save the current
around the `tags-table-including' calls so as to get buffer local
variables from the right buffer later.
---
 lisp/progmodes/etags.el | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 8d635cb6d4..222dea1a2a 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -599,12 +599,13 @@ (defun visit-tags-table-buffer (&optional cont cbuf)
 		;; be frobnicated, and CONT will be set non-nil so we don't
 		;; do it below.
 		(and buffer-file-name
-		     (or
-		      ;; First check only tables already in buffers.
-		      (tags-table-including buffer-file-name t)
-		      ;; Since that didn't find any, now do the
-		      ;; expensive version: reading new files.
-		      (tags-table-including buffer-file-name nil)))
+                     (save-current-buffer
+                       (or
+                        ;; First check only tables already in buffers.
+                        (tags-table-including buffer-file-name t)
+                        ;; Since that didn't find any, now do the
+                        ;; expensive version: reading new files.
+                        (tags-table-including buffer-file-name nil))))
 		;; Fourth, use the user variable tags-file-name, if it is
 		;; not already in the current list.
 		(and tags-file-name
-- 
2.11.1


  reply	other threads:[~2017-08-07  1:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-20 13:49 bug#27772: 25.2; Choosing tags files Daniel Lopez
2017-08-07  1:45 ` npostavs [this message]
2017-08-07 16:10   ` Eli Zaretskii
2017-08-08  2:55     ` npostavs
2017-08-08 14:21       ` Eli Zaretskii
2017-08-09  0:02         ` npostavs
2017-08-11  1:46           ` npostavs
     [not found] ` <handler.27772.C.15024158873392.notifdonectrl.0@debbugs.gnu.org>
2017-08-11  3:46   ` bug#27772: acknowledged by developer (Re: bug#27772: 25.2; Choosing tags files) Daniel Lopez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mv7c40bv.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=27772@debbugs.gnu.org \
    --cc=daniel.lopez999@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).