3

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?

2 Answers 2

5

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.

3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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