How to tell emacs/etags to ignore errors if any of the file in tags-table-list is invalid?

StackOverflow https://stackoverflow.com/questions/6354086

  •  28-10-2019
  •  | 
  •  

Question

I use (setq tags-table-list <> <> .. <>) (in ~/.emacs) to tell emacs/etags to look for TAGS files in the directories mentioned. Some of these directories are not always present or mounted. So whenever I search for any tag, emacs will throw error saying "File <> is not a valid tags table". Is there anyway to tell emacs to ignore that file and proceed looking in other directories ?

Update:
In continuation to the previous question, is there any way to tell emacs to ignore the TAGS files which are existing but not in valid format ?

Thanks.

Was it helpful?

Solution

You can filter the files upon startup:

(require 'cl)
(setq tags-table-list (remove-if (lambda (elt) (not (file-exists-p elt))) 
                                 '("path1" "/dev/null" "~/.emacs" "dude")))

OTHER TIPS

Try using file-exists-p as shown here. The same function works for directories too.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top