1

Sadly, my Emacs is too old (and not mine to upgrade) and so I can't run markdown-mode. I'd like to set a buffer to fill mode when I open an .md file.

Is there a simple way to do this? The whole add a hook approach seems like overkill, but maybe it's the only way?

Ray Salemi
  • 113
  • 4

1 Answers1

3

The variable auto-mode-alist controls setting the mode for a file based on the file extension. You can add an element for .md files with this:

(add-to-list 'auto-mode-alist
         '("\\.md\\'" . auto-fill-mode))

Note that auto-fill-mode is a minor mode, so the major mode in this case will be the default fundamental-mode. Depending on what you want to achieve, it might be better to set markdown files to use text mode, and add a hook for text-mode to apply auto-fill-mode in text modes.

Tyler
  • 21,719
  • 1
  • 52
  • 92