PSPad – New INI file for Lua

July 15, 2008

The INI file for Lua that ships with PSPad doesn’t include all the Lua library functions so I added them (shamlessly copying from the key file of Crimson Editor).

Here it is:

;PSPad user HighLighter definition file
[Settings]
Name=Lua
HTMLGroup=0
Label=1
FileType=*.lua
CommentString=--
SQLComment=1
LuaComment=1
IndentChar=
UnIndentChar=
TabWidth=2
CaseSensitive=1
SingleQuote=1
DoubleQuote=1
KeyWordChars=_.
CodeExplorer=ftUnknown
[KeyWords]
and=
break=
do=
else=
elseif=
end=
false=
for=
function=
if=
in=
local=
nil=
not=
or=
repeat=
return=
then=
true=
until=
while=
[ReservedWords]
_G=
_VERSION=
assert=
collectgarbage=
coroutine.create=
coroutine.resume=
coroutine.status=
coroutine.wrap=
coroutine.yield=
debug.debug=
debug.gethook=
debug.getinfo=
debug.getlocal=
debug.getupvalue=
debug.sethook=
debug.setlocal=
debug.setupvalue=
debug.traceback=
dofile=
error=
gcinfo=
getfenv=
getmetatable=
io.close=
io.flush=
io.input=
io.lines=
io.open=
io.output=
io.read=
io.stderr=
io.stdin=
io.stdout=
io.tmpfile=
io.type=
io.write=
ipairs=
loadfile=
loadlib=
loadstring=
math.abs=
math.acos=
math.asin=
math.atan=
math.atan2=
math.ceil=
math.cos=
math.def=
math.exp=
math.floor=
math.frexp=
math.ldexp=
math.log=
math.log10=
math.max=
math.min=
math.mod=
math.pi=
math.pow=
math.rad=
math.random=
math.randomseed=
math.sin=
math.sqrt=
math.tan=
next=
os.clock=
os.date=
os.difftime=
os.execute=
os.exit=
os.getenv=
os.remove=
os.rename=
os.setlocale=
os.time=
os.tmpname=
pairs=
pcall=
print=
rawequal=
rawget=
rawset=
require=
setfenv=
setmetatable=
string.byte=
string.char=
string.dump=
string.find=
string.format=
string.gsub=
string.len=
string.lower=
string.rep=
string.sub=
string.upper=
table.concat=
table.foreach=
table.foreachi=
table.getn=
table.insert=
table.remove=
table.setn=
table.sort=
tonumber=
tostring=
type=
unpack=
xpcall=
[KeyWords2]
[KeyWords3]

Msys + makefiles + your editor

July 15, 2008

How to marry an editor like Crimson Editor (or the Emerald Community version) with msys/mingw and makefiles?. For long time I simply switched back and forth between the msys window and CEDT, I don’t know why I waited so long to make this integration but it has been a great time saver for me. I hope it will be for you as well.

By the way, this methods works with other editors as well. If you use PSPad you can easily adapt this explanations to it.

Create a batch file (cedt_mk.bat) with this one line:

C:/msys/1.0/bin/sh –login -c “cd ‘%1′ ; cd `pwd`; make %2″

and store it in the msys /usr/bin directory (C:/msys/1.0/bin in my installation).

This batch file starts the msys shell and sets up all the environment variables as if you had login, so if your makefile depends on variables you set on your .profile, it will work.
It then goes to the directory specified by the first argument, where it expects to find a makefile, and makes the target specified by the second parameter.
Note that the first cd will receive a path in MSDOS format (e.g. ‘D:\projects’) that the shell will convert to ‘/d/projects’. However there is a bug in msys when the UNIX path ends with ‘/’. To fix it a cd to the current directory (cd `pwd`) is needed

Now add a couple of “tools” to CEDT through the “Tools/Conf. User Tools…”:

Crimson Editor Tools menu

Crimson Editor Tools menu

I defined two. The first one as “Make …” that will prompt for the name of the target (second argument set to $(UserInput).

Will ask for the target name

Will ask for the target name

and the second one as “Make Selected” that will use the selected word as the name of the target (second argument set to $(CurWord).

Target will be the current/selected word

Target will be the current/selected word

I mapped them to F9 and Ctrl+F9 respectively.

Having set the first “Argument” and the “Initial Dir” to $(FileDir), the makefile used will be the one stored in the same directory of the current file. This may work or not for you depending on the structure of the directories in your project.
I usually have a makefile for each directory in the project (src, test, docs, …) but sometimes I use a single makefile in the root directory of the project. In that case setting the first argument of cedt_mk.bat to “$(FileDir)\..”  would have worked.  Of course one could play with the cedt_mk.bat script to add more intelligence to it. I will be happy to hear any improvement.

Having set to option “Capture Output”, I will get all the error messages directly in the output pane of CEDT. If I only could jump directly the file/line when an error occurs …


Follow

Get every new post delivered to your Inbox.