Re: [textadept] Re: Poll on language modules

From: Brian Schott <briancsch....at.gmail.com>
Date: Fri, 4 Mar 2011 15:26:32 -0800

Well, yes. I'd have to name it something other than "init.lua", but I
think the idea works. The example code you posted is very similar to
what I was thinking of. I'll create a sample implementation later
tonight and post it here for discussion.

On Fri, Mar 4, 2011 at 12:57 AM, Robert <ro....at.web.de> wrote:
> On Thu, Mar 3, 2011 at 10:46 PM, Brian Schott <briancsch....at.gmail.com> wrote:
>> So I would need to:
>> 1) Put my keyboard overrides and snippets in
>> ~/.textadept/modules/<lang>/init.lua.
>> 2) Create an event handler for language_module_loaded in my init.lua
>> file that then takes the lang parameter and looks for
>> ~/.textadept/modules/<lang>/init.lua folder and then runs it.
>>
>>
>> Can the second part of this functionality be included in TA by
>> default? This way you can add language module extensions by just
>> dropping them in the correct folder.
>>
> This wouldn't work I think, because due to the path order TA would
> have already loaded your module. One could use it like this:
>
> events.connect('language_module_loaded',
>  function(lang)
>    if lang == 'python' then -- only minor additions
>      _m.snippets.python.p = 'print(%0)'
>      return
>    elseif lang == 'java' then -- load submodule with additions
>      require 'java.mystuff'
>      return
>    end
>  end)
>
> Robert
>
> --
> 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.
>
>
Received on Fri 04 Mar 2011 - 18:26:32 EST

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 12:00:56 EST