Re: [PATCH v4 2/2] git-jump: invoke emacs/emacsclient

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

 



On Thu, Nov 24, 2022 at 10:09 AM Jeff King <peff@xxxxxxxx> wrote:
>
> On Wed, Nov 23, 2022 at 02:33:50PM +0900, Yoichi Nakayama wrote:
>
> > On Wed, Nov 23, 2022 at 3:54 AM Jeff King <peff@xxxxxxxx> wrote:
> > > Hmm, I know I suggested using a temporary file since "cat $tmpfile"
> > > should be pretty safe. But it does still have problems if your tmp
> > > directory has spaces. Or even other metacharacters, which I think will
> > > be interpreted by the eval, since $@ is expanded in the outermost level
> > > of the shell.
> >
> > Right. But the problem is not specific to emacs (it happens in vim too).
> > Let's fix it another time (as you noted, that's pretty unlikely, and we may
> > not even need to fix it).
>
> Good point. The vim version is easier to fix (we just need to
> double-quote \$1 inside the eval), but the fact that nobody has
> complained is an indication that it does not really matter.

I've confirmed the vim version is fixed by
    eval "$editor -q \"\$1\""

With your hint, I found the emacs version can be fixed
by single-quoting the variable (I found a mistake in the
emacs version. Since there is only one argument, I
should use $1 instead of $@. I'll fix it.), and the vim
version can be also in the similar form with single quote:
    eval "$editor -q '$1'"

The original vim version used the notation \$1 instead of $1.
I'm worried that the emacs version might need the backslash.
What does the backslash mean? Is it necessary?
-- 
Yoichi NAKAYAMA



[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