I was reading an article about well-formatted Git commits, and I was wondering how I could apply some of the rules to the Magit log mode.
It seems to use 3 major modes simultaneously: Magit
, Log
, Edit
.
So how would I get just those modes, when used together, to hard-wrap at 72 characters automatically?
There can be only one major mode in Emacs buffer (unless you are using something like MMM or MuMaMo). In your case that one major mode is magit-log-edit-mode
, whose name consists of three words ("Magit Log Edit"). You can just add to it whatever hook you like:
(defun my-turn-on-auto-fill ()
(setq fill-column 72)
(turn-on-auto-fill))
(add-hook 'magit-log-edit-mode-hook 'my-turn-on-auto-fill)