
The most annoying thing with X11 on Mac is the shortcut CMD-W, especially when you are an Emacs user. On Emacs, CMD-W or META-W is the shortcut to put your selection into the cut buffer. But on Mac this is also the shortcut to close the window. This means that every time you type META-W on Emacs your Emacs window closes and you loose everything you are doing.
This recipe will explain how to remove the annoying CMD-W shortcut on X11.
First you need to have Apple’s developer kit called XCode installed. This is free and can be downloaded from Apple’s website here
As you can see on the screenshot below the shortcut is defined in the “Window menu” of the X11 application. To remove this short cut we just need to remove the keys definition (CMD-W) from that menu entry.

The easiest way to do that is to remove the menu item from the Window menu pane. Following these few easy steps can do this.
the very first thing is to quit X11
Open the Terminal.app and type the following command to open the resource file with the Interface Builder.
If you are French or German select the appropriate language$ open /Applications/Utilities/X11.app/Contents/Resources/English.lproj/main.nib
Select the MainMenu pane, then the menu item Window and then the item Close Window. Once the close Close Window item is selected hit the key delete.
you can now save and quit the Interface builder
Restart X11
The menu item Close Window and the short cut CMD-W don’t exist any more. You can type META-W in your Emacs window without losing your work.