From 68e2b814e7808a5673b184a893c5fa41a85eb9b3 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 30 Aug 2018 17:40:33 +0200 Subject: [PATCH] Fix stringp error when inserting new snippets #852 New snippets (created with yas-new-snippet) may not yet be associated with a file when it is passed to the functions in yas-prompt-functions. One of those functions, +snippets-prompt-private, prioritizes private snippets over default ones, but determines which is which with `file-in-directory-p`, which expects string arguments. To fix this, we can safely assume that if a snippet has no associated file, it is a private snippet. --- modules/feature/snippets/autoload/snippets.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/feature/snippets/autoload/snippets.el b/modules/feature/snippets/autoload/snippets.el index aeeb52720..b283abc3c 100644 --- a/modules/feature/snippets/autoload/snippets.el +++ b/modules/feature/snippets/autoload/snippets.el @@ -7,8 +7,9 @@ are multiple choices." (when-let* ((choices (or (cl-loop for tpl in choices - if (file-in-directory-p (yas--template-get-file tpl) - +snippets-dir) + for file = (yas--template-get-file tpl) + if (or (null file) + (file-in-directory-p file +snippets-dir)) collect tpl) choices))) (if (cdr choices)