how to workaround for 2 snippet having same partial words?

21 views
Skip to first unread message

Xah Lee

unread,
Aug 12, 2010, 12:38:31 PM8/12/10
to smart-snippet and YASnippet
hi all,

i have defined snippet for emacs lisp mode, for buffer-substring, like
this:

(buffer-substring START$0 END)

but i have another snippet for substring.

So, when in emacs-lisp-mode, i press Tab after the word buffer-
substring, but the substring expansion is used instead.

What can i do in this situation?

thanks.

Xah

João Távora

unread,
Aug 15, 2010, 7:48:06 PM8/15/10
to smart-...@googlegroups.com
Hi Xah

Try playing with `yas/key-syntaxes'. This is where yasnippet decides how far back from current point to go until it finds an expandable key.
I think the default value is a list that starts with "w", which means "word syntax" and the character "-" doesnt belong to it, for emacs-lisp purposes "-" separates two words.

Try removing this first element

(add-hook 'emacs-lisp-mode-hook
#'(lambda () (set (make-local-variable 'yas/key-syntaxes) (list "w_" "^ "))))

should work, I think, but do try variations on it if you feel like it...
Bye!

> --
> You received this message because you are subscribed to the Google Groups "smart-snippet and YASnippet" group.
> To post to this group, send email to smart-...@googlegroups.com.
> To unsubscribe from this group, send email to smart-snippe...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/smart-snippet?hl=en.
>

Xah Lee

unread,
Aug 15, 2010, 7:54:51 PM8/15/10
to smart-snippet and YASnippet
thanks a lot João. Very helpful. I'll give it a shot.

Xah
Reply all
Reply to author
Forward
0 new messages