[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Should this package be included into the NS port?
From: |
Stefan Monnier |
Subject: |
Re: Should this package be included into the NS port? |
Date: |
Sat, 02 Jun 2018 13:22:13 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
> that a glitch has occurred. If anyone knows how to create a hidden frame
> without ever making it visible, I'd be happy to fix that.
server.el supposedly manages to do that. At least, it woprked for me
when I wrote the code, but I don't know if the NS port handles it
correctly:
(defun server-select-display (display)
;; If the current frame is on `display' we're all set.
;; Similarly if we are unable to open frames on other displays, there's
;; nothing more we can do.
(unless (or (not (fboundp 'make-frame-on-display))
(server--on-display-p (selected-frame) display))
;; Otherwise, look for an existing frame there and select it.
(dolist (frame (frame-list))
(when (server--on-display-p frame display)
(select-frame frame)))
;; If there's no frame on that display yet, create and select one.
(unless (server--on-display-p (selected-frame) display)
(let* ((buffer (generate-new-buffer " *server-dummy*"))
(frame (make-frame-on-display
display
;; Make it display (and remember) some dummy buffer, so
;; we can detect later if the frame is in use or not.
`((server-dummy-buffer . ,buffer)
;; This frame may be deleted later (see
;; server-unselect-display) so we want it to be as
;; unobtrusive as possible.
(visibility . nil)))))
(select-frame frame)
(set-window-buffer (selected-window) buffer)
frame))))
-- Stefan