Skip to content

Commit 9508dfd

Browse files
yoichigitster
authored andcommitted
git-jump: invoke emacs/emacsclient
It works with GIT_EDITOR="emacs", "emacsclient" or "emacsclient -t" Signed-off-by: Yoichi Nakayama <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 64685cb commit 9508dfd

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

contrib/git-jump/git-jump

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,22 @@ EOF
2323

2424
open_editor() {
2525
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
2742
}
2843

2944
mode_diff() {

0 commit comments

Comments
 (0)