简体   繁体   English

关闭magit模式提交格式

[英]Turning off magit-mode commit formatting

The recent-ish version of Magit ( Mx magit-version says magit-20131222.850 ) I'm currently using enforces certain annoying properties on commit messages, and colors them oddly. 最近版本的Magit( Mx magit-versionmagit-20131222.850 )我目前正在使用在提交消息上强制执行某些恼人的属性,并将它们奇怪地着色。 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 Mx customize-mode , so I assume the solution will involve some elisp . 我没有看到任何相关的Mx customize-mode ,所以我认为该解决方案将涉及一些elisp

Add the following to your .emacs : 将以下内容添加到.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 Mx customize-face , and use the dialog. 至于字体颜色,我建议你将光标移动到感兴趣的文本,做Mx customize-face ,然后使用对话框。

However, you could do something like this in raw elisp: 但是,您可以在原始elisp中执行以下操作:

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

(In general you can move the cursor to the text of interest and do Mx describe-face to learn what face it is you want to modify.) (通常,您可以将光标移动到感兴趣的文本并执行Mx describe-face以了解您要修改的面部。)

In the latest magit versions (I'm using Magit 20190122.503) you need to use git-commit-setup-hook to make this work: 在最新的magit版本中(我使用Magit 20190122.503)你需要使用git-commit-setup-hook来完成这项工作:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM