[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Can emacsclient send environment variables even if it doesn't create
From: |
Eli Zaretskii |
Subject: |
Re: Can emacsclient send environment variables even if it doesn't create a frame? |
Date: |
Wed, 29 Mar 2023 18:46:51 +0300 |
> From: Yoichi Nakayama <yoichi.nakayama@gmail.com>
> Date: Wed, 29 Mar 2023 22:45:09 +0900
>
> Currently, emacsclient sends environment variables to the server process only
> if it is going to create a frame. So it is impossible to refer to environment
> variables when calling EDITOR=emacsclient from other programs.
> In contrast, if EDITOR="emacsclient -t" or EDITOR="emacsclient -c" (that is,
> emacsclient creates new frames), you can refer emacsclient's environment
> variables via server-buffer-clients.
>
> Is it possible to eliminate the following conditional branching by
> create_frame
> in lib-src/emacsclient.c?
That would mean a single frame could "inherit" environment variables
from different shells, which will be at least confusing, if not
contradictory. For example, what about environment variables like
PATH?
> Use case:
> Refer GIT_INDEX_FILE to show correct diff even when emacsclient is invoked
> by `git commit -a` or `git commit filename` (where GIT_INDEX_FILE points to
> a temporary index file), along with the commit message edit buffer.
Why cannot you call emacsclient in that case with -t or -c option?
AFAIR, Git can use a Git-special variable GIT_EDITOR, so you could
define that to create a new frame without affecting the more general
EDITOR setting.