Re: [PATCH v4 2/2] git-jump: invoke emacs/emacsclient
- From
Yoichi Nakayama <yoichi.nakayama@gmail.com>
- Date
- Nov 24, 2022, 12:32 UTC
- Message-ID
- <CAF5D8-u14grTa9cUo=ge8TVRKNYtVHWhFHDW8yYD9gD8=f0Byg@mail.gmail.com>
- In-Reply-To
- <Y37EPdUkBhsSPmRD@coredump.intra.peff.net>
On Thu, Nov 24, 2022 at 10:09 AM Jeff King <peff@peff.net> wrote:
Show 17 quoted lines
> > 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@peff.net> 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