What are some good open source text editors on Mac OS X?
There is Aquamacs that is a version of Emacs that has been customised to be more OSX like.

Apple supplies the source for TextEdit as an example with Xcode.