I got

(setq-default fill-column 80)
(setq-default truncate-lines nil) ;; which is default

When using magit in Emacs, I know that I should avoid long commit messages, but sometimes they just cannot be avoid.

The problem is: (setq-default truncate-lines nil) which is default setting does not work in magit: project buffer(there is a straight right arrow at the end of line), the (setq-default fill-column 80) does not work in COMMIT_EDITMSG buffer, and the fill-column value in it is 72 not 80.

But what I really want is: make the truncate-lines to nil in magit: project buffer as well so I can see long lines in one window but not break it into several different lines, AND turn on auto-fill-mode in COMMIT_EDITMSG buffer, so long commit messages won't be broken into several different lines while I'm typing.

NOTE: DO NOT affect other buffers like magit-log buffer

1 Answer 1

  1. You can add setting specific to magit-status to magit-status-mode-hook:

    (add-hook 'magit-status-mode-hook
              (lambda () 
                 (setq truncate-lines nil)))
  2. Starting with Magit v2.1.0, COMMIT_EDITMSG files are edited usingtext-mode with the minor mode git-commit-mode also turned on. You need to add your configuration to git-commit-mode-hook:

    (add-hook 'git-commit-mode-hook 'turn-off-auto-fill)
  • Thank you for git-commit-mode-hook, and magit-mode-hook does not work for COMMIT_EDITMSG buffer, so I delete your NOTE.
    – CodyChan
    Commented Oct 31, 2014 at 23: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.