From: Yoichi Nakayama via GitGitGadget Date: Sat, 19 Nov 2022 14:02:20 GMT Subject: [PATCH 2/2] git-jump: invoke emacsclient Message-ID: In-Reply-To: From: Yoichi Nakayama It works with GIT_EDITOR="emacsclient" or GIT_EDITOR="emacsclient -t" Signed-off-by: Yoichi Nakayama --- contrib/git-jump/git-jump | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/contrib/git-jump/git-jump b/contrib/git-jump/git-jump index a907f69304d..536f0341aaf 100755 --- a/contrib/git-jump/git-jump +++ b/contrib/git-jump/git-jump @@ -26,6 +26,11 @@ open_editor() { eval "$editor -q \$1" } +open_emacsclient() { + editor=`git var GIT_EDITOR` + eval "$editor -e \"(prog1 (switch-to-buffer-other-frame (grep \\\"git jump stdout $@\\\")) (delete-other-windows) (select-frame-set-input-focus (selected-frame)))\"" +} + mode_diff() { git diff --no-prefix --relative "$@" | perl -ne ' @@ -79,6 +84,12 @@ if test "$mode" = "stdout"; then exit 0 fi +if git var GIT_EDITOR | grep ^emacsclient >/dev/null; then + type "mode_$mode" >/dev/null 2>&1 || { usage >&2; exit 1; } + open_emacsclient "$mode" "$@" + exit 0 +fi + trap 'rm -f "$tmp"' 0 1 2 3 15 tmp=`mktemp -t git-jump.XXXXXX` || exit 1 type "mode_$mode" >/dev/null 2>&1 || { usage >&2; exit 1; } -- gitgitgadget