all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: x-migrant.el - handle subprocesses over multiple X displays
       [not found] ` <87adez3bj4.fsf@camp4.serpentine.com>
@ 2003-04-10 14:06   ` Stefan Monnier <foo@acm.com>
       [not found]   ` <878yu1q2ag.fsf@camp4.serpentine.com>
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier <foo@acm.com> @ 2003-04-10 14:06 UTC (permalink / raw)


> ;; 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: x-migrant.el - handle subprocesses over multiple X displays
       [not found]   ` <878yu1q2ag.fsf@camp4.serpentine.com>
@ 2003-04-23 20:22     ` Benjamin Rutt
  2003-04-23 21:03       ` John Paul Wallington
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Rutt @ 2003-04-23 20:22 UTC (permalink / raw)


Bryan O'Sullivan <bos@serpentine_junk.free.com_please> writes:

> New version, with tidy-ups suggested by Stefan Monnier.

I think you need a (require 'cl) at the top of your file x-migrant.el.
Otherwise, the function `gensym' will not be defined.
-- 
Benjamin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: x-migrant.el - handle subprocesses over multiple X displays
  2003-04-23 20:22     ` Benjamin Rutt
@ 2003-04-23 21:03       ` John Paul Wallington
  0 siblings, 0 replies; 3+ messages in thread
From: John Paul Wallington @ 2003-04-23 21:03 UTC (permalink / raw)


Benjamin Rutt <rutt+news@cis.ohio-state.edu> wrote:

> I think you need a (require 'cl) at the top of your file x-migrant.el.
> Otherwise, the function `gensym' will not be defined.

Also, to avoid requiring `cl' you could use `make-symbol' instead.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-04-23 21:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <ZvucnQAx2vL2Ag6jXTWcrg@speakeasy.net>
     [not found] ` <87adez3bj4.fsf@camp4.serpentine.com>
2003-04-10 14:06   ` x-migrant.el - handle subprocesses over multiple X displays Stefan Monnier <foo@acm.com>
     [not found]   ` <878yu1q2ag.fsf@camp4.serpentine.com>
2003-04-23 20:22     ` Benjamin Rutt
2003-04-23 21:03       ` John Paul Wallington

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.