From 486d4a12e7d86378bfe6ae32917d96a0b0964517 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 14 Aug 2018 14:56:19 +0200 Subject: [PATCH] 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. --- modules/feature/file-templates/autoload.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/feature/file-templates/autoload.el b/modules/feature/file-templates/autoload.el index b92d410c6..2c07c6b51 100644 --- a/modules/feature/file-templates/autoload.el +++ b/modules/feature/file-templates/autoload.el @@ -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)