I am defining a new major mode, foo-mode
, which is closely and only associated with .foo
files. Should foo-mode.el
fiddle with auto-mode-alist
to add this association, or is that the user's responsibility?

- 135
- 6
2 Answers
Note that if your library is intended to be installed via package.el (or similar) and you have included an autoload cookie for foo-mode
, and you choose to implement the auto-mode-alist
manipulation, then you will want to use an autoload cookie for that as well. Otherwise the user would need to either load your library before visiting a *.foo
file, or else write their own auto-mode-alist
entry.
I don't think there's a hard and fast rule about this. I suspect that now that ELPA is pretty standard, it's more common for packages to update auto-mode-alist
automatically, to streamline the installation process. I'd say just use your own judgement, and be sure to still provide equivalent manual installation instructions in your commentary.

- 48,657
- 3
- 76
- 115
I'd say yes. If the user has installed foo-mode
, they have installed it to use with .foo
files. When I run emacs -Q
, there are 184 items in the list (including .org
, .java
, .xml
, .letter
, and more, so it's not kept too small.

- 8,984
- 2
- 31
- 65