5

Yasnippet seems to be working but the trigger key is not. I can load snippets, look at snippet tables and M-x yas/expand. However, after typing a trigger key (i.e time) I'd like to expand the snippet with the TAB key which isn't working. I checked the yasnippet.el file and found that the yas-trigger-key is set to . I tried changing it and still couldn't get it working. Anyone have an idea about what's going on? I'm trying to get this working first in LaTeX mode. Yasnippet tells me I should also try C-c C-s but that just seems to insert "\end."

I downloaded Yasnippet via the el-get packager manager. I'm using OSX and emacs 23.4.1

akobre01
  • 777
  • 1
  • 10
  • 22
  • Could you try M-x yas-expand RET (after your i.e. time)? – PascalVKooten Oct 25 '12 at 22:48
  • Yup, that works fine...it just doesn't like tab – akobre01 Oct 25 '12 at 22:52
  • 1
    Can you hit C-h k and then hit TAB? See what TAB is currently bound to (maybe it's not even TAB)? – PascalVKooten Oct 25 '12 at 22:53
  • "TAB runs the command indent-for-tab-command, which is an interactive compiled Lisp function in `indent.el'...." it's now bound correctly. I tried to change it but it didn't work... – akobre01 Oct 26 '12 at 03:41
  • Well, TAB is supposed to run yas-expand, and if there is nothing to expand, then it should do whatever the user has assigned to TAB. That is a matter of correctly installing yas though. – PascalVKooten Oct 26 '12 at 06:21
  • Sorry, I meant it's *not* bound correctly. Weird. I can write "time", push tab, and nothing happens (I have yas-minor-mode enabled). I can then do M-x yas-expand and it gets expanded... – akobre01 Oct 26 '12 at 13:27
  • So can you use "C-h k TAB" ? press those keys? See what it is bound and copy it here. – PascalVKooten Oct 26 '12 at 14:32
  • TAB runs the command forward-button, which is an interactive compiled Lisp function in `button.el'. It is bound to TAB. (forward-button N &optional WRAP DISPLAY-MESSAGE) Move to the Nth next button, or Nth previous button if N is negative. If N is 0, move to the start of any button at point. If WRAP is non-nil, moving past either end of the buffer continues from the other end. If DISPLAY-MESSAGE is non-nil, the button's help-echo string is displayed. Any button with a non-nil `skip' property is skipped over. Returns the button found. – akobre01 Oct 26 '12 at 15:44
  • 'TAB (translated from ) runs the command yas-expand, which is an alias for `yas-expand-from-trigger-key' in `yasnippet.el'. It is bound to TAB, . (yas-expand &optional FIELD) Expand a snippet before point. If no snippet expansion is possible, call command....' – PascalVKooten Oct 26 '12 at 22:49
  • In other words, it isn't bound correctly. – PascalVKooten Oct 26 '12 at 22:51

1 Answers1

2
(add-to-list 'load-path "~/.emacs.d/plugins/yasnippet")
(require 'yasnippet)
(yas-global-mode 1)

Did you put the aforementioned in your .emacs?

Maybe try reinstalling from this recent link

BinaryButterfly
  • 18,137
  • 13
  • 50
  • 91
PascalVKooten
  • 20,643
  • 17
  • 103
  • 160
  • 1
    I finally got it working by using hippie-expand. Thanks for taking the time to try and help. I found the following very helpful: https://gist.github.com/215930 . That's what I'm currently using and it seems to work...we'll see how it fares in the long run. Thanks again! – akobre01 Oct 27 '12 at 15:05