Distraction free writing with Emacs

1 min read Original article ↗

The majority of my writing is done inside org-mode, but I also use org-mode to manage projects so I don't want every buffer to use these settings. For writing projects I use a .dir-locals.el file to automatically enable specific modes and to increase the font size.

((org-mode . ((eval . (progn (turn-off-auto-fill)
			     (text-scale-set 1)))
	      (fill-column              . 80)
	      (visual-fill-column-width . 80)
	      (olivetti-body-width      . 80)
	      (mode . olivetti)
	      (mode . visual-line)
	      (mode . visual-fill-column))))

The code in the eval block turns off hard-wrapping, increases the font size, and enables olivetti-mode.

I use olivetti to narrow the writing area to 80 characters which I find easier to work with. darkroom is a good alternative to olivetti; it provides similar functionality, but also more options and can even set an entirely different font face when enabled.

2021-08-11 edit - Updated .dir-locals.el with new activation as olivetti has removed the turn-on-olivetti-mode function.

~~~
If you found this helpful and would like to read more content like it, follow me on Twitter.