[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Is there a way to control where frames get created?
From: |
Drew Adams |
Subject: |
RE: Is there a way to control where frames get created? |
Date: |
Sun, 30 Sep 2018 01:37:03 +0000 (UTC) |
> I'd like to rig things up so that make-frame-command creates its new
> frame adjacent to the existing frame if that's geometrically
> possible on the GUI display. To do that, I'd need to both be able to
> find out where the existing frame is, and to tell make-frame-command
> where to create the new frame.
>
> Are there any hooks that make this possible? Any advice on how I might
> go about doing it?
Not sure exactly what you're asking. Adjacent in what direction? What do you
mean by "geometrically possible" - do you mean if the display is wide enough
(if adjacent horizontally) or tall enough (if adjacent vertically)? Do you
allow the existing frame to be resized at all - e.g. to tile it and the new
frame together on the display? Do you allow for multiple monitors - and if so,
in what configurations?
Anyway, you can get the current frame position and size from its frame
parameters, and you can set the new frame position and size based on some
transformation of those of the existing frame.
The code in frame-cmds.el might help, either directly (e.g. if tiling) or
indirectly. See, for example, command `create-frame-tiled-horizontally':
Horizontally tile screen with selected frame and a copy.
The same character size is used for the new frame.
https://www.emacswiki.org/emacs/download/frame-cmds.el