From 5b185efac27892a4c7bc567820442085045d2a8a Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Tue, 27 Aug 2019 01:34:03 -0400 Subject: [PATCH] =?utf8?q?emacs:=20yasnippet:=20don=E2=80=99t=20expand=20o?= =?utf8?q?n=20SPC=20in=20git-commit-mode?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- .emacs.d/init.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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) -- 2.20.1