help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dir-locals.el process-environment


From: Eli Zaretskii
Subject: Re: dir-locals.el process-environment
Date: Thu, 01 Mar 2018 05:32:53 +0200

> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]