(progn (sleep-for 5) (x-focus-frame nil))
focuses the Emacs frame, but also makes it the "key window" (ie, when you type, the keypresses gets sent to this window, which may or may not be the frontmost window).
"x-focus-frame is a built-in function in C source d", I don't know where to look for related functionality.
The motivation is that I want one of my Emacs frames to always be on top, so I can keep an eye on the terminal output, while still being able to type into whatever application I'm currently using (e.g. the browser).
orderFront would work, if this behavior were exposed (https://stackoverflow.com/questions/4859974/make-nswindow-front-but-not-in-focus)
also, if this is impossible, how hard you think it would be to expose this functionality for the next release? For portability, I think (some?) Linux have the same concept ("key window" versus "frontmost window"); I don't know about MS Windows.