1

I am trying to write a snippet to generate different python based on which directory I am in, as in some directories, I am using an older version of python. The snippet is

# key: log
# name: logger
# --
`(if (string-match "/projects/old" default-directory )
     "logger.info('$1: {}'.format($1))"
   "logger.info(f'$1: {$1}')" )
`

This sort of works. It correctly figures out the new/old problem, but yasnippet is not paying attention to the placeholders. An older version using just

     "logger.info('$1: {}'.format($1))"

processed the placeholders as expected, but obviously did not generate both forms. What do I do to enable placeholders inside the return value of a lisp expression?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.