1

When I hit C-x C-f to open the "Find file" thing, I can hit TAB to open up a buffer called *Completions* that lists the possible filenames with the given prefix.

Sometimes I have a bunch of backup and intermediate files I want Emacs to ignore, but unfortunately, as explained in the documentation,:

Emacs disregards completion-ignored-extensions when showing completion alternatives in the completion list.

So in a directory containing two files, foo and foo~, with completion-ignored-extensions set to ("~"), tapping TAB lists both in the *Completions* buffer. Is there any way to change this behavior and list only foo?

  • The documentation for that variables says "It does not ignore them if all possible completions end in one of these strings or when displaying a list of completions." So (1) the behavior you observe is intended, (2) I think it probably still won't offer you to complete foo~, it's just listing it. – Omar Aug 23 at 16:54
  • Sorry if I wasn't clear—I know it's not a bug; I'm just looking for a way to modify the default behavior. (I have these directories with a lot of source files, and it's basically listing three copies of everything: the source file, some intermediate compilation file that gets generated, and the backup file. It's a bit much.) – greatBigDot Aug 23 at 16:58
  • I just found this comment in minibuffer.el :) "Bugs: - completion-all-sorted-completions lists all the completions, whereas it should only lists the ones that `try-completion' would consider. E.g. it should honor completion-ignored-extensions." – Omar Aug 23 at 17:04
  • Oh, huh. I figured it was intended since it was in the documentation. Well, hopefully someone has a workaround. – greatBigDot Aug 23 at 17:09
2

Yes, vanilla Emacs is weak/broken wrt option completion-ignored-extensions.

If you use Icicles there is no such problem. When a file name is ignored it is ignored completely; it is not shown in *Completions*.

And in Icicles you can toggle this ignoring off or on at any time during completion, using C-. in the minibuffer.

See Icicles - File-Name Completion Tips.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.