Change the function of caps lock to insert underscores when the spacebar is hit Is there a way I can change the function of my caps lock key so that when it's on it inserts_underscores_instead_of_spaces_when_i_hit_the_spacebar?

It's fine if it just works in Textmate but would be handy in other apps.
You should be able to achieve this with Ukelele.  I tried to do this myself but got distracted and then gave up.  The documentation isn't exactly stellar.  

Note:  Ukelele is just a GUI to simplify the process of editing the layouts manually as they are large XML files with slightly ambiguous element names.