Re: [textadept] Re: Poll on language modules

From: mitchell <c....at.caladbolg.net>
Date: Mon, 7 Mar 2011 16:02:47 -0500 (Eastern Standard Time)

Hi,

On Sun, 6 Mar 2011, Brian Schott wrote:

> This was easy:
>
> events.connect("language_module_loaded", function(lang)
> if lfs.attributes(_USERHOME.."/modules/"..lang.."/user_init.lua") then
> user_dofile("modules/"..lang.."/user_init.lua")
> end
> end
> )
>
> Then add something like this to the user_init.lua file:
>
> _G.snippets.java["test"] = [[This is a test]]
>
> I'm not too attached to the name 'user_init.lua', but I think this kind
> of functionality could be useful in the default install.

I like this, but prefer 'post_init.lua' to 'user_init.lua'. I will commit
changes and documentation later this evening.

1. If you have a module init.lua, it will be loaded instead of the
default.
2. If you have a post_init.lua, it will be loaded after the default. This
way you could have something like:

   module('_m.lua', package.seeall)

   function set_buffer_properties()
     buffer.use_tabs = true
   end

Customization should be much easier now.

Thanks!
mitchell
Received on Mon 07 Mar 2011 - 16:02:47 EST

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