From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Multi-tty design (Re: Reordering etc/NEWS) Date: Fri, 18 May 2007 12:27:09 -0400 Message-ID: References: <86lkfrr3s6.fsf@lola.quinscape.zz> <86d513r2i1.fsf@lola.quinscape.zz> <861whjr097.fsf@lola.quinscape.zz> <200705141648.l4EGmmvW007675@oogie-boogie.ics.uci.edu> <85bqgngvos.fsf@lola.goethe.zz> <200705141819.l4EIJLPr009832@oogie-boogie.ics.uci.edu> <85ps53fcm0.fsf@lola.goethe.zz> <200705142004.l4EK4DHg012188@oogie-boogie.ics.uci.edu> <85lkfrf91x.fsf@lola.goethe.zz> <200705142102.l4EL2pHK013655@oogie-boogie.ics.uci.edu> <4649D75C.2090905@lorentey.hu> <464A6144.10905@lorentey.hu> <86ejlfpfdj.fsf@lola.quinscape.zz> <861whepoq7.fsf@lola.quinscape.zz> <868xbmmbji.fsf@lola.quinscape.zz> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1179505649 3904 80.91.229.12 (18 May 2007 16:27:29 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 18 May 2007 16:27:29 +0000 (UTC) Cc: Andreas Schwab , Dan Nicolaescu , Karoly Lorentey , joakim@verona.se, emacs-devel@gnu.org To: David Kastrup Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri May 18 18:27:27 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Hp5Ib-00065i-4d for ged-emacs-devel@m.gmane.org; Fri, 18 May 2007 18:27:25 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hp5Qo-0001q8-RY for ged-emacs-devel@m.gmane.org; Fri, 18 May 2007 12:35:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Hp5Ql-0001pr-10 for emacs-devel@gnu.org; Fri, 18 May 2007 12:35:51 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Hp5Qk-0001pf-B0 for emacs-devel@gnu.org; Fri, 18 May 2007 12:35:50 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hp5Qk-0001pc-3c for emacs-devel@gnu.org; Fri, 18 May 2007 12:35:50 -0400 Original-Received: from 18.red-83-50-230.dynamicip.rima-tde.net ([83.50.230.18] helo=alfajor.home) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Hp5IN-0004o0-2m; Fri, 18 May 2007 12:27:17 -0400 Original-Received: by alfajor.home (Postfix, from userid 20848) id AC1471C5F9; Fri, 18 May 2007 12:27:09 -0400 (EDT) In-Reply-To: <868xbmmbji.fsf@lola.quinscape.zz> (David Kastrup's message of "Fri\, 18 May 2007 16\:49\:53 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) X-detected-kernel: Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:71325 Archived-At: >>> For everything that is not terminal-related, nothing but a single >>> environment makes sense, I think. >> >> Might be. But both the TERM and the DISPLAY variables at least need >> to be adjusted in subprocesses compared to what they were in Emacs's >> own environment. This is true regardless of multi-tty. > Agreed. The TERM adjustment in some of Emacs' code currently is done > using > (let ((process-environment (copy-sequence process-environment))) > (setenv "TERM" ... This code is fine. The problem comes fro code which does *not* touch TERM, and hence the subprocess thinks it's running in an `xterm' (for example) whereas it's really running on an absolutely dumb "terminal", so it may choose to use color escapes and things like that where they're not appropriate. > The point more or less being that this change is not really to the > current tty, but to the exported tty. This is also valid for subprocess run without a tty. >> And furthermore, for the TERM var, we both want to change it in >> subprocesses and keep it for reference. So (still ignoring >> mutli-tty), it would make sense to so something such as introduce a >> new var (could be read-only) say `initial-environment'. >> `process-environment' could start as empty and the environment >> passed to subprocesses would be the combination of >> `process-environment' and `initial-environment', where >> `process-environment' entries would take precedence over entries >> from `initial-environment'. > My proposal was more or less the same, but with `process-environment' > and `initial-environment' being named `terminal-environment' and > `process-environment', respectively. Right. >> This would break your AUCTeX code in a similar way to the current >> multi-tty code, but again, it's easy to fix: just loop over >> `initial-environment' instead of `process-environment'. > Which is easier if `initial-environment' is called > `process-environment'... Well, the opposite is true for existing code that adds stuff to `process-environment'. I believe such code is a lot more widespread. >> If you want this variable to be client-local instead of >> terminal-local, then just make it a global alist associating clients >> to their environments. > The problem is the following: if we get another client into an > existing terminal, do we update terminal-environment or not? If you think this is a problem, then you want terminal-environment to be client-local rather than terminal-local. You may then want to call it client-environment-alist. It's not like it's difficult to implement: it's all managed in server.el, except the "lookup through `foo-filter'" which might be done in the C code when building the environment of a new subprocess. Stefan