Question

I'm using some snippet I found from the internet.

And I encounter lots of error when using them.

for example,

printf ("${1:%s}\\n"${1:$(if (string-match "%" text) "," "\);")
}$2${1:$(if (string-match "%" text) "\);" "")}

This is a printf snippet for c mode. But it always gave me [yas] elisp error! Symbol's value as variable is void: text

So is there any bug in this piece of code or bug at somewhere else? If so, how can I debug it?

Was it helpful?

Solution

It seems that the snippet you are using was written for older versions of yasnippet because the variable text was renamed to yas-text in newer versions, try replacing text with yas-text in the snippet.

I case you are not aware you can use yas/tryout-snippet to quickly try out snippets while editing them.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top