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

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

 



On Mon, Nov 21, 2022 at 12:27:00PM +0000, Yoichi Nakayama via GitGitGadget wrote:

> +open_emacs() {
> +	editor=`git var GIT_EDITOR`
> +	eval "$editor --eval \"(prog1 (switch-to-buffer-other-frame (compilation-start \\\"git jump --stdout $@\\\" 'grep-mode)) (delete-other-windows) (select-frame-set-input-focus (selected-frame)))\""
> +}

I think this subjects the user's arguments to an extra round of
whitespace splitting. E.g., if I do:

  git jump grep 'foo bar'

then the emacs command will see two arguments. The first is "--eval",
and the second is the whole string:

  prog1 (switch-to-buffer-other-frame (compilation-start "git jump --stdout grep foo bar" 'grep-mode)) (delete-other-windows) (select-frame-set-input-focus (selected-frame)))

But now we've lost fact that "foo bar" was a single string, and git-grep
will complain (because it treats "bar" as a file to look in, which does
not exist).

You'll have to either shell-quote the contents, or stuff it in a
tempfile and read it with something like "cat /path/to/tempfile" in the
emacs command (though I'm not sure if that would be racy when you're
using something like emacsclient which may exit before the main emacs
process runs the command).

-Peff



[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