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 18:48:11 +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> <83o89hmvew.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="2012"; 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 19:10:38 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 1mK1qm-0000JB-Df for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Aug 2021 19:10:37 +0200 Original-Received: from localhost ([::1]:50922 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mK1qk-0006aW-M3 for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Aug 2021 13:10:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53024) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mK1ph-0005uJ-P3 for emacs-devel@gnu.org; Sat, 28 Aug 2021 13:09:30 -0400 Original-Received: from mail-vi1eur05olkn2080a.outbound.protection.outlook.com ([2a01:111:f400:7d00::80a]:9985 helo=EUR05-VI1-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 1mK1pc-0005KJ-Qo; Sat, 28 Aug 2021 13:09:28 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kjpXnPPkTZq/QZ2ZUjmZZ+RfKzl+dOjrDFAxlgqmTPFPoQJHeQFxcFHkYlnkfTecIkuDi6f0rbpIdY2gMLz7Z7t4lu5VzDRHHTH5JAEdZVG4+fXEJquy8xM6PbJ0NzSf2xl9cf6PpZoo1GtGLfT4r+HF4BO2Xln7P5t7+gVYl6kjDt90PCPzYmGIH+GYU6I/ZTnVeZfj7MrnbbKdiF+DXg8xINAwrcYb9IwxBx85/nf7K1YHu2pKRf4NftaPkT03IepZcNpQlqgjRUAOq+Viet3crWSdWAPWs9Ip1gzHlEwwC3Rb9U+D9YsiuLoB+CMeoVl9MafAcZ9OCLqg1Ngrdg== 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=WVfO8y9T28mqQgIiO9S7TdH2ZPCDWfJSCP3VNuKKv1E=; b=Dj6+4J6efTuqtjIOH7yroAikxITQtXhVa1bzGRJdOTCZCufTsJvNcOvxlUChf4RGs/QQmflIh4bEYzC0bcUONzdmfW7MkIl7T1bdke3gMOvprbQ4MQG9IhxWeyhGac2MfbVz6mXYTeyHvLni9xYJ3f5bcV4AlYXSEGHgSk1qVqCpv7BeRsqV8cUUqKWqJIeA3yXJdSyDO/VusOHxZZhMwEPhONE2IrpnrOcHZje9Kf8M5CN3iFiOsVG1X8oPvFaGefp+JDZkp9rDqWNWYS+tXuEjvMMRnpukWN3/uZn9j3/8pKhjDVmV8dYQwQueJqeF0VPeCJlapxESzepFKOEsuw== 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=WVfO8y9T28mqQgIiO9S7TdH2ZPCDWfJSCP3VNuKKv1E=; b=eaJkdv+CTwdBff/Tyc6ez/CoJEcxa4GN9UPWoknFI/6yOX37mzlj/j1KIQDeQt7ynNEs6qjRiy372kcOhljAODIofXRES8h0vOC1fwee2ZhNgkWNXOeM/Y2csD7kEE8sSXJLj7/MnLOvw7wcOW2ZRDEJseJVxEQzslt1f1UGgA4NCmw4lc5gCTL+j3B3IYpAhMfcZaxzntGuAH/Lw3Pz1ljSecgPv2DogVVi+jLhWLf+DUE4nG47KfhNuMyhYHLG2eTr7MIOHDiZEPWbE7/dSdX3BbCuqRmoZ6DSwOneg5L9thdwx8GfzJT/nWOOwTgkR48NITheGlt4FjnItyJQnA== Original-Received: from VI1EUR05FT022.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc12::4c) by VI1EUR05HT237.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc12::407) 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 16:48:12 +0000 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2a01:111:e400:fc12::49) by VI1EUR05FT022.mail.protection.outlook.com (2a01:111:e400:fc12::130) 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 16:48:12 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:E2FE413BEDF113D7EBE3EDD6EC5212889DBB2887F00AB6FEF20C64C85B163DA3; UpperCasedChecksum:A38D9E370924A4A281772323C6DD164EB25369C126E6994F7886DA3702FE0186; SizeAsReceived:8030; 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 16:48:12 +0000 In-Reply-To: <83o89hmvew.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 28 Aug 2021 18:38:31 +0300") X-TMN: [S4lMBrn5JEhxQE1L8N9Vegx8ts2bso7H] X-ClientProxiedBy: AM6P194CA0071.EURP194.PROD.OUTLOOK.COM (2603:10a6:209:84::48) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87v93pjz1w.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by AM6P194CA0071.EURP194.PROD.OUTLOOK.COM (2603:10a6:209:84::48) 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 16:48:11 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 46 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 52938b38-fe52-4ede-df0d-08d96a439f80 X-MS-TrafficTypeDiagnostic: VI1EUR05HT237: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Tj26QGEUtW21fsj85TQ8wgqJIJlcB3gV04a9k1BHZMX8WpVfh1nCPFUWVHGDHVEjXIgEnF7vAxksFixE770U0jKiaZAmW2o5fhyKROc6mPs9MR1GjeVySfoHCNV43w+o6Yv3MIFydn37Uin9+DTCxe8iz2C8zzkpunTHF+bGctfxToPtkjBz1rLVjA2Aul3Yos7AlRw4KuIvDlbZsVXfbnD4LFUNfmnf0VnorzIrIY3UQWc51jDZzZpZNlivfJgNzVkzftE1xWzFVsXZZq0qqqt0mmQErXdHB+ZG6CkYXooODyxm/iQZUtA2fb0UvIPkXhpIHfkNm65BuD/CizEoOj+p7x1taTHg+O6kcvhDjN+WbWj6JoW9+IvF7/FgnltsoPtp0kVqrxVD5NwiQCOrzCZpCbNoqvwIxQEp3dAgv+9TjVI47suSzyXO8iUV9BUq X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GQNwGittdCHgpaf4+IA1xdCrpb5hOsZnv8ybWSRkirElylhd+e2OmsIqAwWZ+OywnIzu5rZR0db5uxWzk7UCDLiuLvurcUthl3aj4SrSvKLk1Ap2S/ROFsYXro7rtp4kPIaJTz5Q+GbgzRtYHLEePg== X-OriginatorOrg: live.com X-MS-Exchange-CrossTenant-Network-Message-Id: 52938b38-fe52-4ede-df0d-08d96a439f80 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2021 16:48:12.3809 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: VI1EUR05FT022.eop-eur05.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: VI1EUR05HT237 Received-SPF: pass client-ip=2a01:111:f400:7d00::80a; envelope-from=arthur.miller@live.com; helo=EUR05-VI1-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, 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:273343 Archived-At: Eli Zaretskii writes: >> From: Arthur Miller >> Cc: arstoffel@gmail.com, michael.albinus@gmx.de, monnier@iro.umontreal.ca, >> emacs-devel@gnu.org >> Date: Sat, 28 Aug 2021 17:27:18 +0200 >> >> >> (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 :-). > > The code above changes the environment only of that single shell > command. Moreover, it's non-portable: it only works with Posix Yes, that was what I wanted in this particular case. > Local > modifications of process-environment are free from these limitations. Yes, I'll switch to call-process with let-bind. Thank you. I used shell as intermediate because I didn't know how modify environment in process to be create. I really wasn't happy with using shell there. I got it now thanks :).