From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#27772: 25.2; Choosing tags files Date: Sun, 06 Aug 2017 21:45:56 -0400 Message-ID: <87mv7c40bv.fsf@users.sourceforge.net> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1502070312 4235 195.159.176.226 (7 Aug 2017 01:45:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 7 Aug 2017 01:45:12 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) Cc: 27772@debbugs.gnu.org To: Daniel Lopez Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Aug 07 03:45:08 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1deX6Q-0000m8-Rt for geb-bug-gnu-emacs@m.gmane.org; Mon, 07 Aug 2017 03:45:07 +0200 Original-Received: from localhost ([::1]:34969 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1deX6W-0005SW-U4 for geb-bug-gnu-emacs@m.gmane.org; Sun, 06 Aug 2017 21:45:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40050) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1deX6R-0005Qw-Am for bug-gnu-emacs@gnu.org; Sun, 06 Aug 2017 21:45:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1deX6M-0002ON-DG for bug-gnu-emacs@gnu.org; Sun, 06 Aug 2017 21:45:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42425) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1deX6M-0002OF-8c for bug-gnu-emacs@gnu.org; Sun, 06 Aug 2017 21:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1deX6L-0008S8-RE for bug-gnu-emacs@gnu.org; Sun, 06 Aug 2017 21:45:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 07 Aug 2017 01:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27772 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 27772-submit@debbugs.gnu.org id=B27772.150207026832424 (code B ref 27772); Mon, 07 Aug 2017 01:45:01 +0000 Original-Received: (at 27772) by debbugs.gnu.org; 7 Aug 2017 01:44:28 +0000 Original-Received: from localhost ([127.0.0.1]:45102 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1deX5n-0008Qn-Vy for submit@debbugs.gnu.org; Sun, 06 Aug 2017 21:44:28 -0400 Original-Received: from mail-it0-f51.google.com ([209.85.214.51]:38015) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1deX5l-0008QS-Vt; Sun, 06 Aug 2017 21:44:26 -0400 Original-Received: by mail-it0-f51.google.com with SMTP id m34so11912682iti.1; Sun, 06 Aug 2017 18:44:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=ppvmDHfhJq63vdWl3lhzzohjeV/i+ltGIRYexK0/0h4=; b=j9cH+wZyDNwR/yAyLjvuO3qvg3tVxWObKnW30h9td1kS4pxbCvI+b74acYO9NMGh/s /03W28Tm+Zf3Qgp6nYsCzPbrob8rfXY6JnX1vvsZqQS9KDT4A+nMD6cBi8U04QIu1Yyb CccKB4A1tPzDE4iBlBdVFoCSc51DB6KN65TxDPfqBgIbZeO3280picZdzqA+hceedTxZ C6HNIAV7KwstzJf3lHBsMUGUaKiCw0dZQa69gDT7bJrlqMHY5a6w6ZFrsHShaMEyuIPU 5xYn9RTPlOcMpZgOqDHftfIt1QHRrLfMsQ7RqHW8FKv+QeGTXpvGXfFZk18puuERq/2W uVKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=ppvmDHfhJq63vdWl3lhzzohjeV/i+ltGIRYexK0/0h4=; b=VNzJu/rb9Alb2MEH7D5cTAEKL615nI9yfJyEGBKPwVvs3yJfo8F9QOot6Ctjph3MkE lILqSDPIP7+g3RmUmreXwC0O8zylEoyvJ7PbFbAJ7Fk6GdAWd3uIYoP7rPt2uclPpVkF KpFTE/UD6Mm2S53fS5kZ4ftPWSXhFmatjiBVBsr3Q6dRipzz/YXqdBhATWrvW3L/MlZt FuWrpaKk+2fJClkUu4vMoPQihzAoA7098BViJucgp509EofyHkWiCpF4IFwvTKivTy5G SjayX1+y7WJ3tFEyDDjTFT9cmkujuUU8osqaAuVzfF1heOF/Ztn461Qrm6On/pttomeS 3iig== X-Gm-Message-State: AHYfb5ikrzciT1A56N+eNObby80YOKgBhso3l0+AhV3DVhHwSRu3O+ms DE7HuwTnWz9nNZPK X-Received: by 10.36.80.201 with SMTP id m192mr10150565itb.31.1502070259935; Sun, 06 Aug 2017 18:44:19 -0700 (PDT) Original-Received: from zony ([45.2.119.49]) by smtp.googlemail.com with ESMTPSA id 63sm3174036ith.4.2017.08.06.18.44.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 06 Aug 2017 18:44:18 -0700 (PDT) In-Reply-To: (Daniel Lopez's message of "Thu, 20 Jul 2017 14:49:10 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:135521 Archived-At: --=-=-= Content-Type: text/plain tags 27772 + patch severity 27772 minor quit Daniel Lopez 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'). --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v1-0001-Respect-buffer-local-value-of-tags-table-list-Bug.patch Content-Description: patch >From 884e23043dc263126341f297953d89ce28d7dd9a Mon Sep 17 00:00:00 2001 From: Noam Postavsky 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 --=-=-=--