summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmin Bandali <bandali@gnu.org>2019-08-27 01:34:03 -0400
committerAmin Bandali <bandali@gnu.org>2019-08-27 01:38:33 -0400
commit5b185efac27892a4c7bc567820442085045d2a8a (patch)
treeca7373fd356184beeae3da32eff23edd8155b719
parent2b3c93ec75a0c69ba421bd11260cd46cac70b536 (diff)
downloadconfigs-5b185efac27892a4c7bc567820442085045d2a8a.tar.gz
configs-5b185efac27892a4c7bc567820442085045d2a8a.tar.xz
configs-5b185efac27892a4c7bc567820442085045d2a8a.zip
emacs: yasnippet: don’t expand on SPC in git-commit-mode
guix provides snippets like ‘add’ [0] which would get auto-expanded in git-commit-mode with SPC, super annoying. [0]: https://git.savannah.gnu.org/cgit/guix.git/tree/etc/snippets/text-mode/guix-commit-message-add-package
Diffstat (limited to '')
-rw-r--r--.emacs.d/init.el11
1 files changed, 10 insertions, 1 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index 4002d9a..6210f90 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -1518,7 +1518,16 @@ This function is intended for use with `ivy-ignore-buffers'."
(add-to-list 'yas-snippet-dirs "~/src/git/guix/etc/snippets" t)
(yas-reload-all)
(setq yas-verbosity yas-verbosity-cur)
- (define-key yas-minor-mode-map (kbd "SPC") yas-maybe-expand)
+
+ (defun b/yas--maybe-expand-key-filter (cmd)
+ (when (and (yas--maybe-expand-key-filter cmd)
+ (not (bound-and-true-p git-commit-mode)))
+ cmd))
+ (defconst b/yas-maybe-expand
+ '(menu-item "" yas-expand :filter b/yas--maybe-expand-key-filter))
+ (define-key yas-minor-mode-map
+ (kbd "SPC") b/yas-maybe-expand)
+
(yas-global-mode))
(use-package debbugs)