unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: edgar@openmail.cc
To: help-gnu-emacs@gnu.org
Subject: Re: dir-locals.el process-environment
Date: Thu, 17 May 2018 19:55:01 +0000	[thread overview]
Message-ID: <c2457fbf4483b78cc8d441c9274df736@openmail.cc> (raw)

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	other threads:[~2018-05-17 19:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-17 19:55 edgar [this message]
     [not found] <mailman.23.1520010004.25009.help-gnu-emacs@gnu.org>
2018-03-03  5:40 ` dir-locals.el process-environment edgar
     [not found] <mailman.23.1519923605.5908.help-gnu-emacs@gnu.org>
2018-03-02  2:25 ` edgar
2018-03-02 14:13   ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2018-02-28 22:18 edgar
2018-03-01  3:32 ` Eli Zaretskii
     [not found] <mailman.25.1519750804.23377.help-gnu-emacs@gnu.org>
2018-02-28  5:47 ` edgar
2018-02-28 16:37   ` Eli Zaretskii
2018-02-26  4:30 edgar
2018-02-26 19:15 ` Eli Zaretskii
2018-02-19 18:44 edgar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c2457fbf4483b78cc8d441c9274df736@openmail.cc \
    --to=edgar@openmail.cc \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).