4

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.

Inaimathi
  • 13,853
  • 9
  • 49
  • 93

2 Answers2

7

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.)

Phil
  • 4,767
  • 1
  • 25
  • 21
  • Worked like a charm. The three faces I had to customize were `git-commit-nonempty-second-line-face`, `git-commit-overlong-summary-face` and `git-commit-summary-face`. – Inaimathi May 03 '14 at 15:06
  • I'm running magit 2.6.0, and I had to use `(add-hook 'git-commit-setup-hook 'turn-off-auto-fill t)`. Also, `(setq git-commit-summary-max-length 999)` will keep it from coloring text and warning you when your summary line is too long. – 0x5453 Apr 20 '16 at 18:57
4

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)
John
  • 191
  • 6