Re: [PATCH v7 3/3] git-jump: invoke emacs/emacsclient

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Nov 26, 2022 at 12:52:50AM +0100, Ævar Arnfjörð Bjarmason wrote:

> > 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).

You'd still need to quote the arguments, since you'll be reading
potentially multiple arguments out of the bytestream of the file[1].

If you're not going to quote, the simplest thing is to generate the
line-oriented output and read that.

If you are going to quote, then you don't need the tempfile at all. You
can shove the command into the eval, as if git-jump were run from emacs
directly (but you want to use the --stdout mode introduced in this
series, and not the git commands directly, because of course they're
non-trivial).

I showed how to do the quoting earlier in the thread. But it is ugly,
and this tempfile hack should work (modulo the gross wait loop
afterwards).

-Peff

[1] Of course you could have a stripped-down version that only greps and
    only takes one argument, but then why are you using git-jump in the
    first place?



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux