Question

The recent-ish version of Magit (M-x magit-version says magit-20131222.850) I'm currently using enforces certain annoying properties on commit messages, and colors them oddly. Specifically, it auto-breaks lines at a certain length and colors the first one green.

Is there any way to disable this, and make it act like the old dumb commit message window? I don't see anything relevant-looking in M-x customize-mode, so I assume the solution will involve some elisp.

Was it helpful?

Solution

Add the following to your .emacs:

(add-hook 'git-commit-mode-hook
          '(lambda () (auto-fill-mode 0))
          ;; append rather than prepend to git-commit-mode-hook, since the
          ;; thing that turns auto-fill-mode on in the first place is itself
          ;; another hook on git-commit-mode.
          t)

As for the font color, I suggest you move the cursor to the text of interest, do M-x customize-face, and use the dialog.

However, you could do something like this in raw elisp:

(set-face-foreground 'git-commit-summary-face "white")

(In general you can move the cursor to the text of interest and do M-x describe-face to learn what face it is you want to modify.)

OTHER TIPS

In the latest magit versions (I'm using Magit 20190122.503) you need to use git-commit-setup-hook to make this work:

(add-hook 'git-commit-setup-hook 'turn-off-auto-fill
          ;; append to end of git-commit-setup-hook to ensure our hook trumps others.
          t)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top