All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Chris Lasell <chrisl@pixar.com>
Cc: git@vger.kernel.org
Subject: Re: Bug: git-p4 edit_template() and P4EDITOR w/options
Date: Mon, 04 May 2015 15:01:27 -0700	[thread overview]
Message-ID: <xmqqh9rsovd4.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <5D2E2EAF-FFE7-437F-A716-E152E865E634@pixar.com> (Chris Lasell's message of "Mon, 4 May 2015 14:26:03 -0700")

Chris Lasell <chrisl@pixar.com> writes:

> PS: 'mate' is the CLI invocation of the TextMate GUI editor for OS
> X. The -w is required in this instance, or the 'mate' command
> would return instantly when the document opens. The -w causes it
> to wait until the document window is closed.
>
> I have noticed that the help output for mate says:
> =======
> By default mate will wait for files to be closed if the command name
> has a "_wait" suffix (e.g. via a symbolic link)
> =======
>
> and I have instructed my user to do just that for now.

I think that is not merely "for now" but is the way the command and
the environment variable are designed to be used.  A quick websearch
for [$EDITOR environment with parameter] found this one

  http://superuser.com/questions/521070/unix-environment-variables-with-arguments

which seems to be talking about a similar issue (unrelated to Git).

The relevant part of git-p4 is this:

        # invoke the editor
        if os.environ.has_key("P4EDITOR") and (os.environ.get("P4EDITOR") != ""):
            editor = os.environ.get("P4EDITOR")
        else:
            editor = read_pipe("git var GIT_EDITOR").strip()
        system([editor, template_file])

It grabs $EDITOR (or $GIT_EDITOR) and treats it as the path to the
editor executable, without letting shell to split that into words at
whitespace boundaries, so that you can say things like

	EDITOR="/User/me/My Programs/nano"

The way we spawn EDITOR in our core codepaths matches what git-p4
does, too:

	const char *args[] = { editor, real_path(path), NULL };
	struct child_process p = CHILD_PROCESS_INIT;
	int ret, sig;

	p.argv = args;
	p.env = env;
	p.use_shell = 1;
	if (start_command(&p) < 0)
		return error("unable to start editor '%s'", editor);
	...

So...

  reply	other threads:[~2015-05-04 22:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-04 21:26 Bug: git-p4 edit_template() and P4EDITOR w/options Chris Lasell
2015-05-04 22:01 ` Junio C Hamano [this message]
2015-05-04 22:34   ` Junio C Hamano
2015-05-04 22:38     ` Junio C Hamano
2015-05-04 22:44       ` Junio C Hamano
2015-05-04 23:11         ` Jonathan Nieder
2015-05-05  0:22           ` Junio C Hamano
2015-05-04 22:46       ` Chris Lasell

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=xmqqh9rsovd4.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=chrisl@pixar.com \
    --cc=git@vger.kernel.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.
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.