Re: [PATCH v3 1/2] git-jump: add an optional argument '--stdout'
- From
Yoichi Nakayama <yoichi.nakayama@gmail.com>
- Date
- Nov 22, 2022, 13:00 UTC
- Message-ID
- <CAF5D8-uQ633azqUfCv0vyQzFUaQdDhOwzEc8GOGnFrgmh-c9pQ@mail.gmail.com>
- In-Reply-To
- <xmqq35abvpxm.fsf@gitster.g>
On Tue, Nov 22, 2022 at 8:38 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 24 quoted lines
> > Jeff King <peff@peff.net> writes: > > > On Mon, Nov 21, 2022 at 12:26:59PM +0000, Yoichi Nakayama via GitGitGadget wrote: > > > >> From: Yoichi Nakayama <yoichi.nakayama@gmail.com> > >> +-------------------------------------------------- > >> +# In Emacs, M-x grep and invoke "git jump --stdout <mode>" > >> +Run grep (like this): git jump --stdout diff > >> +-------------------------------------------------- > > > > This example confused me because it says "run grep", but then runs a > > diff jump. But maybe this is because it means to run the emacs grep > > command? I don't use emacs, so it may make more sense to somebody who > > does. > > Yes. "M-x" gives Emacs users a command line prompt to type (and tab > complete) an Emacs command, and in the above explanation, the user > is running the "grep" command of Emacs, which in turn prompts for a > shell command that produces series of <filename>:<lineno>:<cruft> to > jump around [*]. > > "M-x grep<RET>git jump --stdout diff<RET>" is what I would have > written on the second line instead of "Run grep (like this)...".
I think Junio's suggestion of "M-x grep<RET>git jump --stdout diff<RET>" is concise and understandable to most Emacs users, so I'd like to adopt it.
Below are the details of what I thought:
By M-x grep<RET>, Emacs displays
Run grep (like this): grep --color=auto -nH --null -e
where
- "Run grep (like this): " is a prompt (like "$ " in bash).
- "grep --color=auto -nH --null -e " is a part of search command (missing
keyword part). We can supply "keyword<RET>" to execute the search.
We can also remove the whole command and replace it with the command
like "git jump --stdout diff".So "M-x grep<RET>git jump --stdout diff<RET>" does not represent the complete procedure. It lacks the operation to remove the default command (controlled by the grep-command setting). For example, adding C-a C-k after "M-x grep<RET>" is more accurate, but it feels a bit redundant.
-- Yoichi NAKAYAMA