3 May 2011 03:32
Re: how to make a snippet which takes an infinite number of parameters?
I'd be willing to help with the implementation if you have ideas to share. On May 2, 2011, at 2:01 PM, Joao wrote: > Notice that what you're requesting is not quite the same as the python > snippets, which have a finite number of fields, but the mirror system > parses the possibly infinite number of arguments in the active field, > and shows each one in a separate line. > > I think this is only possible if you use the "# type: command" > directive in the snippet header, a feature present only in the trunk > version. But it's really not easy at the moment, and I don't have time > to provide an implementation. You would need a per-snippet exit hook > that allowed you to expand another snippet. That's currently on the > wishlist but I don't have time to implement it in yasnippet.el. > > Look through the archives of this mailing to find a good working > example where you provide the dimensions of a matrix through the > minibuffer. The generated snippet then has a variable number of > fields. It's not quite what you requested but might be useful. > > João > > On May 2, 9:26 pm, Shaleh <sha...@...> wrote: >> Say I want to allow for the following result: >> >> repeating a=3 b=3 c=5 .... >> >> So at input time I would see something like: >> func<tab> (outputs repeating <cursor>=) >> repeating a<tab>= (outputs repeating a=<cursor>) >> repeating a=3<tab> (outputs repeating a=3 <cursor>=) >> >> and so on. So this way I can keep pressing tab and entering values. >> When I press enter or otherwise stop adding values the loop ends. >> >> Is there a way to accomplish this? Looking at the python 'class' >> example I see some elisp generating output based on the addition of >> arguments to the __init__() method. It was not clear that this >> mechanism could be manipulated to give me the result I want though. >> What I want is something like "func ($1=$2)+" to say it with regex. > > -- > 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-snippet@... > To unsubscribe from this group, send email to smart-snippet+unsubscribe <at> googlegroups.com. > For more options, visit this group at http://groups.google.com/group/smart-snippet?hl=en. > -- -- 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-snippet@... To unsubscribe from this group, send email to smart-snippet+unsubscribe <at> googlegroups.com. For more options, visit this group at http://groups.google.com/group/smart-snippet?hl=en.
RSS Feed