Re: Lua Rocks

From: Robert <>
Date: Thu, 13 May 2010 11:43:56 +0200

On Thu, May 13, 2010 at 6:15 AM, phayz <> wrote:
> On May 13, 1:07 pm, Jay <> wrote:
>> Right now adding module/function/fixes to one's Textadept is kind of
>> messy. So I was wondering if anyone has tried using "Lua Rocks", maybe
>> we could set a module repository or something, and allow patching with
>> Rocks or something.
>> Disclaimer: I've never used Lua Rocks, and have no idea how it works,
>> but have heard about it and guess it's supposed to work like a package
>> system. In other words I have no idea what I'm talking about, but
>> someone might actually know a bit and have an actual idea/plan :)
> OK - I am not a computing noob, but certainly a noob to Textadept.
> Like others, I am attracted to Textadept by the ease of its
> customisation, which surely rivals that of editors such as vi etc
> (please, no flame war thankyou). However, having to copy and paste
> text into files and sometimes, take into account the resulting order
> of those lines, is a hassle. I recently found that a feature I wanted
> just wanted working and, after some to-in and fro-ing, found that if I
> rearranged the lines of a file a little, the feature when worked.
> In summary then, as a user I don't care how it's done but I definitely
> would like to see Textadept's customisation made easier and more
> reliable. I say "I don't care how" but that doesn't mean I don't care
> about Textadept itself. Of course I didn, otherwise I wouldn't be
> bothering this group with every little function and feature that I
> can't get to work. :P
> Regards,
> Russell Dickenson

Not Luarocks but an idea:
Why not automatically load files from a certain location, as a proof
of concept I put the following in my personal init.lua:

local lfs = require 'lfs'
for f in lfs.dir(_USERHOME..'/modules/common/') do
  if f:find('%.lua$') then

This "requires" all files in modules/common
As an example I have Brian's wrap.lua there and a file somekeys.lua
with some custom key commands, containing something like:
local keys = _G.keys
keys['f9'] = { function()

Someone could write a file licensesnippets.lua, like
local snippets = _G.snippets
snippets.gpl = 'GPL...' = 'MIT...'
which would enable these snippets globally.

I'm not sure but I think it is okay to use require
( like dofile.
If something is a proper module like the wrap.lua file it gets loaded
as _m.common.wrap.
The loading snippet above could be expanded to allow for modules in
directories with an init.lua.
I just tested this briefly but if something like this would be
included in Textadept's init.lua installation instructions could be
simplified to "drop this file in ~/.textadept/modules/common/".
Where to put user key_commands would need some consideration as they
need to be done after defining the functions in the modules.
Maybe loading a key_commands.lua file last like:

local lfs = require 'lfs'
for f in lfs.dir(_USERHOME..'/modules/common/') do
  if f:find('%.lua$') and f ~= 'key_commands.lua' then


You received this message because you are subscribed to the Google Groups "textadept" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at
Received on Thu 13 May 2010 - 05:43:56 EDT

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