From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: dir-locals.el process-environment Date: Thu, 01 Mar 2018 05:32:53 +0200 Message-ID: <83tvu0xyfu.fsf@gnu.org> References: <83ec8fe992a046bd89f108bb1214c600@openmail.cc> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1519875073 6406 195.159.176.226 (1 Mar 2018 03:31:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 1 Mar 2018 03:31:13 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Mar 01 04:31:09 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1erEw0-0001Aa-J6 for geh-help-gnu-emacs@m.gmane.org; Thu, 01 Mar 2018 04:31:08 +0100 Original-Received: from localhost ([::1]:48108 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erEy2-0003l0-TY for geh-help-gnu-emacs@m.gmane.org; Wed, 28 Feb 2018 22:33:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37087) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erExb-0003kS-M3 for help-gnu-emacs@gnu.org; Wed, 28 Feb 2018 22:32:48 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1erExX-0000iF-LO for help-gnu-emacs@gnu.org; Wed, 28 Feb 2018 22:32:47 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:44756) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erExX-0000i1-HN for help-gnu-emacs@gnu.org; Wed, 28 Feb 2018 22:32:43 -0500 Original-Received: from [176.228.60.248] (port=4164 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1erExW-0000Tg-W3 for help-gnu-emacs@gnu.org; Wed, 28 Feb 2018 22:32:43 -0500 In-reply-to: <83ec8fe992a046bd89f108bb1214c600@openmail.cc> (edgar@openmail.cc) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:116098 Archived-At: > Date: Wed, 28 Feb 2018 22:18:50 +0000 > From: edgar@openmail.cc > > 1. create .dir-locals.el in the top directory with this: > > ( > ("src" ;https://stackoverflow.com/a/19521152 > . ((c++-mode > > ;https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html > . > ((eval ;https://emacs.stackexchange.com/a/35965 > . (progn > (make-local-variable 'process-environment) > (setq process-environment > (copy-sequence process-environment)) > (setenv "CC" "mpicc"))) > (compile-command . "printf x$CC")))))) > > 2. visit src/main.C (it can be empty) > 3. press F5 (or M-x compile RET) > > Actual output > The result is a buffer with the following contents. > -*- mode: compilation; default-directory: "src/" -*- > Compilation started at DATE > > printf x$CC > x > Compilation finished at DATE > > Expected output > I was expecting > -*- mode: compilation; default-directory: "src/" -*- > Compilation started at DATE > > printf x$CC > xmpicc > Compilation finished at DATE You make process-environment local to the buffer main.c, but compilation runs in its own buffer, *compilation*, where process-environment doesn't include the $CC setting.