emacs: yasnippet: don’t expand on SPC in git-commit-mode
[~bandali/configs] / .emacs.d / init.el
index e316de7..6210f90 100644 (file)
@@ -568,10 +568,10 @@ For disabling the behaviour for certain buffers and/or modes."
                           'magit-insert-modules
                           'magit-insert-stashes
                           'append)
                           'magit-insert-modules
                           'magit-insert-stashes
                           'append)
-  (magit-add-section-hook 'magit-status-sections-hook
-                          'magit-insert-ignored-files
-                          'magit-insert-untracked-files
-                          'append)
+  ;; (magit-add-section-hook 'magit-status-sections-hook
+  ;;                         'magit-insert-ignored-files
+  ;;                         'magit-insert-untracked-files
+  ;;                         'append)
   (setq magit-repository-directories '(("~/" . 0)
                                        ("~/src/git/" . 1)))
   (nconc magit-section-initial-visibility-alist
   (setq magit-repository-directories '(("~/" . 0)
                                        ("~/src/git/" . 1)))
   (nconc magit-section-initial-visibility-alist
@@ -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)
   (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)
   (yas-global-mode))
 
 (use-package debbugs)