[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: x-migrant.el - handle subprocesses over multiple X displays
From: |
Stefan Monnier <address@hidden> |
Subject: |
Re: x-migrant.el - handle subprocesses over multiple X displays |
Date: |
10 Apr 2003 10:06:41 -0400 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 |
> ;; This package advises the Emacs process startup functions, so that
> ;; they set up the DISPLAY environment variable correctly. This is
> ;; very useful if you run the same Emacs session on multiple X
> ;; displays at once, and sometimes need to pop up an X application
> ;; from within Emacs.
Sounds cool. Maybe this should be integrated directly in the C code.
> (defmacro current-x-display-name ()
> "Return the name of the currently active X display, or nil for none."
> (if xm-running-xemacs
> '(if (eq (frame-type) 'x)
> (device-connection))
> '(frame-parameter nil 'display)))
Testing for `xemacs' is generally bad style. How about:
(if (fboundp 'device-connection)
(defun current-x-display-name ()
(if (eq (frame-type) 'x)
(device-connection)))
(defun current-x-display-name ()
(frame-parameter nil 'display)))
or
(defun current-x-display-name ()
"Return the name of the currently active X display, or nil for none."
(if (fboundp 'device-connection)
(if (eq (frame-type) 'x)
(device-connection))
(frame-parameter nil 'display)))
> (defmacro with-current-x-display (&rest body)
> "Evaluate BODY with the DISPLAY environment variable set correctly.
> In this case, we take 'correct' as being the display on which the
> frame that currently has the focus is showing."
> (let ((dpy (gensym "dpy-")))
Better use `make-symbol' which is more efficient and doesn't require CL.
> (process-environment
> (if ,dpy
> (mapcar (function (lambda (env)
> (if (string-match "^DISPLAY=" env)
> (concat "DISPLAY=" ,dpy)
> env)))
> process-environment)
> process-environment)))
You don't need to replace DISPLAY, you can simply add another one and it
will shadow any potential older one:
(process-environment
(if ,dpy
(cons (concat "DISPLAY=" ,dpy) process-environment)
process-environment)))
> (if xm-running-xemacs
Better test for (fboundp 'start-process-internal)
and (fboundp 'call-process-internal).
Stefan
- Re: x-migrant.el - handle subprocesses over multiple X displays,
Stefan Monnier <address@hidden> <=