From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: edgar@openmail.cc Newsgroups: gmane.emacs.help Subject: Re: dir-locals.el process-environment Date: Wed, 28 Feb 2018 22:18:50 +0000 Message-ID: <83ec8fe992a046bd89f108bb1214c600@openmail.cc> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1519856635 4313 195.159.176.226 (28 Feb 2018 22:23:55 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 28 Feb 2018 22:23:55 +0000 (UTC) User-Agent: Roundcube Webmail/1.2.4 To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Feb 28 23:23:51 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 1erA8c-0000r1-Lb for geh-help-gnu-emacs@m.gmane.org; Wed, 28 Feb 2018 23:23:50 +0100 Original-Received: from localhost ([::1]:47367 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erAAf-0002JI-4M for geh-help-gnu-emacs@m.gmane.org; Wed, 28 Feb 2018 17:25:57 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erA4H-0005fH-3I for help-gnu-emacs@gnu.org; Wed, 28 Feb 2018 17:19:22 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1erA4C-00071j-8q for help-gnu-emacs@gnu.org; Wed, 28 Feb 2018 17:19:20 -0500 Original-Received: from onethreetwo.vfemail.net ([199.16.11.132]:23718 helo=vfemail.net) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1erA4B-0006zi-RN for help-gnu-emacs@gnu.org; Wed, 28 Feb 2018 17:19:16 -0500 Original-Received: (qmail 76727 invoked by uid 89); 28 Feb 2018 22:19:13 -0000 Original-Received: from localhost (HELO freequeue.vfemail.net) (127.0.0.1) by localhost with (DHE-RSA-AES256-SHA encrypted) SMTP; 28 Feb 2018 22:19:13 -0000 Original-Received: (qmail 76665 invoked by uid 89); 28 Feb 2018 22:18:55 -0000 Original-Received: by simscan 1.4.0 ppid: 76663, pid: 76664, t: 0.1016s scanners:none Original-Received: from unknown (HELO smtp102-2.vfemail.net) (172.16.100.62) by FreeQueue with SMTP; 28 Feb 2018 22:18:55 -0000 Original-Received: (qmail 29281 invoked by uid 89); 28 Feb 2018 22:18:50 -0000 Original-Received: by simscan 1.4.0 ppid: 29275, pid: 29278, t: 0.0368s scanners:none Original-Received: from unknown (HELO www.vfemail.net) (ZWRnYXJAb3Blbm1haWwuY2M=@172.16.100.93) by 172.16.100.62 with ESMTPA; 28 Feb 2018 22:18:50 -0000 Original-Received: from +sgitAT/6a6P4mNgURIfHBlwWqvWLhSJdy13JNLbvjsPi+uB4bcCvQ== (UnASDrf1KRooDc0xo25+ZNvp0wNje8xtZtFIJFA+9B86VgPqqQsIlA==) via 7edveNFlHVCQvcWyfQNCziGi0l+JNqvA by www.vfemail.net with HTTP (HTTP/1.1 POST); Wed, 28 Feb 2018 16:18:50 -0600 X-Sender: edgar@openmail.cc X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x [fuzzy] X-Received-From: 199.16.11.132 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:116097 Archived-At: Yes! Sorry again. Thank you for your help. The whole process is like this: 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 System specifications - GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21) of 2017-09-22, modified by Debian - Linux 4.13.0-32-generic #35-Ubuntu (it's not like Ubuntu is my cup of tea, but it was the best compromise at the time) ------------------------------------------------- ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands! $24.95 ONETIME Lifetime accounts with Privacy Features! 15GB disk! No bandwidth quotas! Commercial and Bulk Mail Options!