aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHong Xu2019-10-09 07:03:33 +0200
committerLars Ingebrigtsen2019-10-09 07:03:33 +0200
commit5f727c6342dff0c96d09f6c21ac99d0168569c62 (patch)
tree10c1fec37de6077fde7ed38d4f9871594dd1f9ba
parente8dd6c9d832faf8445fccbc65f05a5e6e6d48ba7 (diff)
downloademacs-5f727c6342dff0c96d09f6c21ac99d0168569c62.tar.gz
emacs-5f727c6342dff0c96d09f6c21ac99d0168569c62.zip
Fix up previous visit-tags-table change
* 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.
-rw-r--r--lisp/progmodes/etags.el15
1 files changed, 1 insertions, 14 deletions
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 906ab37c6b9..6784894ba87 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -274,19 +274,6 @@ buffer-local and set them to nil."
274 (setq buffer-undo-list t) 274 (setq buffer-undo-list t)
275 (initialize-new-tags-table)) 275 (initialize-new-tags-table))
276 276
277(defun tags--find-default-tags-dir-recursively (current-dir)
278 "Find the directory in which the default TAGS file lives.
279It is the first directory that contains a file named TAGS
280encountered when recursively searching upward from CURRENT-DIR."
281 (let ((tag-filename (expand-file-name "TAGS" current-dir)))
282 (if (file-exists-p tag-filename)
283 current-dir
284 (let ((parent-dir
285 (file-name-directory (directory-file-name current-dir))))
286 (if (string= parent-dir current-dir) ;; root dir is reached
287 nil
288 (tags--find-default-tags-dir-recursively parent-dir))))))
289
290;;;###autoload 277;;;###autoload
291(defun visit-tags-table (file &optional local) 278(defun visit-tags-table (file &optional local)
292 "Tell tags commands to use tags table file FILE. 279 "Tell tags commands to use tags table file FILE.
@@ -301,7 +288,7 @@ in is given a local value of this variable which is the name of the tags
301file the tag was in." 288file the tag was in."
302 (interactive 289 (interactive
303 (let ((default-tag-dir 290 (let ((default-tag-dir
304 (or (tags--find-default-tags-dir-recursively default-directory) 291 (or (locate-dominating-file default-directory "TAGS")
305 default-directory))) 292 default-directory)))
306 (list (read-file-name 293 (list (read-file-name
307 "Visit tags table (default TAGS): " 294 "Visit tags table (default TAGS): "