From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Augusto Stoffel Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Buffer-local process environments Date: Sat, 28 Aug 2021 15:54:40 +0200 Message-ID: <878s0lk733.fsf@gmail.com> 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> <87lf4l91nb.fsf@gmx.de> <87czpxk9mi.fsf@gmail.com> <87h7f99073.fsf@gmx.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28034"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cc: Stefan Monnier , emacs-devel@gnu.org To: Michael Albinus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Aug 28 15:55:37 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 1mJyo3-00074h-St for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Aug 2021 15:55:35 +0200 Original-Received: from localhost ([::1]:45384 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mJyo2-0008Ai-N7 for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Aug 2021 09:55:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51936) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mJynG-0007W1-48 for emacs-devel@gnu.org; Sat, 28 Aug 2021 09:54:46 -0400 Original-Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:55212) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mJynE-00055A-Ju for emacs-devel@gnu.org; Sat, 28 Aug 2021 09:54:45 -0400 Original-Received: by mail-wm1-x32d.google.com with SMTP id g138so5695509wmg.4 for ; Sat, 28 Aug 2021 06:54:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=FUjBN3UlDHmaNCaeIpgdCncZNDrfYA3OxCttNRcjKf4=; b=oA2poKjBSQ/cQ/D70fYJ/ObU31/Uvm5pZSE0USRlhSCl4oI/0txsvzRw5JkNE92/Df bfJeJDyy5ZyajvMSNotiPZJ7+XcOQQsA8N9SXFs/M3egui76gZzMtFXSWCR1J4JoWGXv hvXFkwyHec4ht/sjvd+GkrvgejH5bkOjXoryQvrSRLjkzvSkpHoDlCOq1A+KldJySl33 KecuNBW0q3TcvtoNclwTu5iW5hseSHWIrxPy2PfNh5IE+MDH/fZ9rewKXqac+JOQCOaE eHmK3fGLIK7zjLFLe8YwPSXVvVDhAIFYHIRJYLXIFhfNuU/B3JSLMS2snou1LCTojU9k BV6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=FUjBN3UlDHmaNCaeIpgdCncZNDrfYA3OxCttNRcjKf4=; b=FuaSEpdgcQfBXFY3fEVm4jEmHSR1PV/Z29hFvSGXle0wHUM7Am0IZtV4VSsxgRnMyZ Hc9M+yBP/KGrJCH+WgaeNv0boXRRwpXCfp7dseA87D1b/X1aKZsrlRtvSo2Y89m0mIrG FUr5hzggYvpSngLu/paa3lkDOj6sFqpfS6mpwV47wJAXg/YvhtqlQwa13m1NwH/LgSmr sYggSaYXxQrh1rsMEOBUiGviX5QsRVFn2V/qw/N+bBNUSMcupBmZsc8Kh2B5nb0/xYDB KaETD6F7jIRTbFpXmAo1suoMdLQKV1AQZMHYZu3e3t08cj06emw8sB6hJoV55hooIwFX qaOQ== X-Gm-Message-State: AOAM533cELKkkf/W8nYChhNbUv6iovDL2fxOk+2rTJXfrKDU1H9n0Z8S YiDavVsvGIUifmH3QAM4vJQ2tDjAJBRj3g== X-Google-Smtp-Source: ABdhPJyUGdkiZ/12uYhsn8vjcmxCIBkwuHk0DwuPYtBxmSXFSl81yo/lpgnwJnMXG38217fG0CjPkQ== X-Received: by 2002:a05:600c:220f:: with SMTP id z15mr13585745wml.74.1630158882432; Sat, 28 Aug 2021 06:54:42 -0700 (PDT) Original-Received: from ars3 ([2a02:8109:8ac0:56d0::ae3f]) by smtp.gmail.com with ESMTPSA id h11sm11485711wrx.9.2021.08.28.06.54.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Aug 2021 06:54:41 -0700 (PDT) In-Reply-To: <87h7f99073.fsf@gmx.de> (Michael Albinus's message of "Sat, 28 Aug 2021 15:18:56 +0200") Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=arstoffel@gmail.com; helo=mail-wm1-x32d.google.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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:273302 Archived-At: --=-=-= Content-Type: text/plain On Sat, 28 Aug 2021 at 15:18, Michael Albinus wrote: > Augusto Stoffel writes: > >>> W/o further reading, this cannot be right. Elements of >>> `process-environment' have always the syntax "VAR=VALUE". You add only a >>> VALUE (`exec-path') in `bufferenv'. I understand your intention, using >>> `bufferenv' as transportation vehicle, but I believe this is >>> mis-designed, and good for trouble. If not now, then later. >> >> This is a temporary, lexical variable that is inaccessible to the user >> directly. It's "destructured" again in the next hunk of the patch. > > I've seen this. But we shall avoid this dirty kind of programming, even > if it is internal only. In this case, here is a variation that handles the two lists separately. (It will have a surprising effect if some of these lists is empty, but this should never happen --- and the solution would be to wrap the lists in a cons, which you don't like...) --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Make-compile-respect-buffer-local-process-environmen.patch >From a104e1eae100f01585587df30f49866f3b038785 Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Thu, 29 Apr 2021 12:45:04 +0200 Subject: [PATCH] Make 'compile' respect buffer-local process environment * lisp/progmodes/compile.el (compilation-start): Use `process-environment' from original buffer in the compilation process. --- lisp/progmodes/compile.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index af7b8292b7..bdf20a3f51 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -1783,6 +1783,8 @@ compilation-start (replace-regexp-in-string "-mode\\'" "" (symbol-name mode)))) (thisdir default-directory) (thisenv compilation-environment) + (bufferpath (when (local-variable-p 'exec-path) exec-path)) + (bufferenv (when (local-variable-p 'process-environment) process-environment)) outwin outbuf) (with-current-buffer (setq outbuf @@ -1850,6 +1852,12 @@ compilation-start ;; NB: must be done after (funcall mode) as that resets local variables (setq-local compilation-directory thisdir) (setq-local compilation-environment thisenv) + (if bufferpath + (setq-local exec-path bufferpath) + (kill-local-variable 'exec-path)) + (if bufferenv + (setq-local process-environment bufferenv) + (kill-local-variable 'process-environment)) (if highlight-regexp (setq-local compilation-highlight-regexp highlight-regexp)) (if (or compilation-auto-jump-to-first-error -- 2.31.1 --=-=-=--