about summary refs log tree commit diff
path: root/emacs/.emacs.d/wpc/wpc-misc.el
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-10-04T13·57+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-10-04T13·57+0100
commit4187e888c8418844ad96ce94b857e96fffac9ee4 (patch)
treeaacdfc1ff299f81cf26cc3426109404e56dcd004 /emacs/.emacs.d/wpc/wpc-misc.el
parent6df182d45e523c08507f509ec5c6dc3c201a5d22 (diff)
Disable company-mode during git commits
Why didn't I configure this earlier? For years, my workflow involved checking a
buffer's major mode and then extending that major-mode's hook. Confusingly (to
me), the `major-mode` for `COMMIT_EDITMSG` is `text-mode`, and I didn't want to
disable `company-mode` for *all* `text-mode` buffers, which is what the
following would have done:

```elisp
(add-hook 'text-mode-hook (lambda () (company-mode -1))
```

Thankfully I recently invested some time into learning more about Emacs's
offline help system, `Info-mode`, so -- putting that knowledge to work -- I ran
`info-apropos` and searched "magit commit". After ~5 minutes of reading I knew
the recommended way of configuring this was to modify `git-commit-setup-hook`.

How validating!
Diffstat (limited to 'emacs/.emacs.d/wpc/wpc-misc.el')
-rw-r--r--emacs/.emacs.d/wpc/wpc-misc.el1
1 files changed, 1 insertions, 0 deletions
diff --git a/emacs/.emacs.d/wpc/wpc-misc.el b/emacs/.emacs.d/wpc/wpc-misc.el
index 3850558cf69c..f58bdeeee9ad 100644
--- a/emacs/.emacs.d/wpc/wpc-misc.el
+++ b/emacs/.emacs.d/wpc/wpc-misc.el
@@ -127,6 +127,7 @@
 ;; git integration
 (use-package magit
   :config
+  (add-hook 'git-commit-setup-hook (lambda () (company-mode -1)))
   (setq magit-display-buffer-function
         #'magit-display-buffer-fullframe-status-v1))