Fix wrong-type-argument error opening new files

Caused when either your snippets library is empty or a file-template
doesn't exist when expanded.
This commit is contained in:
Henrik Lissner 2018-08-14 14:56:19 +02:00
parent 5bb40e6dd1
commit 486d4a12e7
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -79,10 +79,10 @@ evil is loaded and enabled)."
(unless yas-minor-mode
(yas-minor-mode-on))
(when (and yas-minor-mode
(yas-expand-snippet
(yas--template-content
(cl-find trigger (yas--all-templates (yas--get-snippet-tables mode))
:key #'yas--template-key :test #'equal)))
(when-let*
((template (cl-find trigger (yas--all-templates (yas--get-snippet-tables mode))
:key #'yas--template-key :test #'equal)))
(yas-expand-snippet (yas--template-content template)))
(and (featurep 'evil) evil-mode)
(and yas--active-field-overlay
(overlay-buffer yas--active-field-overlay)