all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yoichi Nakayama <yoichi.nakayama@gmail.com>
To: emacs-devel@gnu.org
Subject: Can emacsclient send environment variables even if it doesn't create a frame?
Date: Wed, 29 Mar 2023 22:45:09 +0900	[thread overview]
Message-ID: <CAF5D8-sTbKPC4mYkYA0e5sFf+14Wo-GEQFUwus-+6YzJ7aFP7w@mail.gmail.com> (raw)

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	other threads:[~2023-03-29 13:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29 13:45 Yoichi Nakayama [this message]
2023-03-29 15:46 ` Can emacsclient send environment variables even if it doesn't create a frame? 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

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAF5D8-sTbKPC4mYkYA0e5sFf+14Wo-GEQFUwus-+6YzJ7aFP7w@mail.gmail.com \
    --to=yoichi.nakayama@gmail.com \
    --cc=emacs-devel@gnu.org \
    /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 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.