Dear Michael, Dear TM Developers,

I hope I am writing to the right address (I am also copying that into 
textmate-dev list in case Allan or someone else is packaging this bundle for 
TM2). I have made few improvements (working on TM2 alpha here) to Lua.tmbundle. 
I am publishing these as GitHub repo here:

https://github.com/nanoant/Lua.tmbundle.mod

This is not Lua.tmbundle fork, but textual mods only (reason explained in the 
repo README). Please see changelog of this repo for details. Changes are split 
into "atomic" commits so it should be convenient to apply them back to original 
bundle.

Changes:
• formatting error (stderr) output of Lua interpreter
• fix folding for anonymous functions and use then, do, repeat keywords that 
are present just before block start
• fix grammar for anonymous functions and missing not operator
• fix grammar for function calls
• add syntax highlight for non built-in function calls and table fields
• add syntax highlight for LuaJIT FFI cdef blocks

I hope you (and other Lua developers using TM) will find these changes useful, 
as they really enhance syntax highlight and readability of Lua source code 
inside TM.



I think stderr redirector trick deserves some extra attention here. It took me 
really a while to find proper solution (without using named pipes). The trick 
idea is following:

( ( command_producing_stdout_n_stderr | stdout_formmatter_cmd ) 3>&1 1>&2 2>&3 
| stderr_formatter_cmd ) 2>&1

Pipe redirections and subshells ensure that stdout & stderrs are piped through 
separate formatter commands, final pipe redirection ensures that stderr and 
stdout are mixed into single stdout that goes synchronously to HTML output.

This trick makes possible to wrap stderr into "error" class spans for HTML 
output, so errors are marked red in HTML output (previously stderr was not 
formatted at all in Lua tmbundle). Once installed one can try this feature with 
this simple script that interleaves stdout and stderr lines:

io.stderr:write('err\n')
os.execute('sleep 1')
print('out')
io.stdout:flush()
os.execute('sleep 1')
io.stderr:write('err\n')
os.execute('sleep 1')
print('out')
io.stdout:flush()
os.execute('sleep 1')
io.stderr:write('err\n')
os.execute('sleep 1')
print('out')

IMHO it would be cool to move this trick into bash_init, as something like 
"pre2" function for other bundles.

Waiting for your feedback,

Best wishes for the upcoming new year,
-- 
Adam Strzelecki

_______________________________________________
textmate-dev mailing list
textmate-dev@lists.macromates.com
http://lists.macromates.com/listinfo/textmate-dev

Reply via email to