Saturday, May 15, 2004


I somwhat find the xemacs code for etags better, amongs other things you can specify a list where to search for TAGS files. While this macro isn't that sophisticated it covers my needs 99% of the time.

(defadvice find-tag (before c-tag-file activate)
 "Automatically search for tags in higher directories."
 (let ((file1  (concat default-directory "TAGS"))
       (file2  (concat default-directory "../TAGS"))
       (file3  (concat default-directory "../../TAGS")))
   (let ((tag-file
          (cond ((file-exists-p file1) file1)
                ((file-exists-p file2) file2)
                ((file-exists-p file3) file3)
                (t nil))))
     (when tag-file
       (visit-tags-table tag-file)))))

No comments: