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 16:06:19 +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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5156"; 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, Augusto Stoffel , 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 16:08:04 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 1mJz06-000159-GY for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Aug 2021 16:08:03 +0200 Original-Received: from localhost ([::1]:52014 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mJz05-0004qW-4I for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Aug 2021 10:08:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54114) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mJyya-0003EG-PT for emacs-devel@gnu.org; Sat, 28 Aug 2021 10:06:30 -0400 Original-Received: from mail-am7eur06olkn2028.outbound.protection.outlook.com ([40.92.16.28]:28384 helo=EUR06-AM7-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 1mJyyW-0006FX-T5; Sat, 28 Aug 2021 10:06:28 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BtcZAU9Y+XZxezUTdAhz9pzwVgMdfsOlTgPWF2yEAv5AXKKyKqbsK6z2jFKDE5+cPBgBkDgJjOp3h4emUMfi9wZYuxk1yme/6Dn97h73uVwgMzAlJ8aDX+fVj4eSkSOANOWn0vT+yOAWbKqx9b6x2PxZ+vnx+aUgvHqQ0Y6ZAzGshFCDxKGaZNmadq5fbohHJrnx4/BsQt5D4jGEKmXcgAbnVCedK1DpPr3XCazPe1+nhkePlXyxMjrgQOIXTD2EARVJoxDqOGJCJBakQKMgEMkbinpdJNmTt72UWWJC7+f2ugILare4+evAbiqAou5ZvyOuICijU1ZvwY6+TOJsVA== 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=+djHN9NP4lrXhKCnzYn/5YzreKEGda9rWN3QhU/munk=; b=V0U6LvM3BBv9EDwcMH7pmdk7VxwmZHsL43oxItj1HvtYq8P0SfRk/RZkrdfOMG/YuWoDH0Hir8XBEK3fWYUInXbMyqPwYlkGod2NTpNS90+wBSikZ+rytQ8Q8Yr5wY7AarNzYCZCxyRKngbVrwQgAqenVhgwmLs+tUI9P8d2YjsYvj4fgKVBAH+0Eb6BEFjFaVijtiEnbgEFZZgB7zSFHVXmvcBYSUZjQ+2/ITWxeiL5BP9kHb7rhz/ZnZsoM45OTNc03Z7ZU4NWLPTNay8XIgedffzyV13Uererugqt7Cn4dE1qb4XZD0B720tNyk2CLfL0nU/noeeavt5ug9/V+A== 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=+djHN9NP4lrXhKCnzYn/5YzreKEGda9rWN3QhU/munk=; b=tihnU6/UtkqDtu4oZeUQHpJRoIu0+XeKtTWB1y8GlRsYyVMAbdSRxeNHdGLochSXegRTfDPERiCEP+sNmuU/vB4jhnH9Dvwkb8to2IaawDWqlyWd6sIHIgthakkdNlfStkiAbCXcPetvkBX/Ey36lv2yiNfKjwz2zXgYdrtX6qbxUrg71VnrhnQUXt8DHNfMBoDtqEr+Z6OMPVBRXlp29DUOBN1bBKEceo5qBAZhX8pn9SjbhioOsu8cUCzsCPJfjDJ9yJrbTj21AMcJF9C+PZm6gHuYIMKbYKpJjCOZSU4htO3vAVfnGSNHDErJV49xicVZx95V/12FwizxaKqYPg== Original-Received: from VI1EUR06FT012.eop-eur06.prod.protection.outlook.com (2a01:111:e400:fc37::42) by VI1EUR06HT186.eop-eur06.prod.protection.outlook.com (2a01:111:e400:fc37::391) 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 14:06:19 +0000 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2a01:111:e400:fc37::42) by VI1EUR06FT012.mail.protection.outlook.com (2a01:111:e400:fc37::164) 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 14:06:19 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:09A065213FA011C3A1E69EF0E4FF7ED01432E0CD68F87101A32E100BF7D325DE; UpperCasedChecksum:A37C065347EE5FAD744C0EC844C60344DE74DEA91E51D82AE24C7B3EC3F6FB10; SizeAsReceived:7818; 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 14:06:19 +0000 In-Reply-To: <837dg5oidr.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 28 Aug 2021 15:37:04 +0300") X-TMN: [V5ZY5hnJ03CEQ6gLW7lSGYYtzGO9MHWu] X-ClientProxiedBy: AM6PR10CA0085.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::26) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87czpxll44.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by AM6PR10CA0085.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::26) 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 14:06:19 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 46 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 263e75ee-0855-4749-12c0-08d96a2d0260 X-MS-TrafficTypeDiagnostic: VI1EUR06HT186: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Wte5wk3UEEXg34ZoW8IC0mNq/5VHnyJPWxNULpN1S9PHmTliWdozK7KZUdWGybgrX8BxRd5aAewSLTGnfqCotN7V6cPC3Ry1ky+2YgymGJps7pyfNpY2NlXKs2A7pbTJgyx7VFlRSW5XYmkemiuE9hwWJcEix8h2t2m7gs0FpbpIcgWJo/B9h4/xn9WE0N/wsHObX/OWAV67Z9NgHpp9x+qY852uoBdeliJKypL8ErLXiAOhkNQZFzb3MSj8hV/ysuRHDY7dpZ9dWvO4/UdqkY5AWIR63kYsHJVkLuvKWJmFfJe1xYhODCXQV7rOac5d25iDTWvEqb9k8Jg9X3/n3A5Rdx79a2qX+N4phsXIu9Gn82vXq7IbO1HFE7Kp4CvkXXKmPQSwJ5zufBAwjRExUH1P9qN/TZzP0jtAMt7Ysp24ktsvpjkoxayzwLsPqGR3 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RhbW5Jy7wFQCOjscBzVdPZSw0IX50PzvAN4X98eEO4FgajJc3E+GBt8qgALdkiiZo6jBWiCYEhnG7z3uDbVT4pZhvFlyQb7O+KSJ+RkPzTlk1UiWhdxKyZ60jBDQSsJHZlklRe8DW6VDm1c9l/CMKg== X-OriginatorOrg: live.com X-MS-Exchange-CrossTenant-Network-Message-Id: 263e75ee-0855-4749-12c0-08d96a2d0260 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2021 14:06:19.8774 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: VI1EUR06FT012.eop-eur06.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: VI1EUR06HT186 Received-SPF: pass client-ip=40.92.16.28; envelope-from=arthur.miller@live.com; helo=EUR06-AM7-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.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, 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=ham 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:273305 Archived-At: Eli Zaretskii writes: >> From: Augusto Stoffel >> Date: Sat, 28 Aug 2021 14:28:59 +0200 >> >> Specifically, whenever `compile' is called from a buffer where >> `process-environment' is local, the *compilation* buffer inherits the >> original buffer's `process-environment' and `exec-path'. When >> `process-environment' is not local in the buffer from which `compile' >> is called, any local values of those two variables are killed in the >> *compilation* buffer as well. (There's no check for buffer-localness >> of `exec-path' because it's usually misguided to keep it out of sync >> with PATH.) > > Thanks. The patch should be accompanied by a suitable documentation > change, of course. > > 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? I just wrote today a piece of code where I wanted to start a process with different environment variables than what Emacs has, for LANG and LC_TIME. I didn't know of other way to easily pass environment vars, other than to start new shell process. If it is possible to use some process apis to change process environment I would happily use them instead of starting an intermediate shell process. I am really not happy to use shell there. (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? Otherwise if I can let-bind environment vars it would be even better.