Apple's TextEdit program is a convenient utility that allows for quick viewing of various basic text formats, including standard TXT and RTF formats, as well as other ASCII text documents such as property lists, HTML, and programming and scripting codes. Many people have come to rely on TextEdit for making small and quick changes to files, but recently some have encountered a problem in Lion's version of TextEdit in which the program does not seem to handle file name extensions properly.
MacFixIt reader "Edward" writes:
TextEdit insists on adding .txt [to documents] no matter what. There are many file types that contain plain text that can be usefully edited with TextEdit, but it's a pain in the you know what to have to use the finder to change the extension back after editing with TextEdit. For example, I like to edit html files in plain text mode with TextEdit. But then I wind up with something.txt rather than something.html.
This problem is not universal, and in a correspondence with Edward I was not able to replicate the issue myself; however, in an Apple Support discussion thread on the problem it appears others are experiencing it as well.
If you are having this problem with TextEdit, do know Apple is aware of it and a fix will likely be included in the OS X 10.7.2 update that is due out any day now. Until then, or if the fix does not make it into the update, there are a couple of things you can try:
Delete TextEdit's preferences
As this is a known bug, removing the preferences file for the program may not have much of an effect; however, it will not hurt to try. The preferences file is called "com.apple.TextEdit.plist" and is located in the /username/Library/Preferences/ folder. To get to the user library in Lion, hold the Option key and select Library from the Finder's Go menu.
Use another editor
There are numerous alternative text editors out there that will work just as well as, if not better than, TextEdit. One of the most popular ones is the free TextWrangler utility from Bare Bones Software, and there are command-line tools like vi and pico/nano. Lastly, if you have Apple's Xcode developer tools installed, you can use them to edit text files.