The default behavior of NSWindows and spaces is to move to the space the window was first opened in (unless it has been explicitly moved). The correct behavior is to move to the space the window is in only if it is opened and open it in the current space if it is closed. Mail is the only application I have seen that does this correctly. Is there a way to do this in Cocoa?