Re: Lua Rocks

From: mitchell <mforal.n....at.gmail.com>
Date: Mon, 14 Jun 2010 15:45:59 -0700 (PDT)

Robert,

On Jun 14, 3:00 am, Robert <ro....at.web.de> wrote:
> With the upcoming API changes the first part of simplifying extending
> Textadept seems solved.

Now that I committed a change that creates a user init.lua
automatically, what else extension-wise needs to be addressed?

Mitchell

> How about making it even simpler by creating an user init.lua with
> "require 'textadept'" in
> this step in core/init.lua:
> if not lfs.attributes(_USERHOME) then lfs.mkdir(_USERHOME) end
>
> would become
>
> if not lfs.attributes(_USERHOME) then
>   lfs.mkdir(_USERHOME)
>   local f = io.open(_USERHOME..'/init.lua', 'w')
>   if f then
>     f:write("require 'textadept'", "\n")
>     f:close()
>   end
> end
>
> About the user files key_commands.lua and snippets.lua: I think
> calling them should be removed. Having a user key_commands.lua causes
> problems for authors of extensions. If you have
>
> require 'textadept'
> require 'common.add'
>
> and for common.add would like to add key commands by putting them in
> the user key_commands.lua this will not work because key_commands.lua
> is loaded before the requiring of common.add so the instructions would
> read something like:
> "Put every line with require from textadept/init.lua in your user init.lua,
> require common.add before textadept.keys, add these key commands to
> your key_commands.lua"
>
> Then if another module, common.over, would try to override default key
> commands one would have to make sure that it is called *after*
> requiring the default keys.
> This is way to complicated - I think it should be left to the user
> where to put additional key commands.
>
> An init.lua could then look like:
> require 'textadept'
> require 'common.add'
> require 'common.over'
>
> local keys = _G.keys
> keys.ac = { ... }
>
> user_dofile('keys.lua')
> user_dofile('morekeys.lua')
> user_dofile('snippets.lua')
> user_dofile('supplemental_comments.lua')
>
> What do you think?
>
> As for the auto loading of "common" modules - I realized that the
> place to put this is obviously common/init.lua.
> I'll put this on the wiki.
>
Received on Mon 14 Jun 2010 - 18:45:59 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:45:59 EST