all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Can emacsclient send environment variables even if it doesn't create a frame?
@ 2023-03-29 13:45 Yoichi Nakayama
  2023-03-29 15:46 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Yoichi Nakayama @ 2023-03-29 13:45 UTC (permalink / raw)
  To: emacs-devel

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



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-04-01 15:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-29 13:45 Can emacsclient send environment variables even if it doesn't create a frame? Yoichi Nakayama
2023-03-29 15:46 ` Eli Zaretskii
2023-04-01 13:37   ` Yoichi Nakayama
2023-04-01 13:54     ` Eli Zaretskii
2023-04-01 14:28       ` Yoichi Nakayama
2023-04-01 15:10         ` Eli Zaretskii
2023-04-01 14:54       ` Yoichi Nakayama
2023-04-01 15:40         ` Eli Zaretskii

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.