[PATCH 2/2] git-jump: invoke emacsclient

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Yoichi Nakayama <yoichi.nakayama@xxxxxxxxx>

It works with GIT_EDITOR="emacsclient" or GIT_EDITOR="emacsclient -t"

Signed-off-by: Yoichi Nakayama <yoichi.nakayama@xxxxxxxxx>
---
 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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux