I have a multi-monitor setup, in which a specific monitor has a dedicated Emacs frame in full screen which shows compiler errors (from Compilation Mode or SBT Mode). I'd like to preserve the setup automatically, even if I click on an error location in that frame. Specifically, if the dedicated “error” frame is selected,
display-buffer should show an buffer in the “main frame” where I do my editing.
The “main frame” is the one on my primary monitor, which stands in the center of my desk. It's also the “official” primary monitor as per global display settings in the OS X system configuration.
To make sure that buffers are shown at the right place, I need to find out whether a certain frame is on the primary display or not. Is that possible, and if so, how?
A platform independent approach would be great, but if that is not possible, a solution for OS X is also fine.
dispay-buffer, here is an example: stackoverflow.com/questions/18346785/…
(let ((script (concat "tell front window of application \"Emacs\"\n" "get bounds\n" "end tell"))) (start-process "maximize" nil "osascript" "-e" script) (set-process-filter (get-process "maximize") (lambda (proc string) (message (propertize (format "Bounds of Frame: %s" (car (split-string string "\n"))) 'face 'font-lock-warning-face)))))
desktop.elreveals that it uses
frameset-saveto record the frame-related data -- e.g.,
(frameset-save (frame-list)). The cons cells of
(left . ...)and
(top . ...)may be helpful to determine if a frame falls within the boundaries of the primary display. My guess is that
desktop.eldoesn't identify particular displays per se, but instead creates new frames (based upon the stored data) when Emacs restarts -- similar to setting the
frame-parameters(top/left controls the x/y coordinates of the upper left-hand corner of each frame).