Sören Bleikertz
09 Dec 2009

Emacs' auto-mode-alist

I discovered an interesting feature in emacs recently: For editing my blog posts in emacs I require certain modes enabled (e.g. longlines-mode), but these modes should not be enabled for regular text files. Basically the modes should be enabled for the text files in my blog directory.

auto-mode-alist is normally used to enable a major mode for a certain file based on it’s extension, but it is also powerful enough to enable a mode based on a matching regular expression on the file name. For example I use the following code to achieve my desired behaviour.

link