unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Augusto Stoffel <arstoffel@gmail.com>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Subject: Re: Buffer-local process environments
Date: Fri, 30 Apr 2021 17:51:37 +0200	[thread overview]
Message-ID: <87a6pfepo6.fsf@gmx.de> (raw)
In-Reply-To: <87eeerby1n.fsf@gmail.com> (Augusto Stoffel's message of "Fri, 30 Apr 2021 17:19:00 +0200")

Augusto Stoffel <arstoffel@gmail.com> writes:

>> Because there's a lot of functions out there, which work for the local
>> host, and should work also for remote hosts. See for example
>> vc-git-grep, which has
>>
>> (let ((default-directory dir)
>>       (compilation-environment (cons "PAGER=" compilation-environment)))
>>
>> compilation-environment will be propagated to process-environment later
>> on. And the setting for PAGER is needed for both local and remote
>> instances of vc-git-grep. There's no special code in vc-git-grep for the
>> remote case.
>
> Some observations:
>
> 1. In this case, one could call "git --no-pager" instead of relying on
>    an env var.
>
> 2. PAGER is overridden by `tramp-remote-process-environment' anyway,
>    right?  And unlike something of the likes of PYTHONPATH, I see no
>    reason to customize PAGER.
>
> 3. If Tramp checked for the buffer-local value of process-environment
>    instead of the default value, then the patch for compile.el I
>    attached yesterday wouldn't break for remote directories, and the
>    let-binding trick in your example would still work.

Please, it is just an example. And Tramp settings, like PAGER, have been
added later on.

A simple rgrep for "(process-environment" over Emacs' lisp directory
shows you several other hits, some of them are good for this discussion:

./vc/vc-bzr.el97:      (let ((process-environment (cons (format "BZR_LOG=%s" null-device)
./vc/vc-hg.el1432:             (process-environment (cons "HGPLAIN=1" process-environment))
./vc/vc-hg.el1507:         (process-environment (cons "HGPLAIN=1" process-environment))
./vc/vc-hg.el1522:  (let ((process-environment (cons "HGPLAIN=1" process-environment))
./vc/vc-dispatcher.el328:	      (process-environment (cons "LC_MESSAGES=C" process-environment))

This list is not comprehensive, of course. And again, I have no idea
what is used in the wild.

> So I wonder:
>
> A. Are there more compelling examples showing that Lisp code needs
>    fine-grained control over variables being exported to a remote host?
>
> B. There is probably a small list of variables that should be preserved
>    across machines, while there is an unbounded quantity of variables
>    that probably only make sense machine-locally (e.g., any variable
>    holding directory names).
>
> In view of 3., one could introduce the convention that the buffer-local
> value of `process-environment' is for "project-local" variables, and the
> let-bound value is for variables that make sense even on remote machines.
>
> I'm not sure this is a good proposal, though.  It's a subtle rule, and
> it could be quite brittle and hard to use.

Honestly, the hack we have now is already annoying, at least to me. I
would prefer to have something more solid to apply.

> An alternative proposal is to introduce a variable
> `remote-exported-variables', which anyone could set or let-bind or even
> override on a connection-local basis.  The value of any variable whose
> name appears in this list would be passed though a remote connection.
> This proposal would make a lot of sense if assumption B. is true.

There is already tramp-remote-process-environment, for many years. Not
much appreciated by package authors.

Best regards, Michael.



  reply	other threads:[~2021-04-30 15:51 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29 10:56 Buffer-local process environments Augusto Stoffel
2021-04-29 12:30 ` Eli Zaretskii
2021-04-29 12:40   ` Augusto Stoffel
2021-04-29 12:52     ` Eli Zaretskii
2021-04-29 13:06       ` Augusto Stoffel
2021-04-29 14:02 ` Stefan Monnier
2021-04-29 17:26   ` Augusto Stoffel
2021-04-29 17:34     ` Michael Albinus
2021-04-30  7:29       ` Augusto Stoffel
2021-04-30  7:48         ` Michael Albinus
2021-04-30 15:19           ` Augusto Stoffel
2021-04-30 15:51             ` Michael Albinus [this message]
2021-05-02  6:13               ` Augusto Stoffel
2021-05-08 17:51                 ` Michael Albinus
2021-05-09  5:06                   ` Augusto Stoffel
2021-05-09 16:38                     ` Michael Albinus
2021-08-28 12:28                       ` [PATCH] " Augusto Stoffel
2021-08-28 12:37                         ` Eli Zaretskii
2021-08-28 12:55                           ` Augusto Stoffel
2021-09-01 10:42                             ` Stephen Leake
2021-09-01 10:56                               ` Augusto Stoffel
2021-09-01 22:38                                 ` Stephen Leake
2021-09-02  7:14                                   ` Augusto Stoffel
2021-09-06 15:17                                     ` Stephen Leake
2021-08-28 14:06                           ` Arthur Miller
2021-08-28 14:33                             ` Eli Zaretskii
2021-08-28 15:27                               ` Arthur Miller
2021-08-28 15:38                                 ` Eli Zaretskii
2021-08-28 16:48                                   ` Arthur Miller
2021-08-28 15:39                                 ` Augusto Stoffel
2021-08-28 16:43                                   ` Arthur Miller
2021-08-28 12:47                         ` Michael Albinus
2021-08-28 12:59                           ` Augusto Stoffel
2021-08-28 13:18                             ` Michael Albinus
2021-08-28 13:54                               ` Augusto Stoffel
2021-08-28 14:05                               ` Stefan Monnier
2021-08-28 15:19                                 ` Augusto Stoffel
2021-04-30 15:32           ` Augusto Stoffel
2021-04-30 15:55             ` Michael Albinus
2021-04-29 15:37 ` Michael Albinus
2021-04-29 17:31   ` Augusto Stoffel
2021-04-29 17:44     ` Michael Albinus
2021-04-30  7:00       ` Augusto Stoffel
2021-04-30  7:25         ` Michael Albinus
2021-05-02 13:45 ` Stephen Leake

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=87a6pfepo6.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=arstoffel@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).