emacs-devel
[Top][All Lists]
Advanced

[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 18:38:31 +0300

> From: Arthur Miller <arthur.miller@live.com>
> Cc: arstoffel@gmail.com,  michael.albinus@gmx.de,  monnier@iro.umontreal.ca,
>   emacs-devel@gnu.org
> Date: Sat, 28 Aug 2021 17:27:18 +0200
> 
> >> (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.
> 
> Now you make me confused again :). I want my process to use different env for
> LANG and LC_TIME, but Emacs should continue to work with old values. 
> Concretely
> I want english date string, but my Emacs should continue to use swedish for 
> it's
> normal use.
> 
> So if I let-bind, it will be reflected only localy in that let scope, and the
> subprocess will inherit that local environment too? That is what I want, and 
> why
> I went via shell command. Forgive me if I am confused. I hope what you said
> above is what I want :-).

The code above changes the environment only of that single shell
command.  Moreover, it's non-portable: it only works with Posix
shells, and only for commands invoked via those shells.  Local
modifications of process-environment are free from these limitations.



reply via email to

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