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?

  • 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). – Constantine Jan 22 '16 at 1:14
  • 1
    This is Yasnippet bug #644 – npostavs Jan 22 '16 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. – incandescentman Jan 27 '16 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. – Constantine Jan 27 '16 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. – incandescentman Jan 27 '16 at 21:42
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, privacy policy and cookie policy

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