Re: [PATCH v7 3/3] git-jump: invoke emacs/emacsclient
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Nov 25, 2022, 23:52 UTC
- Message-ID
- <221126.86h6ymmvyc.gmgdl@evledraar.gmail.com>
- In-Reply-To
- <CAF5D8-uxZOFi8p0bUMaqJCLFxipXCB9fo_Kx=QE6s=DW8Jspgg@mail.gmail.com>
On Sat, Nov 26 2022, Yoichi Nakayama wrote:
Show 21 quoted lines
> On Fri, Nov 25, 2022 at 6:08 PM Ævar Arnfjörð Bjarmason
> <avarab@gmail.com> wrote:
>> I'd really like to have some closer and smarter emacs integration like
>> this.
>>
>> But I don't see why we need to run the grep ourselves, pipe it to a
>> temporary file, and then discover that we're using emacs, and --eval
>> code into it to switch to that buffer, and fake up a "M-x grep" command
>> with a compilation buffer to make it look like we ran M-x grep in the
>> first place.
>>
>> Let's just ... run M-x grep earlier? Then we can skip all the earlier
>> steps.
>
> There are two reasons.
>
> First, I want to reuse the modes that git-jump already have. In
> addition to mode_grep,
> mode_{diff,merge,ws} exist, and if we re-implement each for editor
> support, I think it will be
> difficult to maintain.Yeah, maybe that'll be painful. I haven't poked much at it...
Show 7 quoted lines
> Second, there is a difficulty passing arbitrary arguments properly to > Emacs Lisp properly. > For example, your version will cause error with > git jump grep "hello world" > My early patch was doing something similar. But the second problem was > hard to deal with, > so I switched to using a temporary file.
To the extent that that's painful couldn't we write the grep expression / arguments to the tempfile, then feed the tempfile to the ad-hoc elisp code?
It would then read it, get the argument to grep for, and we'd call (grep that-argument).