emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can emacsclient send environment variables even if it doesn't create a f


From: Yoichi Nakayama
Subject: Can emacsclient send environment variables even if it doesn't create a frame?
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?

  if (create_frame)
    {
      for (char *const *e = environ; *e; e++)
        {
          send_to_emacs (emacs_socket, "-env ");
          quote_argument (emacs_socket, *e);
          send_to_emacs (emacs_socket, " ");
        }
    }

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.
https://github.com/magit/magit/pull/4888

-- 
Yoichi NAKAYAMA



reply via email to

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