Monolith149 Daily

Another place to see what KG is doing...

Text Mode and Auto Fill Mode

Day 29

I finally did something I’ve meant to do for a while. I configured emacs to automatically use text-mode and auto-fill-mode for Markdown files. Markdown files end in either .markdown or .md in my experience so far. These blog posts are written in Markdown.

Since text-mode and auto-fill-mode weren’t automatic, I had to execute them manually using M-x (that’s the ESC key followed by “x” in emacs) everytime I opened one of those files, e.g., to write a blog post.

Adding the following lines to my .emacs file in the home directory fixed this.

;;; Add markdown files to text-mode.
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . text-mode))
(add-to-list 'auto-mode-alist '("\\.md\\'" . text-mode))

;;; Make auto-fill-mode the default for text-mode.
(add-hook 'text-mode-hook 'turn-on-auto-fill)