From unknown Sat Sep 06 14:23:41 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27772: 25.2; Choosing tags files Resent-From: Daniel Lopez Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 20 Jul 2017 13:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 27772 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 27772@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.150055865715816 (code B ref -1); Thu, 20 Jul 2017 13:51:02 +0000 Received: (at submit) by debbugs.gnu.org; 20 Jul 2017 13:50:57 +0000 Received: from localhost ([127.0.0.1]:48745 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dYBqz-000472-7b for submit@debbugs.gnu.org; Thu, 20 Jul 2017 09:50:57 -0400 Received: from eggs.gnu.org ([208.118.235.92]:43488) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dYBqv-00046l-9p for submit@debbugs.gnu.org; Thu, 20 Jul 2017 09:50:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dYBqo-0002Du-CQ for submit@debbugs.gnu.org; Thu, 20 Jul 2017 09:50:47 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=BAYES_50, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:57370) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dYBqo-0002Dk-8m for submit@debbugs.gnu.org; Thu, 20 Jul 2017 09:50:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34451) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYBqm-0006We-Ip for bug-gnu-emacs@gnu.org; Thu, 20 Jul 2017 09:50:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dYBqh-0002BN-Fq for bug-gnu-emacs@gnu.org; Thu, 20 Jul 2017 09:50:44 -0400 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]:36290) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dYBqh-0002Ah-5b for bug-gnu-emacs@gnu.org; Thu, 20 Jul 2017 09:50:39 -0400 Received: by mail-wm0-x236.google.com with SMTP id k69so25055432wmc.1 for ; Thu, 20 Jul 2017 06:50:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=uQrGOU0OmqBnMO/p5yL+4yUVTiciXsBBoPW2t4PQqK4=; b=QGGOb2hVqOUQyasnacj0xEmrtrDRtK3G80c9LIAU5ZnD15mCsWnsPoJ7v9KMW2xZUt EmIq2Q8oMKYEx0sZy+f4mTQA898s7kEdNTTWKW5PtwUdIbFxugICixOBACFXfmEjVho8 OCze/buaOgImfSQqK9eZYXfRoLqWbmpejpWVXyDN/Br9+hA92T4gKxlBElYck3yWHJQ7 Tm2YvnVpMhGC2i8KRpEkZ+5qMg4txz6vrh0BI4FVIyEL+BwTZKGWZ46tRoX+6EOlzTc9 5ET0hsIEFC9LevIexv3RfYb+fqwHSD/d6Srw2lKWlxtMNfsu2Zk/iReKgzK0A3cRsuhe XTdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=uQrGOU0OmqBnMO/p5yL+4yUVTiciXsBBoPW2t4PQqK4=; b=LZcrkqH04RI199zlyrcqw0bIUEEcjXbyqE6p5t7NOKLTQkn8IPvpA7zV2RgdB7rLk1 b8V3f8dLS6PZxY+tfJXAcaPljjbRTc4VtxAepuKNj2O6RgwEiWm/MJl6ic3CGxmDemCr savR1dKLgq8nAa1YTreUxmZI4ENlzBUHu2IlSREcQQr8eHUQT1cAhEIRkqd5lIgZjIuf +e1H4rw0flwu7UpIV6YXM2qNdbcZIRAyxdxOA2IWWbAh2ntDFB35lJLKK0ueun8Z30mp WGngFz49j7J6khYE41D2GfVu0B3iHyv3akisXN1h4TMMssMZTI6TnAmqt4ZNq3M8ksWi d9fQ== X-Gm-Message-State: AIVw1120cVOCSz80BUCZlH6eNLSlW5vBlaF7vEY3Cf+M28b4yBJl0eLK ZuGTmD+nSyB9VcjkagA= X-Received: by 10.28.131.130 with SMTP id f124mr2431636wmd.25.1500558637476; Thu, 20 Jul 2017 06:50:37 -0700 (PDT) Received: from [192.168.2.2] (w-79.cust-5765.ip.static.uno.uk.net. [95.172.231.79]) by smtp.googlemail.com with ESMTPSA id l131sm2802728wmg.3.2017.07.20.06.50.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jul 2017 06:50:36 -0700 (PDT) From: Daniel Lopez Message-ID: Date: Thu, 20 Jul 2017 14:49:10 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -3.8 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.8 (---) Having problems while trying to choose multiple tags tables, via tags-table-list, to apply to a specific buffer only by setting that variable in a buffer-local way: Test case: Prepare a couple of directories each with with a TAGS file: ### Bash code start ### mkdir /tmp/emacs_tags_test cd /tmp/emacs_tags_test mkdir foo_files cd foo_files echo "const int foo_const = 1;" > foo.h ctags -e foo.h cd .. mkdir bar_files cd bar_files echo "const int bar_const = 1;" > bar.h ctags -e bar.h cd .. ### Bash code end ### Start emacs -Q and run the following to open a new file and set tags-table-list buffer-locally to reference both TAGS files: ### Elisp start ### (progn (find-file "/tmp/emacs_tags_test/main.cpp") ;;(this is a new file) (setq-local tags-table-list '("/tmp/emacs_tags_test/foo_files/TAGS" "/tmp/emacs_tags_test/bar_files/TAGS")) ) ### Elisp end ### Do M-x xref-find-definitions. I get the prompt "Find definitions of:". I hit TAB hoping to get a list giving the choices of "foo_const" and "bar_const", but instead am prompted: Visit tags table (default TAGS): /tmp/emacs_tags_test/bar_files/ I press Enter reluctantly to accept the default. I'm returned to the "Find definitions of:" prompt, and "bar_const" is the sole completion (no "foo_const" which I also wanted). An aside: The global value of tags-file-name has now been set to "/tmp/emacs_tags_test/bar_files/TAGS" and the global value of tags-table-list has now been set to ("/tmp/emacs_tags_test/bar_files/TAGS") while the local value of tags-table-list is unchanged from what I set it to: ("/tmp/emacs_tags_test/foo_files/TAGS" "/tmp/emacs_tags_test/bar_files/TAGS") If I do another M-x xref-find-definitions now, I still get "bar_const" as the sole completion (instead of the choice of two I wanted). (End test case) 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 rest of that function seems a bit too complicated for me to delve into right now (and I admit I've worked around this for myself, for now, by setting before-advice on visit-tags-table-buffer to set the global value of tags-table-list to what I want every time). Daniel --- In GNU Emacs 25.2.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.22.10) of 2017-04-22 built on juergen Windowing system distributor 'The X.Org Foundation', version 11.0.11903000 Configured using: 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib --localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-modules 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong' CPPFLAGS=-D_FORTIFY_SOURCE=2 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 MODULES Important settings: value of $LANG: en_GB.UTF-8 locale-coding-system: utf-8-unix Major mode: C++/l Minor modes in effect: tooltip-mode: t global-eldoc-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 messages: ("/tmp/emacs_tags_test/foo_files/TAGS" "/tmp/emacs_tags_test/bar_files/TAGS") Making tags completion table for /tmp/emacs_tags_test/bar_files/TAGS... Starting a new list of tags tables Making tags completion table for /tmp/emacs_tags_test/bar_files/TAGS...done Quit Type C-x 1 to delete the help window. Making completion list... Quit completing-read-default: Command attempted to use minibuffer while in minibuffer Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message dired format-spec rfc822 mml mml-sec password-cache epg epg-config gnus-util 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-fns thingatpt etags xref cl-seq project ring eieio byte-opt bytecomp byte-compile cconv eieio-core cl-macs gv cl-extra help-mode cc-mode cc-fonts easymenu cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs cl-loaddefs pcase cl-lib time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer cl-preloaded 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 dbusbind inotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 116530 3695) (symbols 48 23070 0) (miscs 40 53 111) (strings 32 23520 5093) (string-bytes 1 794931) (vectors 16 16526) (vector-slots 8 487720 4910) (floats 8 230 253) (intervals 56 297 7) (buffers 976 23)) From unknown Sat Sep 06 14:23:41 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27772: 25.2; Choosing tags files 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: To: Daniel Lopez Cc: 27772@debbugs.gnu.org Received: via spool by 27772-submit@debbugs.gnu.org id=B27772.150207026832424 (code B ref 27772); Mon, 07 Aug 2017 01:45:01 +0000 Received: (at 27772) by debbugs.gnu.org; 7 Aug 2017 01:44:28 +0000 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 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 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) 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) From: npostavs@users.sourceforge.net References: Date: Sun, 06 Aug 2017 21:45:56 -0400 In-Reply-To: (Daniel Lopez's message of "Thu, 20 Jul 2017 14:49:10 +0100") Message-ID: <87mv7c40bv.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) --=-=-= 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 --=-=-=-- From unknown Sat Sep 06 14:23:41 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27772: 25.2; Choosing tags files Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 07 Aug 2017 16:11:02 +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: patch To: npostavs@users.sourceforge.net Cc: 27772@debbugs.gnu.org, daniel.lopez999@gmail.com Reply-To: Eli Zaretskii Received: via spool by 27772-submit@debbugs.gnu.org id=B27772.150212225611718 (code B ref 27772); Mon, 07 Aug 2017 16:11:02 +0000 Received: (at 27772) by debbugs.gnu.org; 7 Aug 2017 16:10:56 +0000 Received: from localhost ([127.0.0.1]:46103 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dekcJ-00032u-4u for submit@debbugs.gnu.org; Mon, 07 Aug 2017 12:10:56 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47934) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dekcG-00032h-UG for 27772@debbugs.gnu.org; Mon, 07 Aug 2017 12:10:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dekc6-0008Lb-Jt for 27772@debbugs.gnu.org; Mon, 07 Aug 2017 12:10:47 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:37165) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dekc6-0008LT-Dm; Mon, 07 Aug 2017 12:10:42 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4196 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dekc5-0006MD-Qi; Mon, 07 Aug 2017 12:10:42 -0400 Date: Mon, 07 Aug 2017 19:10:38 +0300 Message-Id: <83h8xjtl35.fsf@gnu.org> From: Eli Zaretskii In-reply-to: <87mv7c40bv.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net) References: <87mv7c40bv.fsf@users.sourceforge.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > From: npostavs@users.sourceforge.net > Date: Sun, 06 Aug 2017 21:45:56 -0400 > Cc: 27772@debbugs.gnu.org > > 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. Seems reasonable, thanks. > * lisp/progmodes/etags.el (visit-tags-table-buffer): Save the current ^^^^^^^ You meant "current buffer", I presume. Do etags-tests.el still pass after this change? If so, would it be possible to add a test for this bug? Other than that, LGTM. From unknown Sat Sep 06 14:23:41 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27772: 25.2; Choosing tags files Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Aug 2017 02:55:02 +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: patch To: Eli Zaretskii Cc: daniel.lopez999@gmail.com, 27772@debbugs.gnu.org Received: via spool by 27772-submit@debbugs.gnu.org id=B27772.150216087120842 (code B ref 27772); Tue, 08 Aug 2017 02:55:02 +0000 Received: (at 27772) by debbugs.gnu.org; 8 Aug 2017 02:54:31 +0000 Received: from localhost ([127.0.0.1]:50969 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1deuf8-0005Q6-NK for submit@debbugs.gnu.org; Mon, 07 Aug 2017 22:54:30 -0400 Received: from mail-it0-f46.google.com ([209.85.214.46]:34902) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1deuf6-0005Ps-Ok for 27772@debbugs.gnu.org; Mon, 07 Aug 2017 22:54:29 -0400 Received: by mail-it0-f46.google.com with SMTP id 76so12233343ith.0 for <27772@debbugs.gnu.org>; Mon, 07 Aug 2017 19:54:28 -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=a+eybeUTj984SA5Xcd+2wmMB5yiecwWygS8UHpSyJbo=; b=NxftH73RCwNGcZq97Kp8F13tjPfjP/qQd2jFt5I/QuQbPErw8/1N7bUD50Z27kVt+r QjlU3F8+unezP6ge2NC6B/4mvPzfI13Dzz8m7oBcOYscPVBP1mTTFy6MYi96Q8rLq9T6 TkKxDrxpZ5bJ5kpqZpzKMQWrQFGn+r7UJVhQOaE+dx/BPSQGoMLZTH9ySbKfKq701sjB jL88TJBDbzHWXqCfOaOHfN5tp+3MmlrYtFYvjqhKJxGKr9QY+/q0xPY18p916rSpIHFd D9Zz3m8CfprqPVLx3VGvbsbzRiq7lnjx4bROXxu0ijbHojSfqXx8s+2fQg2omXI0sx1y LuSA== 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=a+eybeUTj984SA5Xcd+2wmMB5yiecwWygS8UHpSyJbo=; b=Pvy8e4vW8mvEt4LIVGbimoPGRLChejkneWYUhIm2++m570JUsWBunNvxAOr9lefg57 f38Z43EA/gUi/Rx2RsWTMFfJ2idyI9cPBlsORv0z/bnh1juFTL9zCnPllA44UE9e04ej hF/QXvJsNmdLVgKVondOTmpDvrIb8aUkHl/4JiCyEjt+SMwTfexevT20ovR8MFhc9Gr0 lFwn6fAL/sxB7o5eHa8xwSliXiWklnBw3OtiTlFBOj2VcIYHKcOLbvm7c196SCSGNQB5 UCIsISjrsfLgi196erV8Acd+yyesrQALdd07Ww8NTZGTn9nMLUhcSXWVGMDE5/JX+VK6 tBgg== X-Gm-Message-State: AIVw110Yqs1WBm3MUIcstY0tFVRYzH/dazv5CZnnQ/IJwDNULNgZMLww biVBhr/EaAd57w== X-Received: by 10.36.104.140 with SMTP id v134mr2708830itb.11.1502160863176; Mon, 07 Aug 2017 19:54:23 -0700 (PDT) Received: from zony ([45.2.119.49]) by smtp.googlemail.com with ESMTPSA id b79sm302835itb.5.2017.08.07.19.54.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Aug 2017 19:54:20 -0700 (PDT) From: npostavs@users.sourceforge.net References: <87mv7c40bv.fsf@users.sourceforge.net> <83h8xjtl35.fsf@gnu.org> Date: Mon, 07 Aug 2017 22:55:57 -0400 In-Reply-To: <83h8xjtl35.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 07 Aug 2017 19:10:38 +0300") Message-ID: <871som4vk2.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.2 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> * lisp/progmodes/etags.el (visit-tags-table-buffer): Save the current > ^^^^^^^ > You meant "current buffer", I presume. Whoops, yes. > Do etags-tests.el still pass after this change? Yep, all 2 of them. > If so, would it be possible to add a test for this bug? Okay, the following basically works. Although without the patch, the test doesn't fail cleanly, it rather gets stuck waiting for input (the TAGS table filename). --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v2-0001-Respect-buffer-local-value-of-tags-table-list-Bug.patch Content-Description: patch >From e3d3edfedf81543612367aee9a5aa53600d3c5c8 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sun, 6 Aug 2017 21:35:04 -0400 Subject: [PATCH v2] Respect buffer-local value of tags-table-list (Bug#27772) * lisp/progmodes/etags.el (visit-tags-table-buffer): Save the current buffer around the `tags-table-including' calls so as to get buffer local variables from the right buffer later. * test/lisp/progmodes/etags-tests.el (etags-visit-tags-table-buffer): New test. * test/lisp/progmodes/etags-tests.el (etags-tests--test-dir): New constant. (etags-bug-158, etags-bug-23164): Use it so that when running the test interactively, setting EMACS_TEST_DIRECTORY is not needed. --- lisp/progmodes/etags.el | 13 +++++++------ test/lisp/progmodes/etags-tests.el | 27 +++++++++++++++++++++------ 2 files changed, 28 insertions(+), 12 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 @@ visit-tags-table-buffer ;; 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 diff --git a/test/lisp/progmodes/etags-tests.el b/test/lisp/progmodes/etags-tests.el index eec8a02f1b..950c853c09 100644 --- a/test/lisp/progmodes/etags-tests.el +++ b/test/lisp/progmodes/etags-tests.el @@ -26,6 +26,11 @@ (defvar his-masters-voice t) +(defconst etags-tests--test-dir + (or (getenv "EMACS_TEST_DIRECTORY") + (expand-file-name "../../.." + (or load-file-name buffer-file-name)))) + (defun y-or-n-p (_prompt) "Replacement for `y-or-n-p' that returns what we tell it to." his-masters-voice) @@ -38,8 +43,7 @@ y-or-n-p (set-buffer buf-with-global-tags) (setq default-directory (expand-file-name ".")) (visit-tags-table - (expand-file-name "manual/etags/ETAGS.good_1" - (getenv "EMACS_TEST_DIRECTORY"))) + (expand-file-name "manual/etags/ETAGS.good_1" etags-tests--test-dir)) ;; Check that tags in ETAGS.good_1 are recognized. (setq xref-buf (xref-find-definitions "LL_Task_Procedure_Access/t")) (should (bufferp xref-buf)) @@ -55,8 +59,7 @@ y-or-n-p (setq default-directory (expand-file-name ".")) (let (his-masters-voice) (visit-tags-table - (expand-file-name "manual/etags/ETAGS.good_3" - (getenv "EMACS_TEST_DIRECTORY")) + (expand-file-name "manual/etags/ETAGS.good_3" etags-tests--test-dir) t)) ;; Check that tags in ETAGS.good_1 are recognized. (setq xref-buf (xref-find-definitions "LL_Task_Procedure_Access/t")) @@ -84,8 +87,20 @@ y-or-n-p (set-buffer (get-buffer-create "*foobar*")) (fundamental-mode) (visit-tags-table - (expand-file-name "manual/etags/ETAGS.good_3" - (getenv "EMACS_TEST_DIRECTORY")) + (expand-file-name "manual/etags/ETAGS.good_3" etags-tests--test-dir) t) (should (equal (should-error (xref-find-definitions "foobar123")) '(user-error "No definitions found for: foobar123")))) + +(ert-deftest etags-buffer-local-tags-table-list () + "Test that a buffer-local value of `tags-table-list' is used." + (let ((file (make-temp-file "etag-test-tmpfile"))) + (set-buffer (find-file-noselect file)) + (fundamental-mode) + (setq-local tags-table-list + (list (expand-file-name "manual/etags/ETAGS.good_3" + etags-tests--test-dir))) + (let ((tag-tables tags-table-list) + (tags-file-name nil)) + (should (visit-tags-table-buffer)) + (should (equal tags-file-name (car tag-tables)))))) -- 2.11.1 --=-=-=-- From unknown Sat Sep 06 14:23:41 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27772: 25.2; Choosing tags files Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Aug 2017 14:22: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: patch To: npostavs@users.sourceforge.net Cc: daniel.lopez999@gmail.com, 27772@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 27772-submit@debbugs.gnu.org id=B27772.150220209525913 (code B ref 27772); Tue, 08 Aug 2017 14:22:01 +0000 Received: (at 27772) by debbugs.gnu.org; 8 Aug 2017 14:21:35 +0000 Received: from localhost ([127.0.0.1]:52109 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1df5O3-0006jt-2u for submit@debbugs.gnu.org; Tue, 08 Aug 2017 10:21:35 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34706) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1df5O1-0006jf-33 for 27772@debbugs.gnu.org; Tue, 08 Aug 2017 10:21:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1df5Nu-0000XY-RO for 27772@debbugs.gnu.org; Tue, 08 Aug 2017 10:21:27 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:34661) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1df5Np-0000Se-9s; Tue, 08 Aug 2017 10:21:21 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1043 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1df5No-0003og-GW; Tue, 08 Aug 2017 10:21:21 -0400 Date: Tue, 08 Aug 2017 17:21:19 +0300 Message-Id: <834ltita1s.fsf@gnu.org> From: Eli Zaretskii In-reply-to: <871som4vk2.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net) References: <87mv7c40bv.fsf@users.sourceforge.net> <83h8xjtl35.fsf@gnu.org> <871som4vk2.fsf@users.sourceforge.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > From: npostavs@users.sourceforge.net > Cc: 27772@debbugs.gnu.org, daniel.lopez999@gmail.com > Date: Mon, 07 Aug 2017 22:55:57 -0400 > > > If so, would it be possible to add a test for this bug? > > Okay, the following basically works. Although without the patch, the > test doesn't fail cleanly, it rather gets stuck waiting for input (the > TAGS table filename). Would it be possible to work around that by replacing some function (like we already do in this test)? If not, please push, and thanks. From unknown Sat Sep 06 14:23:41 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27772: 25.2; Choosing tags files Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 09 Aug 2017 00:01:02 +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: patch To: Eli Zaretskii Cc: daniel.lopez999@gmail.com, 27772@debbugs.gnu.org Received: via spool by 27772-submit@debbugs.gnu.org id=B27772.15022368426254 (code B ref 27772); Wed, 09 Aug 2017 00:01:02 +0000 Received: (at 27772) by debbugs.gnu.org; 9 Aug 2017 00:00:42 +0000 Received: from localhost ([127.0.0.1]:52386 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dfEQU-0001cG-1z for submit@debbugs.gnu.org; Tue, 08 Aug 2017 20:00:42 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:37388) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dfEQS-0001VQ-F8 for 27772@debbugs.gnu.org; Tue, 08 Aug 2017 20:00:40 -0400 Received: by mail-io0-f194.google.com with SMTP id c74so3585015iod.4 for <27772@debbugs.gnu.org>; Tue, 08 Aug 2017 17:00:40 -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=b+vvfZb8VygcCq8BWtvq/4vKfy/ejy/RQTDx1aFIdN0=; b=Ceezp0Ct/R4h8rTWS7No2zdUmeg+dBVK/f49dIw5mqlOFdMxJhSPRavu1oeNDRRNrE SD4aA9Bt2ff61xpI1bWzAfKnbCa4//AIKuhqYUy3K9e6RieYLYfhm1pAhN/zYPW6sHV/ ohDTGfUCTQltjn2w8DdvCxCcIcAC3guwk0F9vE52csfEPcsOH4pBAvGtFtttq8uiGBWw gyNZ7QTO1iCehJS/xsjrJJ3PYQuYbvCIL/oTq6BC/mRUOsf1g7Tj68Fx70dfGDybquKh CZD7i2Qj3+u5Vpaj14DwZ9yIKtooE07q22splTGNDqJQInJVjt5LoAz1ncw7+JTGHjZP pniQ== 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=b+vvfZb8VygcCq8BWtvq/4vKfy/ejy/RQTDx1aFIdN0=; b=nf5v8xvB8MXIOFYnGVsIxiGN+aE+Lh8e4EOIkJdcNAVACbOYtP8rPZGpo3BY+0Ej7k pjFPaodKzVsuKWCWpNvwqeMGlbswFmtBj7Vcm05wR4RAPGHnzNGqTBTFEqUXmQOAYnYZ 6q43HFMLcctVt9Tyc14dHfgOtJ8nnuqAPt4EoPm9UVIWHtVvpmfCqLA+dqVB3VSvySkc cOUEaFPar58l/+sKkRKnI7ZXwLQz8VBQRprxagkUHuqKfFxAO5MnQ07X5knvCahMwXog ZvkvGdWFytNMBPTJJFF6QnN8ZDUUoudQ4rW4KcMnYuW+N1hwO8KhdFmjpo6Mm0MWIGa7 hfoQ== X-Gm-Message-State: AHYfb5hE5G0sZxM/pWnqPJAHsh5uBkIs8Sg58IikJKoIBvB6DwKIoy+9 Dpi03Y4g+oW3oA== X-Received: by 10.107.24.66 with SMTP id 63mr4876022ioy.111.1502236834815; Tue, 08 Aug 2017 17:00:34 -0700 (PDT) Received: from zony ([45.2.119.49]) by smtp.googlemail.com with ESMTPSA id y65sm1393301itb.44.2017.08.08.17.00.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Aug 2017 17:00:33 -0700 (PDT) From: npostavs@users.sourceforge.net References: <87mv7c40bv.fsf@users.sourceforge.net> <83h8xjtl35.fsf@gnu.org> <871som4vk2.fsf@users.sourceforge.net> <834ltita1s.fsf@gnu.org> Date: Tue, 08 Aug 2017 20:02:10 -0400 In-Reply-To: <834ltita1s.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 08 Aug 2017 17:21:19 +0300") Message-ID: <87shh138xp.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.1 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: npostavs@users.sourceforge.net >> Cc: 27772@debbugs.gnu.org, daniel.lopez999@gmail.com >> Date: Mon, 07 Aug 2017 22:55:57 -0400 >> >> > If so, would it be possible to add a test for this bug? >> >> Okay, the following basically works. Although without the patch, the >> test doesn't fail cleanly, it rather gets stuck waiting for input (the >> TAGS table filename). > > Would it be possible to work around that by replacing some function > (like we already do in this test)? If not, please push, and thanks. Oh yeah, that's easy (why didn't I do that right away? Must have been tired or something.) --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v3-0001-Respect-buffer-local-value-of-tags-table-list-Bug.patch Content-Description: patch >From 6df75e619d2438483e917b4c3a4c8a50f10db93c Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sun, 6 Aug 2017 21:35:04 -0400 Subject: [PATCH v3] Respect buffer-local value of tags-table-list (Bug#27772) * lisp/progmodes/etags.el (visit-tags-table-buffer): Save the current buffer around the `tags-table-including' calls so as to get buffer local variables from the right buffer later. * test/lisp/progmodes/etags-tests.el (etags-visit-tags-table-buffer): New test. * test/lisp/progmodes/etags-tests.el (etags-tests--test-dir): New constant. (etags-bug-158, etags-bug-23164): Use it so that when running the test interactively, setting EMACS_TEST_DIRECTORY is not needed. --- lisp/progmodes/etags.el | 13 +++++++------ test/lisp/progmodes/etags-tests.el | 31 +++++++++++++++++++++++++------ 2 files changed, 32 insertions(+), 12 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 @@ visit-tags-table-buffer ;; 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 diff --git a/test/lisp/progmodes/etags-tests.el b/test/lisp/progmodes/etags-tests.el index eec8a02f1b..0153f327ba 100644 --- a/test/lisp/progmodes/etags-tests.el +++ b/test/lisp/progmodes/etags-tests.el @@ -23,9 +23,15 @@ (require 'ert) (require 'etags) +(eval-when-compile (require 'cl-lib)) (defvar his-masters-voice t) +(defconst etags-tests--test-dir + (or (getenv "EMACS_TEST_DIRECTORY") + (expand-file-name "../../.." + (or load-file-name buffer-file-name)))) + (defun y-or-n-p (_prompt) "Replacement for `y-or-n-p' that returns what we tell it to." his-masters-voice) @@ -38,8 +44,7 @@ y-or-n-p (set-buffer buf-with-global-tags) (setq default-directory (expand-file-name ".")) (visit-tags-table - (expand-file-name "manual/etags/ETAGS.good_1" - (getenv "EMACS_TEST_DIRECTORY"))) + (expand-file-name "manual/etags/ETAGS.good_1" etags-tests--test-dir)) ;; Check that tags in ETAGS.good_1 are recognized. (setq xref-buf (xref-find-definitions "LL_Task_Procedure_Access/t")) (should (bufferp xref-buf)) @@ -55,8 +60,7 @@ y-or-n-p (setq default-directory (expand-file-name ".")) (let (his-masters-voice) (visit-tags-table - (expand-file-name "manual/etags/ETAGS.good_3" - (getenv "EMACS_TEST_DIRECTORY")) + (expand-file-name "manual/etags/ETAGS.good_3" etags-tests--test-dir) t)) ;; Check that tags in ETAGS.good_1 are recognized. (setq xref-buf (xref-find-definitions "LL_Task_Procedure_Access/t")) @@ -84,8 +88,23 @@ y-or-n-p (set-buffer (get-buffer-create "*foobar*")) (fundamental-mode) (visit-tags-table - (expand-file-name "manual/etags/ETAGS.good_3" - (getenv "EMACS_TEST_DIRECTORY")) + (expand-file-name "manual/etags/ETAGS.good_3" etags-tests--test-dir) t) (should (equal (should-error (xref-find-definitions "foobar123")) '(user-error "No definitions found for: foobar123")))) + +(ert-deftest etags-buffer-local-tags-table-list () + "Test that a buffer-local value of `tags-table-list' is used." + (let ((file (make-temp-file "etag-test-tmpfile"))) + (set-buffer (find-file-noselect file)) + (fundamental-mode) + (setq-local tags-table-list + (list (expand-file-name "manual/etags/ETAGS.good_3" + etags-tests--test-dir))) + (cl-letf ((tag-tables tags-table-list) + (tags-file-name nil) + ((symbol-function 'read-file-name) + (lambda (&rest _) + (error "We should not prompt the user")))) + (should (visit-tags-table-buffer)) + (should (equal tags-file-name (car tag-tables)))))) -- 2.11.1 --=-=-=-- From unknown Sat Sep 06 14:23:41 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27772: 25.2; Choosing tags files Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 11 Aug 2017 01:45:02 +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: patch To: Eli Zaretskii Cc: daniel.lopez999@gmail.com, 27772@debbugs.gnu.org Received: via spool by 27772-submit@debbugs.gnu.org id=B27772.15024158873398 (code B ref 27772); Fri, 11 Aug 2017 01:45:02 +0000 Received: (at 27772) by debbugs.gnu.org; 11 Aug 2017 01:44:47 +0000 Received: from localhost ([127.0.0.1]:54946 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dfz0J-0000sf-HO for submit@debbugs.gnu.org; Thu, 10 Aug 2017 21:44:47 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:37163) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dfz0H-0000sL-2G; Thu, 10 Aug 2017 21:44:45 -0400 Received: by mail-io0-f195.google.com with SMTP id c74so2642072iod.4; Thu, 10 Aug 2017 18:44:44 -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=fjvwgRuFnooT0CMS/GnODoSJ1Y0+SSk6c7ouXwMLN5w=; b=VvPOuPFQYiZiJAjPJ1rCWfQtM91J7scALMG2/UHCwGjjPvoe2bsqTqLzg9EytexNjp NYplYdDWnCe8T2LbLPbW2j7A0AmcnmeOieRqtKf2cr4Yc59gNuscaYK1C6ghViI3y4Og gBIWgZeoaKcpM8xEallrb1pRrsoxnMmrpGnuvWsmViWzdTQL8IvZOYjJlu7arK9m6wF6 CPn1vkUboEjQLFo+eiJeCCRlafiftFqCvPd7zEVuEtE7mUYGSer15LptvXvsNPf3dZep urfNYxdZwLWuoudNke+RhSaWihb0Sy0oqY8rBP6EmrPIU8HNMbUtWd5JvKh80eM6M2qR 9O/g== 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=fjvwgRuFnooT0CMS/GnODoSJ1Y0+SSk6c7ouXwMLN5w=; b=gzmfmLvmqNxo2u0HdNigR84/mLVhHI07pAtAUh1m5tD+aW3PAHv0fHfhrX8Y8VOC6I OMHEcqS2SVa8v+m1XAxi1zRI2OBYyU+Ywp0xVHb0yWG7Bt/HQU9Hxw3tDA9aq31+GuAA VSDb2Lb42y7R5TzkcQNjRgmXnycjN3k7DJDjD5a7T3qA0X7yv1xEOfitUrqnGD7AXFGK 4U/qSzYUkO39ILhWaKY0LZw1T9O+SkXDDyMGs4rV4V6nT3ix9tVvqEB5ZT6LRAbfX1il PaV/R+etAdEgWaTZ0Z2Bz5sz7Q/tlmJaJ/MI8UAsmozSPBOmBWPuNfQAt63c2tTITx+L RDbA== X-Gm-Message-State: AHYfb5gxZZjcWZXODkq0Otjf3fupkmTmA7L+4r9BkI7RlxzvwVVBQ9fw qxRuyDlS0AB9eboF X-Received: by 10.107.137.225 with SMTP id t94mr10652662ioi.263.1502415879230; Thu, 10 Aug 2017 18:44:39 -0700 (PDT) Received: from zony ([45.2.119.49]) by smtp.googlemail.com with ESMTPSA id g81sm3315077ioa.87.2017.08.10.18.44.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 Aug 2017 18:44:38 -0700 (PDT) From: npostavs@users.sourceforge.net References: <87mv7c40bv.fsf@users.sourceforge.net> <83h8xjtl35.fsf@gnu.org> <871som4vk2.fsf@users.sourceforge.net> <834ltita1s.fsf@gnu.org> <87shh138xp.fsf@users.sourceforge.net> Date: Thu, 10 Aug 2017 21:46:16 -0400 In-Reply-To: <87shh138xp.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net's message of "Tue, 08 Aug 2017 20:02:10 -0400") Message-ID: <87y3qq27x3.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.1 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) tags 27772 fixed close 27772 26.1 quit npostavs@users.sourceforge.net writes: >>> Okay, the following basically works. Although without the patch, the >>> test doesn't fail cleanly, it rather gets stuck waiting for input (the >>> TAGS table filename). >> >> Would it be possible to work around that by replacing some function >> (like we already do in this test)? If not, please push, and thanks. > > Oh yeah, that's easy (why didn't I do that right away? Must have been > tired or something.) Pushed to master. [1: 179499cde9]: 2017-08-10 21:30:37 -0400 Respect buffer-local value of tags-table-list (Bug#27772) http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=179499cde921a28c82400b1674520da245b93bb9 From unknown Sat Sep 06 14:23:41 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27772: acknowledged by developer (Re: bug#27772: 25.2; Choosing tags files) Resent-From: Daniel Lopez Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 11 Aug 2017 03:50:02 +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: patch fixed To: 27772@debbugs.gnu.org Received: via spool by 27772-submit@debbugs.gnu.org id=B27772.150242334928948 (code B ref 27772); Fri, 11 Aug 2017 03:50:02 +0000 Received: (at 27772) by debbugs.gnu.org; 11 Aug 2017 03:49:09 +0000 Received: from localhost ([127.0.0.1]:54982 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dg0wd-0007Wp-IH for submit@debbugs.gnu.org; Thu, 10 Aug 2017 23:49:07 -0400 Received: from mail-wm0-f47.google.com ([74.125.82.47]:37517) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dg0wb-0007WL-6i for 27772@debbugs.gnu.org; Thu, 10 Aug 2017 23:49:06 -0400 Received: by mail-wm0-f47.google.com with SMTP id i66so37494338wmg.0 for <27772@debbugs.gnu.org>; Thu, 10 Aug 2017 20:49:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=5qqjddMIvxDbCOHRVIWjp3k/DQQPj4Yl43i221C5SeY=; b=jnKRwJKmoBHEhjmTJSD3JHMBu9GOU/P3PwDrOInGZkf0k9a3SWzUtUBbsiL3t4oGlg vpyEWNogNlCgl6KwDKfsiyHvuLiNVRF7bVSoSoObpt3VIjZ2M6l2aaIj3UCwp3mqWWBY OIIbXPKEWv2vtRznywA/cc755eviZaGqCsGf6EdCI9JTJOSYCiecgkobZROY9rm0d9cW ARE+YsXqtpBucPz6HRIiAMkvtTNZzHXi9FS2OqkokRPDSE5h8agO3uS0bv0daGSUSZ9c fH4t60IMZ6/uf6P9zCFZCpB+u8pT7mWhiw81Eq3ru/nStcQLNfQhGIW7VWP8kRMS3qF3 EHAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=5qqjddMIvxDbCOHRVIWjp3k/DQQPj4Yl43i221C5SeY=; b=GyNCFTtDycUwRQhmcuriDLJoWruDgPXlkPCgQbKYyIa9QfW5MXc5ZFTFm8aEp1kLEM i3M3eI/jv8ZEvs9AfwdxdrbgissNIodGF/CoIx2gUD9NRzw8D7FWeAhcDf669q2kXFOu joAhe2fG5CrquNdT9QDGMyAs5F8uAxRzMwK48iS+icUKFRpz8AvZNID3kXq+MTkI6Qas RPDToeuuGFDLv/RZFz4jhohcPjCNWQJfyN49tUUePa/AA5MazSj4PRaY+nE64hfX9T/V VNHymQxV0+D0N4vHUSwTj1Ejtqh4f3Rlju8hW9AyWxQVjaR/pvToama2us9Tz0xrr45s Cn7g== X-Gm-Message-State: AHYfb5igJY4TsPzlCBU6pFq0l1uJ2a/0YoyL5ZX+M8brCEggBk5qLzBZ z/nL1ehnppTuI47oLwg= X-Received: by 10.28.127.81 with SMTP id a78mr8283353wmd.153.1502423338899; Thu, 10 Aug 2017 20:48:58 -0700 (PDT) Received: from [192.168.2.2] (w-79.cust-5765.ip.static.uno.uk.net. [95.172.231.79]) by smtp.googlemail.com with ESMTPSA id e1sm8016451wrc.91.2017.08.10.20.48.58 for <27772@debbugs.gnu.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Aug 2017 20:48:58 -0700 (PDT) References: <87y3qq27x3.fsf@users.sourceforge.net> From: Daniel Lopez Message-ID: Date: Fri, 11 Aug 2017 04:46:54 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.2 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) On 11/08/17 02:45, GNU bug Tracking System wrote: > This is an automatic notification regarding your bug report > #27772: 25.2; Choosing tags files, > which was filed against the emacs package. > > Thank you for your report, which has now been closed. > You can view the full report at > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=27772 > > If you require further information, please followup to 27772@debbugs.gnu.org. > > debbugs.gnu.org maintainers > (administrator, GNU bugs database) > > Thanks for seeing to this, guys - I had a quick try with the modified visit-tags-table-buffer in my running Emacs, and it seems to fix my original problem. Daniel