The visible area across your displays has a contiguous coordinate space. The top left of the main display (the one with the menu bar on it) is (0, 0). So, opening a frame on a specific display is just a special case of opening a frame in a particular location.
First move the frame where you want it, then use (frame-parameters)
to get the top/left values. Normally the result of (frame-parameters)
is an alist (list of pairs), something like this:
(... (top . 54) (left . 107) ...)
But if you have displays above or to the left of the main display, the top/left values for windows on that display will be negative. Emacs's GUI support, coming originally from X11, didn't have any concept of negative coordinates. If you try to use negative values, Emacs interprets them as relative to the bottom/right of the main display instead — probably not what you want.
There's a hack in the frame parameter alist to handle this situation: when storing negative top/left values, the corresponding list items are a list of three items instead. For example:
(... (top + -51) (left + -1674) ...)
Normally you can provide these items directly to make-frame
, but it doesn't understand this hack. Instead, you can make the frame and immediately move it by modifying its parameters. For example, I've got a 1680x1050 display to the left and slightly above my main display, so this works to display a new frame on that display:
(modify-frame-parameters (make-frame) '((top + -51) (left + -1674)))
Personally I just use Moom, since it's easier to use and more flexible. I create a new frame with C-x 5 2
in Emacs then use Moom keyboard shortcuts to move it to another display, or wherever else I want it.