git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bert Wesarg <bert.wesarg@googlemail.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Pat Thoyts <patthoyts@users.sourceforge.net>,
	"Shawn O . Pearce" <spearce@spearce.org>,
	git@vger.kernel.org
Subject: Re: [PATCH/RFC/WIP/POC] git-gui: grep prototype
Date: Fri, 19 Nov 2010 13:15:44 +0100	[thread overview]
Message-ID: <AANLkTimWyjrRD951AGeEayMoTNd-N2OXRd_wQ0RBFegN@mail.gmail.com> (raw)
In-Reply-To: <20101114234848.GB26104@burratino>

On Mon, Nov 15, 2010 at 00:48, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Bert Wesarg wrote:
>
>> Now I got your point. Maybe I should call GIT_EDITOR with $FILENAME as
>> argument but with a new variable to indicate open'n'forget. So
>> existing setups would always open the file (even without honoring the
>> line number) and new/smart wrappers can honor the open'n'forget and
>> line number flag.
>
> Yes, I like the communication-via-environment idea.
>
> In fact, there are multiple questions an editor might want answered:
>
> 1. GUI or no GUI?  (The combination of $DISPLAY and $(tty) often
>   yields a reasonable answer.)

I think we can generalize this by using the name of the caller (ie
binary name). This is easy to get in a unix/linux shell with the help
of /proc/$PPID/exe, but maybe not so in others OS's. I just remembered
that quilt has this feature, the name is QUILT_COMMAND and I use is in
my wrapper script to detect whether the caller wants to wait or not (I
block only on the header and mail command).

>
> 2. open'n'forget or wait for answer?  (gvim's --nofork option)
>
> 3. What line number?
>
> 4. regex to use to highlight matches?
>
> Ideally $LINENUMBER would only be used represent (3), while a
> separate variable would indicate (2).
>

Using for each case its own flag may sound silly, but I think this
makes it more clear, what the caller expects.
For example in my git-patch for calling GIT_EDITOR I provide a flag
whether the given path is in the index or not (ie the action comes
from the index list). If it is from the index, I use checkout-index
--temp and update-index to edit the content from the index. This call
to GIT_EDITOR should be blocking but it is better to request this
explicitly.

Could we settle on a name space for such variables? GIT_EDITOR_* makes
it obvious that it is for the editor started from git.

Bert

  reply	other threads:[~2010-11-19 12:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-14 21:41 [PATCH/RFC/WIP/POC] git-gui: grep prototype Bert Wesarg
2010-11-14 21:54 ` Jonathan Nieder
2010-11-14 22:04   ` Bert Wesarg
2010-11-14 22:09     ` Jonathan Nieder
2010-11-14 22:15       ` Bert Wesarg
2010-11-14 23:48         ` Jonathan Nieder
2010-11-19 12:15           ` Bert Wesarg [this message]
2010-11-19 19:49             ` Jonathan Nieder
2010-11-19 20:16               ` Bert Wesarg

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=AANLkTimWyjrRD951AGeEayMoTNd-N2OXRd_wQ0RBFegN@mail.gmail.com \
    --to=bert.wesarg@googlemail.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=patthoyts@users.sourceforge.net \
    --cc=spearce@spearce.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).