From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Buffer-local process environments Date: Sat, 28 Aug 2021 17:27:18 +0200 Message-ID: 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> <83zgt1myf5.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11272"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: michael.albinus@gmx.de, arstoffel@gmail.com, monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Aug 28 17:28:05 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 1mK0FX-0002j3-4X for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Aug 2021 17:28:03 +0200 Original-Received: from localhost ([::1]:59228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mK0FW-0000nr-4N for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Aug 2021 11:28:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38520) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mK0Ew-00006l-7o for emacs-devel@gnu.org; Sat, 28 Aug 2021 11:27:26 -0400 Original-Received: from mail-oln040092073074.outbound.protection.outlook.com ([40.92.73.74]:18650 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mK0Es-0004ws-Hr; Sat, 28 Aug 2021 11:27:25 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eweLKJEivMw5Sgivudx7PP60hnndjIXoGmPeQqiC6oAddEpyX4j8hpiqP3CNKpMAw50AntRp+jTVG0SbchVi+9yB0ilmLHSglCmYuFJFA29LfzlH1s6CFyiFnoF4TYqm4yUJZlyczXLyN3we2oejYg2ya2isNtlSDSVTNOL5+kKjXJkvcIv2cteSvgNWFp9O+RU9HXpoORhRr5Pa+RPEIFBFr625suUZq2lhIa82a8LG8H+o8cDlz8Naavj1UV5FPq/nU3LvkMxKQrRQ4pR4gdlY34mF1szUWrf5P4zEnowu4afcnmqwOYQh/yJTPitkFckSuW2pDcyxmUgfjhj8EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CnW/eRnHpVGUUmzFXfQ32EZ8NyiCKhCwkJlD+vvOEko=; b=UxDeb4YkOp4y+5T7zMgtJQPlYk996A7R2Qojdyk6dnWklc2sDK8Zi7r0ve4ZbzXhCX8VRjqhiqXIm9XJchW0HzmrZa3rchwa0PH5bDCYTioHRDIHR29D1FTxs1A7JK55J8ca7Atdbnfx8qzD99YXp0K6Z/OF5utVZRi/VbEJNXqdn6hSqSWMjr5hYvjnXfPzvInqungrxDWq+KY0U7xk8H87n3PN+vSNb8rVs3Vu9811J5TU3B+IUY4f/NYw6Sg66NhXEMIu5IUAjPHS7q18KGkFipOo1ovSOEk5+jOovlNJallFqjOBnXocdQYUfUsX/hb30W9K7h9o77uax5AcCw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CnW/eRnHpVGUUmzFXfQ32EZ8NyiCKhCwkJlD+vvOEko=; b=OpsA3xxRAjfjqlBxUpi+eLEQFVjIz9JqBRtEYSQdAy//5YXiu6Mee2F0hRacuJQpPz9pBK33f8N2jsLQT4V1q8h8SNU8IKeErvTKV25tpkgGIJXLsD7HvKSRUCjx11dz9sF+0JhPxiyUzDBaGbyuAwrJjZLEICCWbBiJjj5S6qBbNhbuzQQRH9wsHL+y1YqbFN16iVHNOy1Z1TrQWVXCGMIn6VV310p5HkGBc2cK9cWTi+uuDYObIjLQRt3vSIa8sZ+rSpleWggbw6pc+e3UM2gyANQomXlJPL4GKupGyhdF7JvMoH1RimO+VVk9TuvDPRBuZboELTwQilUDf8fnRw== Original-Received: from HE1EUR04FT036.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0d::47) by HE1EUR04HT072.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0d::208) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.17; Sat, 28 Aug 2021 15:27:19 +0000 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2a01:111:e400:7e0d::41) by HE1EUR04FT036.mail.protection.outlook.com (2a01:111:e400:7e0d::148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.17 via Frontend Transport; Sat, 28 Aug 2021 15:27:19 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:193A0C0E38495A66B6D37C65E78F8518933C2EA110B986EFB13179EBA2EAE963; UpperCasedChecksum:70ACC9A3C741883F72374180FB2AF432CC735030E4414642B0F4E6420382E65B; SizeAsReceived:7919; Count:46 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::35f2:ac79:ee50:c46c]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::35f2:ac79:ee50:c46c%8]) with mapi id 15.20.4457.023; Sat, 28 Aug 2021 15:27:19 +0000 In-Reply-To: <83zgt1myf5.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 28 Aug 2021 17:33:34 +0300") X-TMN: [Ik/Zhx95Iq/YSzzCQMgr5mELG2zYWfZv] X-ClientProxiedBy: AM6P193CA0097.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:88::38) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <874kb9lhd5.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by AM6P193CA0097.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:88::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.20 via Frontend Transport; Sat, 28 Aug 2021 15:27:18 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 46 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: ffcfa4d4-21b9-4959-4b0c-08d96a38528b X-MS-TrafficTypeDiagnostic: HE1EUR04HT072: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IO9zFWiETayjcdpPGgGpUO7vQVX3gZrFBRKIhyBRLvTWom2CZ2MltSQ5ZD/KeHcE9vPgkyaf50ujwXiaT+XGT3fpkRC9fywaAKaVp58VSar1rjUYAxPJMgG58vWpYdLBSj7csMio/rgrsSErYx+WXZZ276KqU557BMYDxHWN5h8mjzOXAVE9mBxlxkCan4cd/wFSwBgTxwc13/wVrwKU371Jszzl/Ddz3e8RHWssSIJ6cyWnKwEnDM1q1HZCfZmKoTZIPWc0DpFnEht8PYt+VSmmd7XxkDNMegqwgwZQPOnInxVCfHsADtOiLkufnnii91aH0cTvERfOENJt09yYjf34FIvGqxKhlwCB5aeglFoaMN9wnzKd+ANHbctgGfdq8P3kuKRj5g0VZOrhH3drpAcng2JgVKX0Nu7LJgw7giZOFvyJe2EA9dwKj5tgAeU7 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lA978eOPzRJfGPiK3AEvf0MsPdJoSAPmCGGUdGvvfBMPHcfCOBySFPxyXZ3EQhPTLHy9BQeyoJ2nOEwj/M1ntxVQ8iK7Pthjsw0R8K/mVh8lPiTKLiUuJJdcPDhdQKUs5BNFT6c7NsjhwbciQ/AiBw== X-OriginatorOrg: live.com X-MS-Exchange-CrossTenant-Network-Message-Id: ffcfa4d4-21b9-4959-4b0c-08d96a38528b X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2021 15:27:19.0934 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: HE1EUR04FT036.eop-eur04.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1EUR04HT072 Received-SPF: pass client-ip=40.92.73.74; envelope-from=arthur.miller@live.com; helo=EUR04-HE1-obe.outbound.protection.outlook.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, FREEMAIL_REPLY=1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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:273326 Archived-At: Eli Zaretskii writes: >> 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. Ah, ok, I thought it process-environment was for entire Emacs, globally. I just was looking at docs, I haven't seen examples in the code. Thanks. >> (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. Now you make me confused again :). I want my process to use different env for LANG and LC_TIME, but Emacs should continue to work with old values. Concretely I want english date string, but my Emacs should continue to use swedish for it's normal use. So if I let-bind, it will be reflected only localy in that let scope, and the subprocess will inherit that local environment too? That is what I want, and why I went via shell command. Forgive me if I am confused. I hope what you said above is what I want :-).