[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Buffer-local process environments
From: |
Eli Zaretskii |
Subject: |
Re: [PATCH] Buffer-local process environments |
Date: |
Sat, 28 Aug 2021 17:33:34 +0300 |
> From: Arthur Miller <arthur.miller@live.com>
> Cc: Augusto Stoffel <arstoffel@gmail.com>, michael.albinus@gmx.de,
> monnier@iro.umontreal.ca, emacs-devel@gnu.org
> Date: Sat, 28 Aug 2021 16:06:19 +0200
>
> > And I'm not sure I understand the rationale, and you didn't describe
> > it. Environment variables and PATH in particular are generally global
> > on the entire system, so what does this feature correspond to?
> > separate environment variables in each shell window? Why would anyone
> > want to do that? And why should we make it easier by providing
> > buffer-local values of those, instead of letting each Lisp program
> > that needs it let-bind the variables instead?
>
> Excuse me if I ask here, it is probably more help than contribution to this
> discussion. Is it possible to let-bind environment variables so that a
> subprocess inherit those?
Of course. You let-bind process-environment, and then change the
local value. We have a number of places where we do that.
> (defun emacs-vision--get-date ()
> (let ((lang (concat "LANG=" emacs-vision-locale))
> (lctime (concat "LC_TIME=" emacs-vision-locale)))
> (with-temp-buffer
> (insert
> (shell-command-to-string
> (concat lang lctime " date +'%A, %B %d'")))
> (goto-char (- (point-max) 1))
> (buffer-substring-no-properties
> (line-beginning-position) (line-end-position)))))
>
> Do I understand correctly, this patch will let me have separate process
> environment, so I could use separate environment variables in subprocess?
Yes, but that's not what you were asking about, I believe.
Re: [PATCH] Buffer-local process environments, Michael Albinus, 2021/08/28