git-jump: invoke emacs/emacsclient

It works with GIT_EDITOR="emacs", "emacsclient" or "emacsclient -t" Signed-off-by: Yoichi Nakayama <yoichi.nakayama@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Yoichi Nakayama committed Nov 27, 2022 at 01:18 UTC 9508dfd9f553019c2e3b2869926a0dcaed7a498f
1 file changed +16 -1
contrib/git-jump/git-jump
+16 -1
@@ -23,7 +23,22 @@ EOF
23
24 open_editor() {
25 editor=`git var GIT_EDITOR`
26 - eval "$editor -q \$1"
26 + case "$editor" in
27 + *emacs*)
28 + # Supported editor values are:
29 + # - emacs
30 + # - emacsclient
31 + # - emacsclient -t
32 + #
33 + # Wait for completion of the asynchronously executed process
34 + # to avoid race conditions in case of "emacsclient".
35 + eval "$editor --eval \"(let ((buf (grep \\\"cat \$1\\\"))) (pop-to-buffer buf) (select-frame-set-input-focus (selected-frame)) (while (get-buffer-process buf) (sleep-for 0.1)))\""
36 + ;;
37 + *)
38 + # assume anything else is vi-compatible
39 + eval "$editor -q \$1"
40 + ;;
41 + esac
42 }
43
44 mode_diff() {