I use GNU EMACS on multiple monitors from a Windoze PC via VNC.
(Currently 5 – 4 big, 1 the small monitor on my tablet PC. Two vertical 1200×1920, two horizontal 1920×1200, plus the small.)
The way I am currently doing this is to run a separate VNC on each monitor. I then open a single emacs, and use make-frame-other-display to open emacs’ frames in the other VNC window.
To make things more complicated – I run the VNCs on an up-to-date Ubuntu system, but I run the emacs on a quite out of date machine where the rest of the build tools live. I.e. the VNC displays are not local to the same machine as emacs.
Rather than xhost+, I open an xterm in each of the VNCs, and ssh to the machine running emacs. This creates DISPLAYS of the form localhost:16.0. I then use make-frame-on-display using these localhost DISPLAYs.
This gets confusing.
It helps if I leave an “echo $DISPLAY” in the xterm windows. Or chamnge the xterm’s title.
I’d like to similarly change the EMACS’ frames’ titles, to reflect what each frame things is its current DISPLAY. But doing
(defvar frame-title-specific-ag "emacs"
"title element from frame-title-format that is specific to a particular emacs instance; andy glew")
(setq frame-title-format
(list
"frame=%F "
(format "%s" frame-title-specific-ag)
" " 'system-name
" DISPLAY="
(getenv "DISPLAY")
" %b"
" " (format "pid:%d" (emacs-pid))
" user:"(user-login-name))
)
only gets the DISPLAY variable for the entire emacs.
Q: is there a way to find out the display associated with any particular frame?
To get the display name for the current frame, use
or replace
nilwith a specific frame to get the name of its display instead of the current one. For example, use this to show the display in the title:Note that it is important that this form is completely quoted, so the list that is used has an
:evalwhich tells Emacs to run the code whenever it renders a frame title. Without that, you might be tempted to write something like:but this doesn’t work. The problem is that the function call happens immediately when this form is evaluated, and the result is a list holding a particular string, which is the name of whatever frame was in effect this evaluation happened, and the string will not change magically.