Re: [textadept] Re: Poll on language modules

From: Robert <ro....at.web.de>
Date: Fri, 4 Mar 2011 09:57:32 +0100

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
Received on Fri 04 Mar 2011 - 03:57:32 EST

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