Function: smart-ancestor-tag-files

smart-ancestor-tag-files is a byte-compiled function defined in hmouse-tag.el.

Signature

(smart-ancestor-tag-files &optional DIRS NAME-OF-TAGS-FILE)

Documentation

Walk up DIRS trees looking for NAME-OF-TAGS-FILE.

DIRS may be a list of directories or a single directory. Return a tags table list in DIRS order, where for each directory, list the found tags tables from furthest to nearest.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hmouse-tag.el
;;; ************************************************************************
;;; Private functions
;;; ************************************************************************

(defun smart-ancestor-tag-files (&optional dirs name-of-tags-file)
  "Walk up DIRS trees looking for NAME-OF-TAGS-FILE.
DIRS may be a list of directories or a single directory.
Return a tags table list in DIRS order, where for each directory,
list the found tags tables from furthest to nearest."
  (or dirs (setq dirs default-directory))
  (let ((tags-table-list)
	tags-file)
    (apply #'nconc
	   (mapcar (lambda (dir)
		     (setq tags-table-list nil
			   tags-file nil)
		     (while (and
			     (stringp dir)
			     (setq dir (file-name-directory dir))
			     (setq dir (directory-file-name dir))
			     ;; Not at root directory
			     (not (string-match
				   (concat (file-name-as-directory ":?") "\\'")
				   dir)))
		       (setq tags-file (expand-file-name (or name-of-tags-file "TAGS") dir))
		       (if (file-readable-p tags-file)
			   (setq tags-table-list (cons tags-file tags-table-list))))
		     tags-table-list)
		   (if (listp dirs) dirs (list dirs))))))