4

In emacs, when im typing the begining of a file name, and then press tab for autocompletion, here's what i get :

Possible completions are:

dummy.cmi dummy.cmx

dummy.ml dummy.o

I want emacs to ignore object files (.o, .cmx, .cmi) and directly complete with dummy.ml

Is there a way to specify that behaviour in emacs ? some sort .emacsignore mechanism like in git?

Community
  • 1
  • 1
ghilesZ
  • 1,502
  • 1
  • 18
  • 30

1 Answers1

7

The variable that controls ignored file extensions for completion is completion-ignored-extensions. It should already have a couple of extensions in it, but you can add your own.

If you do M-x customize-variable RET (i.e. Meta+x, type customize-variable and hit Enter) Then type in: completion-ignored-extensions Enter

You will now get a list of what's already in it. You can also delete entries and add new ones.

You can also add this to your init.el/.emacs:

(add-to-list 'completion-ignored-extensions ".blah")

To add multiple elements, instead of duplicating that line:

(setq completion-ignored-extensions
    (append completion-ignored-extensions
        (quote
        (".ext1" ".ext2" ".ext3"))))
sbrk
  • 378
  • 3
  • 10