I use emacsclient as my git commit editor.

This is what I have in my init file:

(require 'git-commit)
(add-hook 'git-commit-mode-hook 'turn-on-flyspell)

I just made a huge commit (update of a third-party SDK, which I have in my own repo). Emacsclient took absurdly much time spell checking what looks to be all the source files, instead of the commit message only. Like 15 minutes.

The default commit message shows the name of all changed files.

  • is flyspell trying to spell check everything because the filenames are in the default commit message?
  • is magit the problem, trying to display diff? In that case, how can I setup my hook so that the commit message is spell checked, but not the source diff? I don't think I have spell check activated when I run magit normally.

1 Answer 1


The problem is that flyspell indeed checks the text in the comments (*), which is why git-commit.el provides an alternative to turn-on-flyspell that doesn't have that issue.

(add-hook 'git-commit-setup-hook 'git-commit-turn-on-flyspell)

Also note that this uses a hook different from the one you were using.

(*) Well kind of, see https://github.com/magit/magit/commit/24c966082bdfb16552c7f35bcd38426a321c4b89.

  • I've tried with git-commit-turn-on-flyspell, both with the hook you suggested and the one I used to use. Still checking an awful lot. I have to kill emacs (kill -9, even).
    – Gauthier
    May 9, 2018 at 15:26
  • With no hook at all (well, I'm not sure if magit doesn't add something there), the text shows up fine, but the buffer is very slow to navigate. The size of the COMMIT_EDITMSG is roughly 7000 rows.
    – Gauthier
    May 9, 2018 at 15:29
  • The minor modes I have left are Async-Bytecomp-Package Auto-Composition Auto-Compression Auto-Encryption Auto-Fill Blink-Cursor Dtrt-Indent Dumb-Jump Electric-Indent File-Name-Shadow Flx-Ido Font-Lock Git-Commit Global-Cwarn Global-Font-Lock Global-Git-Commit Ido-Everywhere Line-Number Mouse-Wheel Shell-Dirtrack Show-Paren Tooltip With-Editor Ws-Trim. But maybe that'd be for another question.
    – Gauthier
    May 9, 2018 at 15:34
  • There isn't much anyone else can do for you at this point. You will have to figure out yourself what part of your setup triggers the issue. A good way to accomplish this is to do a binary search on your configuration by commenting out parts of it, and then other parts, or only a subset, until you have found the cause.
    – tarsius
    Jun 3, 2018 at 4:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.