From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Hong Xu Newsgroups: gmane.emacs.bugs Subject: bug#37673: [PATCH] Simplify the search of the default tags file in, `visit-tags-table' Date: Tue, 8 Oct 2019 21:59:40 -0700 Message-ID: <775105d3-261b-fe70-ddd9-e5d7db78706f@topbug.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="30631"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 Cc: Phil Sainty , Lars Ingebrigtsen To: 37673@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 09 18:18:45 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iIEfl-0007ri-2K for geb-bug-gnu-emacs@m.gmane.org; Wed, 09 Oct 2019 18:18:45 +0200 Original-Received: from localhost ([::1]:52118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iIEfj-0007K4-0H for geb-bug-gnu-emacs@m.gmane.org; Wed, 09 Oct 2019 12:18:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56241) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iI45w-0001kN-La for bug-gnu-emacs@gnu.org; Wed, 09 Oct 2019 01:01:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iI45u-00084g-LG for bug-gnu-emacs@gnu.org; Wed, 09 Oct 2019 01:01:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43041) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iI45u-00084J-2n for bug-gnu-emacs@gnu.org; Wed, 09 Oct 2019 01:01:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iI45t-0003us-Vb for bug-gnu-emacs@gnu.org; Wed, 09 Oct 2019 01:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Hong Xu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 09 Oct 2019 05:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 37673 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs Original-Received: via spool by submit@debbugs.gnu.org id=B.157059720214888 (code B ref -1); Wed, 09 Oct 2019 05:01:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 9 Oct 2019 05:00:02 +0000 Original-Received: from localhost ([127.0.0.1]:51862 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iI44v-0003rc-64 for submit@debbugs.gnu.org; Wed, 09 Oct 2019 01:00:01 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:45215) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iI44s-0003rS-Da for submit@debbugs.gnu.org; Wed, 09 Oct 2019 00:59:59 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56126) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iI44r-0001SX-63 for bug-gnu-emacs@gnu.org; Wed, 09 Oct 2019 00:59:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iI44p-0007EW-BJ for bug-gnu-emacs@gnu.org; Wed, 09 Oct 2019 00:59:57 -0400 Original-Received: from sender4-of-o54.zoho.com ([136.143.188.54]:21453) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iI44j-00078t-Vu; Wed, 09 Oct 2019 00:59:50 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1570597182; cv=none; d=zoho.com; s=zohoarc; b=nbNpJib/ERDLLO5pjdsEE2LKBm8F+jcUtIv8+o3fbkK19G6yaM64/wCWu2JQ/TgpCKX3ieKT51xvDIiGgRCsOIWW6O0x73t/11hPlUvH0tv2JaiF1sBTbJQvhGvUrV+JJAw4RCL1+8YJ/Ei5CpstyuEk5GboOeeMd15BL1pqWMI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570597182; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To; bh=V3wxziOdLpMzGpLTywuZp6J2Afl4t9fNF3egtrqCOh8=; b=flPqmE0IDsPMidmT9usRPUsAp84kStw0Bu4/T9ih1h3Fkmrq0e01/9KEK1uccpgCd0YBr3mgMT+yhBpQnBKf/iGdZ2XmfCqNbxKOl+6fDkmRQS8CsBvzcz+oG9cCafHLcf3zqDkaXWb3Tdw0fTM3mDZD946ilbVknTsLG7d38r0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass header.i=topbug.net; spf=pass smtp.mailfrom=hong@topbug.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1570597182; s=zoho; d=topbug.net; i=hong@topbug.net; h=To:Cc:From:Subject:Message-ID:Date:MIME-Version:Content-Type:Content-Transfer-Encoding; l=1567; bh=V3wxziOdLpMzGpLTywuZp6J2Afl4t9fNF3egtrqCOh8=; b=ZFeABkW65kIKg7fZsUfc8lkL01P7pTL7CtuvvU3ueXxPe7NjwDNyQL0R/92tBp3V 6yAqrmCEH8e6z0ydyKVMj8WaCrsON3O66tclrym11SKwn6SR9Ek798ShOJsW+sxToNx lYE/63N3VaRKGyhJUIqgH/z8A7w9Ubg+eoHir7U0= Original-Received: from [192.168.88.88] (69-215-149-151.lightspeed.sntcca.sbcglobal.net [69.215.149.151]) by mx.zohomail.com with SMTPS id 1570597181389387.9664870520551; Tue, 8 Oct 2019 21:59:41 -0700 (PDT) Openpgp: preference=signencrypt Content-Language: en-US X-ZohoMailClient: External X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] 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: 209.51.188.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:168702 Archived-At: * lisp/progmodes/etags.el (visit-tags-table): Reimplement `tags--find-default-tags-dir-recursively' using the much simpler `locate-dominating-file'. Following up bug#37518. --- lisp/progmodes/etags.el | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index 906ab37c6b9f..6784894ba87e 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -274,19 +274,6 @@ tags-table-mode (setq buffer-undo-list t) (initialize-new-tags-table)) -(defun tags--find-default-tags-dir-recursively (current-dir) - "Find the directory in which the default TAGS file lives. -It is the first directory that contains a file named TAGS -encountered when recursively searching upward from CURRENT-DIR." - (let ((tag-filename (expand-file-name "TAGS" current-dir))) - (if (file-exists-p tag-filename) - current-dir - (let ((parent-dir - (file-name-directory (directory-file-name current-dir)))) - (if (string= parent-dir current-dir) ;; root dir is reached - nil - (tags--find-default-tags-dir-recursively parent-dir)))))) - ;;;###autoload (defun visit-tags-table (file &optional local) "Tell tags commands to use tags table file FILE. @@ -301,7 +288,7 @@ visit-tags-table file the tag was in." (interactive (let ((default-tag-dir - (or (tags--find-default-tags-dir-recursively default-directory) + (or (locate-dominating-file default-directory "TAGS") default-directory))) (list (read-file-name "Visit tags table (default TAGS): " -- 2.20.1