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>
This commit is contained in:
Yoichi Nakayama 2022-11-27 01:18:53 +00:00 коммит произвёл Junio C Hamano
Родитель 64685cb855
Коммит 9508dfd9f5
1 изменённых файлов: 16 добавлений и 1 удалений

Просмотреть файл

@ -23,7 +23,22 @@ EOF
open_editor() {
editor=`git var GIT_EDITOR`
case "$editor" in
*emacs*)
# Supported editor values are:
# - emacs
# - emacsclient
# - emacsclient -t
#
# Wait for completion of the asynchronously executed process
# to avoid race conditions in case of "emacsclient".
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)))\""
;;
*)
# assume anything else is vi-compatible
eval "$editor -q \$1"
;;
esac
}
mode_diff() {