From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Buffer-local process environments Date: Sat, 28 Aug 2021 17:33:34 +0300 Message-ID: <83zgt1myf5.fsf@gnu.org> References: <87eeets6jf.fsf@gmail.com> <8735v99f4i.fsf@gmail.com> <87y2d1xada.fsf@gmx.de> <877dkkcjrj.fsf@gmail.com> <87tunoyzzd.fsf@gmx.de> <87eeerby1n.fsf@gmail.com> <87a6pfepo6.fsf@gmx.de> <874kflmzn3.fsf@gmail.com> <87wns9glm1.fsf@gmx.de> <87y2co4hto.fsf@gmail.com> <87v97reubc.fsf@gmx.de> <87lf4lkb1w.fsf_-_@gmail.com> <837dg5oidr.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6507"; mail-complaints-to="usenet@ciao.gmane.io" Cc: michael.albinus@gmx.de, arstoffel@gmail.com, monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Arthur Miller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Aug 28 16:34:50 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mJzQ1-0001Tp-Bo for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Aug 2021 16:34:49 +0200 Original-Received: from localhost ([::1]:40596 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mJzPz-0000cv-Qh for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Aug 2021 10:34:47 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58422) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mJzP6-0008Nc-Qh for emacs-devel@gnu.org; Sat, 28 Aug 2021 10:33:52 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:38184) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mJzP5-0002F4-4w; Sat, 28 Aug 2021 10:33:51 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4105 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mJzP3-0007jc-Mo; Sat, 28 Aug 2021 10:33:50 -0400 In-Reply-To: (message from Arthur Miller on Sat, 28 Aug 2021 16:06:19 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:273310 Archived-At: > From: Arthur Miller > Cc: Augusto Stoffel , michael.albinus@gmx.de, > monnier@iro.umontreal.ca, emacs-devel@gnu.org > Date: Sat, 28 Aug 2021 16:06:19 +0200 > > > And I'm not sure I understand the rationale, and you didn't describe > > it. Environment variables and PATH in particular are generally global > > on the entire system, so what does this feature correspond to? > > separate environment variables in each shell window? Why would anyone > > want to do that? And why should we make it easier by providing > > buffer-local values of those, instead of letting each Lisp program > > that needs it let-bind the variables instead? > > Excuse me if I ask here, it is probably more help than contribution to this > discussion. Is it possible to let-bind environment variables so that a > subprocess inherit those? Of course. You let-bind process-environment, and then change the local value. We have a number of places where we do that. > (defun emacs-vision--get-date () > (let ((lang (concat "LANG=" emacs-vision-locale)) > (lctime (concat "LC_TIME=" emacs-vision-locale))) > (with-temp-buffer > (insert > (shell-command-to-string > (concat lang lctime " date +'%A, %B %d'"))) > (goto-char (- (point-max) 1)) > (buffer-substring-no-properties > (line-beginning-position) (line-end-position))))) > > Do I understand correctly, this patch will let me have separate process > environment, so I could use separate environment variables in subprocess? Yes, but that's not what you were asking about, I believe.