> I use M-: they both work. So now you need to figure out why Emacs thinks some other frame (from the one you expect) is selected at the moment in .emacs where those sexps are evaluated. First, do as I said (call `message') to find out which frame is selected.
Try also commenting out or removing everything in your .emacs except those lines. You need to determine if there is something you are doing in .emacs that is interfering or if there is an Emacs bug. Don't hesitate to file a bug. The Emacs developers will work with you to debug it. But first try to narrow things down, to make sure there is nothing else you are doing in .emacs that is interfering. Do your homework first: you don't even know which frame is selected at the time - that's the first step. The second step is to figure out why that wrong frame is selected. If you think it's not your fault but the fault of Emacs, then report a bug.