Searching strategy and underscore

12 views
Skip to first unread message

pi2...@piprime.fr

unread,
Dec 3, 2009, 6:06:18 AM12/3/09
to smart-...@googlegroups.com
Hi,

I've the following problem within php-mode.
str<TAB> recognizes str_getcsv as snippet key but
str_<TAB> does not recognize anything.
str_get<TAB> recognizes only words begining with "get".

Reading http://tinyurl.com/yjz4ay7 it seems that it isn't the default
behavior...

Maybe I misunderstood... Thanks to confirm it.

C-h v yas/version<ret>
yas/version is a variable defined in `yasnippet.el'.
Its value is "0.6.1b"

M-x emacs-version<ret>
GNU Emacs 23.1.50.1 (i486-pc-linux-gnu, GTK+ Version 2.18.3) of \
2009-11-28 on elegiac, modified by Debian
--
Philippe Ivaldi.
http://www.piprime.fr/

João Távora

unread,
Dec 3, 2009, 9:54:02 AM12/3/09
to smart-...@googlegroups.com
Hi! pluskid is the specialist in this stuff, but I'll try to explain
the two distinct cases:

> str<TAB> recognizes str_getcsv as snippet key but
> str_<TAB> does not recognize anything.

I think you're mixing it up... "str<TAB>" will try to find snippets
for the "str" snippet *key*. Another thing is to say that you have the
"str_getcsv" snippet associated with the "str" key.

"str_" will work as a snippet *key* if you have some snippet keyed to
"str_", but it *won't* magically autocomplete to "str_getcsv".

YASnippet is a templating engine, not a completion engine. A very
nice, simple and language-agnostic completion system is bundled with
emacs and is called "hippie-expand". Try 'M-x hippie-expand'.

> str_get<TAB> recognizes only words begining with "get".

`yas/key-syntaxes' has many elements, right? Well, turns out the "word
chars" element of 'yas/key-syntaxes' has precedence over the "word and
punctuation chars" element. "_" being a punctuation char (non-word),
yasnippet won't search further since it already found valid,
expandible snippets for the snipept key "get".

pi2...@piprime.fr

unread,
Dec 3, 2009, 11:54:47 AM12/3/09
to smart-...@googlegroups.com
Le 03 d�ソスcembre 2009, Jo�ソスo T�ソスvora �ソスcrivit :

> I'll try to explain
> the two distinct cases:
>> str<TAB> recognizes str_getcsv as snippet key but
>> str_<TAB> does not recognize anything.
> I think you're mixing it up... "str<TAB>" will try to find snippets
> for the "str" snippet *key*. Another thing is to say that you have the
> "str_getcsv" snippet associated with the "str" key.

"str_getcsv" snippet is associated with the "str_getcsv" NAME (so it
must be associated with the "str_getcsv" key)

> "str_" will work as a snippet *key* if you have some snippet keyed

My problem is�ソス:
why str is autocomplete by Yasnippet to str_getcsv but str_ not.

> YASnippet is a templating engine, not a completion engine.

Yasnippet is an completion engine... for its own templates.

>> str_get<TAB> recognizes only words begining with "get".
> `yas/key-syntaxes' has many elements, right? Well, turns out the "word
> chars" element of 'yas/key-syntaxes' has precedence over the "word and
> punctuation chars" element. "_" being a punctuation char (non-word),
> yasnippet won't search further since it already found valid,

It's a pity�ソス!
Autocomplete str to str_getcsv but not str_ is disconcerting.

João Távora

unread,
Dec 4, 2009, 9:53:53 AM12/4/09
to smart-...@googlegroups.com
yasnippet can be whatever you want it to be because it is free
software. Feel free to fork from it and modify it!

However, the behavior you describe was never a part of yasnippet, not
in its original design by pluskid or ever.

J

On Thu, Dec 3, 2009 at 5:54 PM, <pi2...@piprime.fr> wrote:
> Le 03 décembre 2009, João Távora écrivit :
>
>> I'll try to explain
>> the two distinct cases:
>>> str<TAB> recognizes str_getcsv as snippet key but
>>> str_<TAB> does not recognize anything.
>> I think you're mixing it up... "str<TAB>" will try to find snippets
>> for the "str" snippet *key*. Another thing is to say that you have the
>> "str_getcsv" snippet associated with the "str" key.
>
> "str_getcsv" snippet is associated with the "str_getcsv" NAME (so it
> must be associated with the "str_getcsv" key)
>
>> "str_" will work as a snippet *key* if you have some snippet keyed
>
> My problem is :
> why str is autocomplete by Yasnippet to str_getcsv but str_ not.
>
>> YASnippet is a templating engine, not a completion engine.
>
> Yasnippet is an completion engine... for its own templates.
>
>>> str_get<TAB> recognizes only words begining with "get".
>> `yas/key-syntaxes' has many elements, right? Well, turns out the "word
>> chars" element of 'yas/key-syntaxes' has precedence over the "word and
>> punctuation chars" element. "_" being a punctuation char (non-word),
>> yasnippet won't search further since it already found valid,
>
> It's a pity !
> Autocomplete str to str_getcsv but not str_ is disconcerting.
> --
>   Philippe Ivaldi.
> http://www.piprime.fr/
>
> --
>
> 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.
>
>
>



--
João Távora

pi2...@piprime.fr

unread,
Dec 11, 2009, 5:56:32 PM12/11/09
to smart-...@googlegroups.com
> yasnippet can be whatever you want it to be because it is free
> software. Feel free to fork from it and modify it!

Thanks, I'll think about it.

> However, the behavior you describe was never a part of yasnippet, not
> in its original design by pluskid or ever.

Ok, you're right again. This feature is provided by the package
auto-complete-yasnippet <http://www.emacswiki.org/emacs/AutoComplete>

Thank for your help, I will not bother most.
Reply all
Reply to author
Forward
0 new messages