From: Yoichi Nakayama Date: Sun, 27 Nov 2022 01:18:53 +0000 (+0000) Subject: git-jump: invoke emacs/emacsclient X-Git-Tag: v2.40.0-rc0~157^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9508dfd9f553019c2e3b2869926a0dcaed7a498f;p=thirdparty%2Fgit.git git-jump: invoke emacs/emacsclient It works with GIT_EDITOR="emacs", "emacsclient" or "emacsclient -t" Signed-off-by: Yoichi Nakayama Signed-off-by: Junio C Hamano --- diff --git a/contrib/git-jump/git-jump b/contrib/git-jump/git-jump index a5a8a77e20..40c4b0d111 100755 --- a/contrib/git-jump/git-jump +++ b/contrib/git-jump/git-jump @@ -23,7 +23,22 @@ EOF open_editor() { editor=`git var GIT_EDITOR` - eval "$editor -q \$1" + 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() {