From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Philip K." Newsgroups: gmane.emacs.bugs Subject: bug#43086: [PATCH] Allow tags backend to not query for TAGS file Date: Fri, 28 Aug 2020 14:50:38 +0200 Message-ID: <87k0xjue75.fsf@posteo.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6327"; mail-complaints-to="usenet@ciao.gmane.io" To: 43086@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 28 14:51:12 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kBdqZ-0001UZ-9W for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 28 Aug 2020 14:51:11 +0200 Original-Received: from localhost ([::1]:34540 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBdqY-0006r3-BK for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 28 Aug 2020 08:51:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42112) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBdqQ-0006pL-Kw for bug-gnu-emacs@gnu.org; Fri, 28 Aug 2020 08:51:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33922) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kBdqQ-000759-BA for bug-gnu-emacs@gnu.org; Fri, 28 Aug 2020 08:51:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kBdqQ-0004VE-6t for bug-gnu-emacs@gnu.org; Fri, 28 Aug 2020 08:51:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Philip K." Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 28 Aug 2020 12:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 43086 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.159861905117290 (code B ref -1); Fri, 28 Aug 2020 12:51:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 28 Aug 2020 12:50:51 +0000 Original-Received: from localhost ([127.0.0.1]:45468 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kBdqF-0004Uo-AP for submit@debbugs.gnu.org; Fri, 28 Aug 2020 08:50:51 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:41920) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kBdqB-0004Uc-IR for submit@debbugs.gnu.org; Fri, 28 Aug 2020 08:50:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42080) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBdqB-0006dG-6b for bug-gnu-emacs@gnu.org; Fri, 28 Aug 2020 08:50:47 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:41395) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBdq7-00070u-PH for bug-gnu-emacs@gnu.org; Fri, 28 Aug 2020 08:50:46 -0400 Original-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 770582400FE for ; Fri, 28 Aug 2020 14:50:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1598619040; bh=Uq73Ld46Rn2qmkaodImXFtCkzzSX2oK61+unup3UqvY=; h=From:To:Subject:Date:From; b=MqoNx1fb4Djm5f4K7WhqaG/kgy/bBDYWOa95maTzcYpndQVFdiKOSuXawZdTL3v72 HiTLQQpTJMenPX8x0vGm7ERsg/oH+RdEkVf4uWCKyqgqRtY9ow/6F5O1v5qFObCppl 5HO8rLNT3u/fF0RWlRajZieCjcNtD7XrFnGRacQCrxOhahksJFKZKJKReDW4SOhYAv TjRFQgQYmaTlOGQrVKcxV24FjJSfhscPjytU3NtQbCvtdWiwCtzu2jUHxF63MQMcD5 QYCpzOBDFP5s97W0w7Tzivz+FB9DsktHB9yDSdlqSefxWNCNwuOyiazPzzviKVa5U5 Ns7o2mSyC325g== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4BdKFq66fqz6tmZ for ; Fri, 28 Aug 2020 14:50:39 +0200 (CEST) Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@posteo.net; helo=mout02.posteo.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/28 08:27:43 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:186602 Archived-At: --=-=-= Content-Type: text/plain Hi, the xref backend for etags can be annoying at times, especially in combination with other backends. This patch should improve the situation, by allowing the user to configure how and when the etags backend is activated. The new user option etags-query-file would allow the backend to never query a TAGS file, or conditionally, depending on the existence of a TAGS file (in which case it can also be automatically loaded). I could imagine this might be extended to allow an auto-generate option, but that feature seems out of scope of this patch, and probably would require some interoperation with project.el. -- Philip K. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Allow-tags-backend-to-not-query-for-TAGS-file.patch >From 6b141be5123d4cf37d743a9a12818442333658ed Mon Sep 17 00:00:00 2001 From: Philip K Date: Fri, 28 Aug 2020 14:20:56 +0200 Subject: [PATCH] Allow tags backend to not query for TAGS file * lisp/progmodes/etags.el (etags-query-file): Add variable (etags--xref-backend): Respect etags-query-file --- lisp/progmodes/etags.el | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index 2c5c36504a..60b162f19e 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -2069,8 +2069,39 @@ etags-xref-find-definitions-tag-order If you want `xref-find-definitions' to find the tagged files by their file name, add `tag-partial-file-name-match-p' to the list value.") +(defcustom etags-query-file t + "Specify how and when to query TAGS file. +If t, always query if no tags file has been loaded. +If `check', only query if a TAGS file exists. +If `check-and-set', automatically set TAGS file if exists, and don't +query otherwise. +If `set-or-check', set TAGS file if exists, or query user if not. +If nil, a new table can be loaded using `visit-tags-table'." + :type '(choice (const :tag "Always query" t) + (const :tag "Never query" nil) + (const :tag "Query if exists" check) + (const :tag "Set if exists" check-and-set) + (const :tag "Query if not exists" set-or-check)) + :version "28.1") + ;;;###autoload -(defun etags--xref-backend () 'etags) +(defun etags--xref-backend () + (and (cond ((or (null etags-query-file) + tags-table-computed-list)) + ((eq etags-query-file 'check) + (locate-dominating-file default-directory "TAGS")) + ((eq etags-query-file 'check-and-set) + (let ((dir (locate-dominating-file default-directory "TAGS"))) + (when dir + (visit-tags-table dir) + t))) + ((eq etags-query-file 'set-or-check) + (let ((dir (locate-dominating-file default-directory "TAGS"))) + (when dir + (visit-tags-table dir)) + t)) + (etags-query-file)) + 'etags)) (cl-defmethod xref-backend-identifier-at-point ((_backend (eql etags))) (find-tag--default)) -- 2.26.2 --=-=-=--