joaotavora / yasnippet

A template system for Emacs
http://joaotavora.github.io/yasnippet/
2.81k stars 311 forks source link

elisp evaluation move cursor on new line in snippet body #1191

Closed neuromagus closed 9 months ago

neuromagus commented 9 months ago

I am a newbie in Elisp and Emacs. And I stuck. I trying to create a set of snippets for React and add a few options: (setq react-import t).

`(if (bound-and-true-p react-import)
     "import React from 'react'\n")`
export const ${1:`(file-name-sans-extension (buffer-name))`} = () => {
  ... ... ...
}

in this example, if eval this condition, the Elisp return me empty string:

(here is empty string)
export const Filename = () => {}

How to write a condition correctly so as not to get an empty line?