I have the following in a snippet's header

expand-env: ((yas-indent-line 'fixed))

...but when I attempt to insert the snippet, I still get a lot of unwanted indentation.

What else can I do to prevent such indentation?

I'm using version 20161022.646 of yasnippet, and version 25.1.1 of Emacs.

  • 1
    Try updating yasnippet? github.com/joaotavora/yasnippet/pull/838 – npostavs Aug 10 '17 at 16:11
  • @npostavs: Thanks; I installed yasnippets via Emacs packages, and it does not show that any updates are available. – kjo Aug 10 '17 at 16:19
  • 1
    Try M-x package-refresh-contents I guess? I've pushed 0.12.1 just a few weeks ago, available both on MELPA and GNU ELPA. – npostavs Aug 10 '17 at 17:28
  • @npostavs: thanks; I had to delete and re-install the package, but I finally got 0.12.1 installed, and that took care of the problem. – kjo Aug 11 '17 at 11:07

This is a bug in versions of yasnippet earlier than 0.12.1 (or somewhere around 20170723.xxx in the MELPA "version" numbering). The best way to fix is to update yasnippet.

Possible workarounds would involve setting yas-indent-line to fixed globally instead of per-snippet.

See also joaotavora/yasnippet#838: Avoid to indent snippets having setup (yas-indent-line 'fixed).

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.