Subject: Re: bug#16577: Add regexp-based version of completion-ignored-extensions

From: Lars Ingebrigtsen <[email-masked]>
Date: Sun, 20 Feb 2022 14:26:47 +0100

Glenn Morris <[email-masked]> writes:

> In the short term, maybe it would be better if .git etc were removed
> from completion-ignored-extensions.

This was eight years ago, which is probably still short term in Emacs
years.

Anyway, this problem is still present in Emacs 29.  To reproduce:

mkdir /tmp/dir
mkdir /tmp/dir/a.git
mkdir /tmp/dir/aCVS
mkdir /tmp/dir/b
mkdir /tmp/dir/c
emacs -Q /tmp/dir
M-x ido-mode
C-x C-f

Notice that it only completes to b and c, and a.git and aCVS are
excluded.  This is because:

completion-ignored-extensions
=>
(".o" "~" ".bin" ".lbin" ".so" ".a" ".ln" ".blg" ".bbl" ".elc" ".lof" ".glo" ".idx" ".lot" ".svn/" ".hg/" ".git/" ".bzr/" "CVS/" "_darcs/" "_MTN/" ".fmt" ".tfm" ".class" ".fas" ".lib" ".mem" ".x86f" ".sparcf" ".dfsl" ".pfsl" ".d64fsl" ".p64fsl" ".lx64fsl" ".lx32fsl" ".dx64fsl" ".dx32fsl" ".fx64fsl" ".fx32fsl" ".sx64fsl" ".sx32fsl" ".wx64fsl" ".wx32fsl" ".fasl" ".ufsl" ".fsl" ".dxl" ".lo" ".la" ".gmo" ".mo" ".toc" ".aux" ".cp" ".fn" ".ky" ".pg" ".tp" ".vr" ".cps" ".fns" ".kys" ".pgs" ".tps" ".vrs" ".pyc" ".pyo")

So we're using this mechanism to try to exclude directories named "CVS",
which end up excluding directories called "aCVS".

I think perhaps of introducing a regexp-based extra mechanism here that
we should introduce a new completion-ignored-files variable, which would
default to '(".svn/" ".hg/" ".git/" ".bzr/" "CVS/" "_darcs/" "_MTN/")
(probably), and then remove those from -extensions.

However, this will require a lot of work --
completion-ignored-extensions is used many places (and it's commonly
used as a regexp), so it may require rewriting a whole bunch of stuff.
And it'll be slightly non-backwards-compatible if a user has removed
"CVS/" from the old variable, and then it reappears in the new one.

But it sounds worth doing, I think.

Anybody have any opinions?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no