Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • One idea would be to get the frame coordinates and determine if those points fall within the boundaries of the main frame in the center of the the desk. I opened a suggestion a year or two ago to permit Emacs to accept applescript, but there was never any response -- by enabling applescripting in the plist of the Emacs.app bundle, it is possible to get desktop frame coordinates using the applescript. In terms of targeting a specific frame with dispay-buffer, here is an example: stackoverflow.com/questions/18346785/… Commented Aug 10, 2015 at 7:40
  • Here is a link to the feature request, which contains an example of how to enable applescripting: lists.gnu.org/archive/html/bug-gnu-emacs/2014-08/msg00487.html Here is a related snippet to get bounds with an applescript: (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))))) Commented Aug 10, 2015 at 7:47
  • I hope that there's an easier way to do that. I'm inclined to believe that this functionality is present in Emacs itself, because Desktop Save Mode restores frames on their original displays… Commented Aug 10, 2015 at 12:38
  • A brief look at desktop.el reveals that it uses frameset-save to 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.el doesn'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). Commented Aug 10, 2015 at 18:25