In Emacs, I usually end up enabling the same set of minor modes when I use one of my “writing modes”, namely modes like markdown-mode and org-mode. Enabling a single minor mode automatically is generally pretty easy via the appropriate mode hook, but enabling more than one minor mode requires one more level of indirection. Of course it does, because everything in computer science requires one more level of indirection :).
In this particular case, the level of indirection required is a small function that enables the required minor modes. The one I use for my writing modes looks like this:
;; Helper functions to enable multiple minor modes (defun enable-writing-minor-modes () "Enable flyspell and visual line mode for calling from mode hooks" (visual-line-mode 1) (flyspell-mode 1))
I can then tie this together calling the helper fuction from the appropriate mode hook. I use
use-package for most external packages and most conveniently,
use-package already has a helper for the mode hook. My total
use-package configuration for
markdown-mode then looks like this:
(use-package markdown-mode :ensure t :defer t :hook (markdown-mode . enable-writing-minor-modes))
There are a couple of different ways to specify the hook, consult the
use-package documentation for more information. This one works on my machines.