Search code examples
emacsido

emacs ido-ignore-directories and files don't ignore the all list


I'm trying to ignore cmake generated files and directories and ., .. in Emacs ido.

This is my Emacs config:

(setq ido-show-dot-for-dired nil)
(setq ido-ignore-directories '("CMakeFiles/" ".git/" ".bin/" "Testing/" "tmp/"))
(setq ido-ignore-files '("\.cmake" "CMakeCache.txt"))

It hides .git, *.cmake and CMakeCache.txt, but it still suggests Testing, .., . and CMakeFiles in auto-completion.


Solution

  • From the documentation of those variables, it is not abundantly clear (to me anyway) how they work/which functions they affect, so I share your confusion.

    For the function in question, ido-find-file per comments, modifying the ido-ignore-files variable to include the unwanted directories should be sufficient.

    After a little further investigation -- tracing the ido library and calling ido-find-file -- I can say with uncertainty that ido-ignore-directories is not directly relevant here, the (shortened) code path being

    ido-find-file -> ... -> ido-make-file-list -> ... -> ido-file-name-all-completions