I use (and switch between) my "favorite browser of the week" (Firefox at the moment) and iChat quite regularly. Until recently, I would also regularly upset myself by closing an active iChat window when I meant to close a browser tab ... it usually went something like this: open a bunch of web pages in tabs, start reading them, get 'pinged' for a reply in an iChat conversation, hit Command-Tab to activate iChat, but keep reading the web page. Finish the web page, hit Command-W and *poof* goes the active iChat conversation!
iChat very nicely asks you if you're sure you want to quit with an active conversation. It not so nicely does not ask if you simply close an active chat window! I was so irked at myself that I set off to find a solution, starting with hacking the code in XCode. But halfway through that exercise, I thought of a much simpler solution...
In addition to assigning new keyboard shortcuts, Panther's Keyboard Shortcuts tab (on the Keyboard & Mouse preferences panel) will also let you reassign an existing keyboard shortcut. So I clicked the "+" sign, set the Applications drop-down to iChat (which I had already quit), entered Close for the Title, and then set the shortcut to Shift-Command-W and hit Add.
Presto, when I re-launched iChat, the Close command had become Shift-Command-W! Now when I invoke my stupidity and hit Command-W in iChat instead of Firefox, I'm simply greeted with a beep, letting me know I tried to do something stupid. I made this change on Saturday, and it probably saved five or six iChat window this weekend alone (yes, I used to do this a lot!).
This trick will, of course, work in any application ... with most applications, you'll also see your re-assignment in the "All Applications" section of the shortcuts list.
Edit: On my home machine, the iChat shortcut doesn't show in the list of customized shortcuts; on my PowerBook, it shows up fine. I guess I've got a corrupted Keyboard pref on the home box. As the comment notes, just delete the custom assignment to get things back to normal...
Mac OS X Hints
http://hints.macworld.com/article.php?story=20040322013808670