patch for yasnippet.el 0.2.2

3 views
Skip to first unread message

Trey Jackson

unread,
Mar 13, 2008, 4:49:22 PM3/13/08
to smart-...@googlegroups.com
All,

Watched the video tutorial for yasnippet, way cool.

I've made some changes, please feel free to incorporate them if you think
them appropriate:

added: yas-mode
yas is now a minor mode, not a global override of the yas/trigger-key
(this enables it to co-exist with other packages that use TAB,
e.g. pabbrev, there are still order dependencies, but they can both work
now)
this also allows user to turn it off easily (as opposed to restarting emacs)

changed: TAB
there was some hard-coding of the <TAB> key, so fixed that place to use
the variable yas/trigger-key

obsoleted: yas/trigger-fallback
this is no longer needed as yas is a minor mode, the 'fallback' can be
computed on the fly and called with 2 lines, also this will work in modes
that have different bindings for whatever the trigger-key is.

mode-hooks:
yas/define-snippets updated to add the function 'yas-mode-on to all the
mode-hooks for modes that have snippets defined

yas/initialize:
no longer does a global binding (i left the menu stuff alone)

I verified this works for me, and I have the yas/trigger-key defined as SPC.

TJ

--
Trey Jackson
bigfa...@gmail.com

"It is not the answer that enlightens, but the question."
-- Decouvertes

Trey Jackson

unread,
Mar 13, 2008, 5:00:00 PM3/13/08
to smart-...@googlegroups.com
Errr....

helps if I attach the diff.

yas-patch.diff

Chiyuan Zhang

unread,
Mar 15, 2008, 7:07:20 AM3/15/08
to smart-...@googlegroups.com
Hi! Thanks for your patch. I'll look at it later.

I come along with the fall-back solution but don't know the minor-mode
version. Maybe yours is a good idea. I'll try it! :)

As with the mode-hook. Have you encountered some mode without a hook?
The early days when I written smart-snippet(which use abbrev-table). I
found some mode without abbrev-table. So I'm afraid to encounter some
mode without hook.

Also, the hierarchy has changed to allow user to define some "virtual
mode" as the parent mode (or common mode). For example: a
common-c-mode for c-mode, c++-mode and java-mode. There should be any
hook for those "virtual mode". So I need to re-consider this.

Anyway, Thanks for your patch!

2008/3/14, Trey Jackson <bigfa...@gmail.com>:


> Errr....
>
> helps if I attach the diff.
>
>
>
> >
>

Petteri

unread,
Mar 15, 2008, 8:38:10 AM3/15/08
to smart-snippet
Trey Jackson kirjoitti:
> All,
>
> Watched the video tutorial for yasnippet, way cool.
>
> I've made some changes, please feel free to incorporate them if you think
> them appropriate:
>
> added: yas-mode
> yas is now a minor mode, not a global override of the yas/trigger-key
> (this enables it to co-exist with other packages that use TAB,
> e.g. pabbrev, there are still order dependencies, but they can both work
> now)

This part of the patch is especially nice. Just tried it with smart
tab ( http://www.emacswiki.org/cgi-bin/wiki/TabCompletion#toc1 ) and
now it and yas-mode works quite nicely together.

Chiyuan Zhang

unread,
Mar 15, 2008, 11:50:52 PM3/15/08
to smart-...@googlegroups.com
Hi! I accept your patch -- it works better than my way! :)
It is included in 0.3.0. Thank you for this patch!

2008/3/14, Trey Jackson <bigfa...@gmail.com>:
>

Reply all
Reply to author
Forward
0 new messages