Xref: utzoo comp.emacs:5196 comp.windows.x:7629 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!bbn!jr@bbn.com From: jr@bbn.com (John Robinson) Newsgroups: comp.emacs,comp.windows.x Subject: Re: GNU Emacs shell mode and DISPLAY env variable Message-ID: <35443@bbn.COM> Date: 1 Feb 89 14:56:56 GMT References: <35945@think.UUCP> Sender: news@bbn.COM Reply-To: jr@bbn.com (John Robinson) Followup-To: comp.emacs Distribution: na Organization: BBN Systems and Technologies Corporation, Cambridge MA Lines: 36 In-reply-to: barmar@think.COM (Barry Margolin) In article <35945@think.UUCP>, barmar@think (Barry Margolin) writes: >In GNU Emacs 18.52: > >When running GNU Emacs in an X window (using its "-d" option), is >there any way to get shell mode to automatically set the subprocess's >DISPLAY environment variable appropriately, as xterm does? If you set the DISPLAY variable coming into emacs, it will be inherited by the shell. So instead of starting emacs this way: emacs -d unix:0 say (to csh): setenv DISPLAY unix:0 ; emacs Otherwise, you can put a default into .emacs_csh (see help for function shell). >I did an apropos of "^x-" and "display" in Emacs, looking for a >variable or function that would return the current display, but didn't >see anything. Can anyone help me? You can get any environment varilable in emacs' environment with (getenv "VARNAME"). Now, the variable command-line-args ought to have your "-d" and display-name in it, but the X code strips away its args from this list when it starts up. This seems to be a bug. I suspect it is due to the X code really being a graft onto emacs at this point. Really, the switches should be handled in the same loop that handles the rest of the switches to emacs, but it has to run sooner in order to set up the new X window, etc. Maybe v19 will get this better... -- /jr jr@bbn.com or bbn!jr