all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Hong Xu <hong@topbug.net>
To: 37673@debbugs.gnu.org
Cc: Phil Sainty <psainty@orcon.net.nz>, Lars Ingebrigtsen <larsi@gnus.org>
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	[thread overview]
Message-ID: <775105d3-261b-fe70-ddd9-e5d7db78706f@topbug.net> (raw)

* 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






             reply	other threads:[~2019-10-09  4:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-09  4:59 Hong Xu [this message]
2019-10-09  5:04 ` bug#37673: [PATCH] Simplify the search of the default tags file in, `visit-tags-table' Lars Ingebrigtsen
2019-10-12 18:55   ` Hong Xu

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

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

  git send-email \
    --in-reply-to=775105d3-261b-fe70-ddd9-e5d7db78706f@topbug.net \
    --to=hong@topbug.net \
    --cc=37673@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=psainty@orcon.net.nz \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.