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: edgar
Subject: Re: dir-locals.el process-environment
Date: Thu, 17 May 2018 19:55:01 +0000
User-agent: Roundcube Webmail/1.2.4

On Sat, 03 Mar 2018 05:40:03 +0000
I still have to check if the debugging will use those environmental variables :P .

Hello,

I want to report on my progress. This allows me to source environment
variables for process-environment, which is used for compilation and
debugging (gdb). The variables are set with a BASH script. I hope
that it is useful to others.

Note that
1. the name of the sourced file needs to be changed:
   `/path/to/environment/file.sh'
2. Emac's `compile-command' may not need the `METHOD=dbg' (it's
   something for me)
3. `$ENV_VAR_CPU' sets set the number of processes to run with
   make. This variable is defined in `/path/to/environment/file.sh'.

┌────
│ (
│  ("src"                   ;https://stackoverflow.com/a/19521152
│   .
│   (
│    (c++-mode
│     .
│     (
│      (eval              ;https://emacs.stackexchange.com/a/35965
│       . (progn
│ (with-temp-buffer ;https://stackoverflow.com/a/16789182
│             (call-process "bash" nil t nil "-c"
│                           "source /path/to/environment/file.sh; env")
│             (goto-char (point-min))
│             (while (not (eobp))
│               (setq process-environment
│ (cons (buffer-substring (point) (line-end-position))
│                           process-environment))
│               (forward-line 1)))
│           ))
│
│      (compile-command
│       . (concat
│          "METHOD=dbg make -j $ENV_VAR_CPU -C ../"))
│      )
│     )
│    )
│   )
│  )
└────

This is how I check if the environment is working:
┌────
│ # https://stackoverflow.com/a/32917097
│ xargs -0 printf %s\\n < /proc/($pidof gdb)/environ
└────

These threads may be related:

[https://stackoverflow.com/a/9669183]
[https://lists.gnu.org/archive/html/help-gnu-emacs/2008-06/msg00158.html]
[https://lists.gnu.org/archive/html/help-gnu-emacs/2008-06/msg00063.html]
[https://lists.gnu.org/archive/html/help-gnu-emacs/2018-02/msg00162.html]
[https://lists.gnu.org/archive/html/help-gnu-emacs/2018-03/msg00007.html]

Thanks for your help!

-------------------------------------------------

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!


reply via email to

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