1

I'm using yasnippet to create a template for org-mode tables. This works fine, and allows me to create default values (placeholders) for the column headers. The default values are highlighted by default and get replaced when I enter actual names for the columns.

# -*- mode: snippet -*-
# name: orgtable 
# key: orgtable
# --
| ${1:column A}      | ${2:column B}      | 
|--------------------+--------------------|
| $0                 |                    |
|--------------------+--------------------|

However, when I try to do the same thing for the org-mode caption line, it doesn't work. The default values do NOT get overwritten.

# -*- mode: snippet -*-
# name: orgtable 
# key: orgtable
# --
#+CAPTION: ${1:Title} 
| ${2:column A}      | ${3:column B}      | 
|--------------------+--------------------|
| $0                 |                    |
|--------------------+--------------------|

How do I get the second version of the snippet to respect the default values, i.e. overwrite them when I type?

6
  • 1
    Please try this in a minimal setup to see if one of your settings is getting in the way. The second snippet works for me (GNU Emacs 24.5.1, yasnippet version 0.8.0beta). Jan 22, 2016 at 1:14
  • 1
    This is Yasnippet bug #644
    – npostavs
    Jan 22, 2016 at 6:05
  • @Constantine I can confirm that this did work correctly when I launched Emacs with --no-init. I'm not sure how to go about tracking down the incompatibility. My config files are extensive, so bisecting / sequentially disabling them would be impractical. Jan 27, 2016 at 8:41
  • This is just a guess, but I suspect that you are using a somewhat-recent development version of yasnippet. Upgrading to 0.9.1-snapshot or downgrading to 0.8.0 may help. Jan 27, 2016 at 15:42
  • @Constantine I think you were right. Instead of loading yasnippet from elpa manually, I tried just adding Spacemacs' auto-completion layer, which includes yasnippet. Something about that configuration fixed the problem. Jan 27, 2016 at 21:42

1 Answer 1

0

Per @Constantine's comment above, this seems to have been a problem with the version of yasnippet I was using. I use Spacemacs, and I resolved the problem by removing yasnippet from my manual package configuration, and instead enabling the spacemacs auto-completion layer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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