Subject: bug#12939: 24.3.50; [PATCH] `icomplete-mode' should respect `completion-ignored-extensions'

From: "Drew Adams" <[email-masked]>
Date: Mon, 19 Nov 2012 14:15:39 -0800

(setq icomplete-with-completion-tables  t)
 
`icomplete-mode' shows, e.g., names of files ending with `~'.  It should, but it
does not, respect `completion-ignored-extensions'.

This is apparently because `completion-all-sorted-completions' does not respect
it either (which is, however, TRT).

Seems like some other function should be used, which returns all completions
like `completion-all-sorted-completions' does (and like `all-completions' does),
but which also respects `completion-ignored-extensions'.

I see comments in minibuffer.el indicating that this is a more general bug,
which you presumably intend to fix in a more general way.

But this problem for icomplete.el has existed since Emacs 23.1, so why not fix
it there while waiting for an ideal, general solution.  Attached is a patch that
I think DTRT.

(FWIW, I do something similar in icomplete+.el, and it seems to work fine.  I
use `all-completions' instead of `completion-all-sorted-completions', however,
so the call to `completion-pcm--filename-try-filter' need not come after setting
the last cdr to nil.)

[BTW - `completion-pcm--filename-try-filter' should not be considered internal
(internal to what?), IMO.  And it should be renamed.  It has nothing to do with
pcm (or with icompletion, for that matter).  And it really doesn't have anything
particular to do with `all-completions' vs `try-completion'.  All it does is
filter its list arg ALL to make the elements respect
`completion-ignored-extensions'.  It is essentially a remove-if
ignored-extension function - name it accordingly.]

[BTW2 - Remind me again why `icomplete-with-completion-tables' is not a
defcustom?  And why the default value, even for the defvar, is not t?]

In GNU Emacs 24.3.50.1 (i386-mingw-nt5.1.2600)
 of 2012-11-05 on MS-W7-DANI
Bzr revision: 110809 [email-masked]
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
 `configure --with-gcc (4.7) --no-opt --enable-checking --cflags
 -I../../libs/libXpm-3.5.10/include -I../../libs/libXpm-3.5.10/src
 -I../../libs/libpng-1.2.37-lib/include -I../../libs/zlib-1.2.5
 -I../../libs/giflib-4.1.4-1-lib/include
 -I../../libs/jpeg-6b-4-lib/include
 -I../../libs/tiff-3.8.2-1-lib/include
 -I../../libs/libxml2-2.7.8-w32-bin/include/libxml2
 -I../../libs/gnutls-3.0.9-w32-bin/include
 -I../../libs/libiconv-1.9.2-1-lib/include'