Lazy-load yasnippet harder for faster first-file load time

+ Rather than waiting for the first "interactive" major mode to be
  visited to activate yas-minor-mode, we wait until the first time the
  user invokes a snippet command to activate yas-global-mode.
+ yas-reload-all is one of the bottlenecks when loading a file for the
  first time. Deferring it further should help with this.
+ yas-global-mode reaches more major modes than our former list of
  hooks (fixes #5140).

Closes #5140
This commit is contained in:
Henrik Lissner 2021-06-05 12:49:40 -04:00
parent 5038ba9826
commit 60b595321e
4 changed files with 10 additions and 17 deletions

View file

@ -39,13 +39,12 @@
;; Smart tab, these will only work in GUI Emacs
(map! :i [tab] (cmds! (and (featurep! :editor snippets)
(bound-and-true-p yas-minor-mode)
(yas-maybe-expand-abbrev-key-filter 'yas-expand))
#'yas-expand
(and (bound-and-true-p company-mode)
(featurep! :completion company +tng))
#'company-indent-or-complete-common)
:m [tab] (cmds! (and (bound-and-true-p yas-minor-mode)
:m [tab] (cmds! (and (featurep! :editor snippets)
(evil-visual-state-p)
(or (eq evil-visual-selection 'line)
(not (memq (char-after) (list ?\( ?\[ ?\{ ?\} ?\] ?\))))))