Excluding in the Emacs file completion buffer
I realized tonight While hacking on Taboot that Emacs was showing particularly_ uninteresting _files in the completion buffer when opening a file. For example, scripts.pyc
.
I assumed that there was a facility for customizing this, so I did some research on the topic. Trying emacs filter possible completions and emacs filter list of completions both came up with the same documentation. The GNU documentation describes a customization facility similar to the filtering I sought after via the completion-ignored-extensions
variable (part of the Dired group). However, it stops a bit short of what I was looking for. Quote from describe-variable
for the variable (emphasis added):
Completion ignores file names ending in any string in this list. It does not ignore them if all possible completions end in one of these strings <strong>or when displaying a list of completions.</strong>
I went through some more search results and sure enough, stackoverflow provides again. In that response the author provided a fantastic defadvice
which did exactly what I was looking for. By default it uses the value of your existing completion-ignored-extensions
variable.