[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Buffer-local process environments
From: |
Arthur Miller |
Subject: |
Re: [PATCH] Buffer-local process environments |
Date: |
Sat, 28 Aug 2021 18:48:11 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Eli Zaretskii <eliz@gnu.org> writes:
>> 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
Yes, that was what I wanted in this particular case.
> Local
> modifications of process-environment are free from these limitations.
Yes, I'll switch to call-process with let-bind. Thank you.
I used shell as intermediate because I didn't know how modify environment in
process to be create. I really wasn't happy with using shell there. I got it now
thanks :).
Re: [PATCH] Buffer-local process environments, Michael Albinus, 2021/08/28