Re: [textadept] Snippets and event.handlers

From: mitchell <c....at.caladbolg.net>
Date: Mon, 9 May 2011 20:31:29 -0400 (EDT)

Robert,

On Mon, 9 May 2011, Robert wrote:

> Hi,
>
> since I never seem to be able to remember the _exact_ event names I
> wanted to have a snippet
> for connecting to an event:
>
> function event_names()
> local buffer = buffer
> local handlers = _G.events.handlers
> local event_names = {}
> for k, _ in pairs(handlers) do
> event_names[#event_names + 1] = k
> end
> table.sort(event_names)
> event_name = gui.filteredlist('Events', 'Events', event_names)
> if event_name then return event_name else return '' end
> end
>
> snippets.ev = "events.connect('%1<event_names()>', %0)"
>
> This would require events.handlers to be a public table. [1]
>
> I also found an issue when there is no explicit %0 at the end of a
> snippet. More details at [2]

Good idea, I've committed some fixes to hg that allow for this.

mitchell

>
> Robert
>
> [1] http://code.google.com/p/textadept/issues/detail?id=148
> [2] http://code.google.com/p/textadept/issues/detail?id=147
>
> --
> You received this message because you are subscribed to the Google Groups "textadept" group.
> To post to this group, send email to textadept.at.googlegroups.com.
> To unsubscribe from this group, send email to textadept+unsubscribe.at.googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/textadept?hl=en.
>
>

mitchell
Received on Mon 09 May 2011 - 20:31:29 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 12:06:39 EST