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.
This commit is contained in:
Henrik Lissner 2018-08-30 17:40:33 +02:00
parent 33d692a6be
commit 68e2b814e7
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -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)