On 2009-01-11, Aidan Kehoe <kehoea(a)parhasard.net> wrote:
(let ((print-readably nil)
console-details)
(setq console-details
(prin1-to-string
(device-console (frame-device (selected-frame)))))
(if (string-match "#<x-console on
\"\\([^\"]+\\)"
console-details)
(setenv "DISPLAY" (match-string 1 console-details))
(setenv "DISPLAY" original-display))))))
Unfortunately, there’s no nicer way to get the string display name
that a
given console thinks it’s connected to. Maybe we should change that.
This is what I do in my .emacs :
; this overrides make-x-device so as to store the original display
argument
; used to create it. Why? Because device-x-display doesn't exist,
documentation
; notwithstanding, and we need it to pass to external programs.
(defvar x-device-display-alist nil)
; make it robust against repeated loads of .emacs!
(when (and (fboundp 'make-x-device) (not (fboundp
'real-make-x-device)))
(add-hook 'delete-device-hook
(lambda (d) (setq x-device-display-alist
(remassoc d x-device-display-alist))))
(fset 'real-make-x-device (symbol-function 'make-x-device))
(defun make-x-device (&optional display)
"Create a new device connected to DISPLAY, recording DISPLAY in
x-device-display-alist."
(let ((d (real-make-x-device display)))
(setq x-device-display-alist (cons (cons d display)
x-device-display-alist))
d))
;; this returns nil for the initial device, but that's ok, because
;; then the functions will use DISPLAY anyway.
(defun device-x-display (device)
"Return display used to create device."
(cdr-safe (assoc device x-device-display-alist)))
)
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-beta