Created
October 22, 2019 11:30
-
-
Save yoursdearboy/d438e917c055adcf7d38b2237c43edcf to your computer and use it in GitHub Desktop.
Emacs Ediff using emacsclient with exit code on exit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Author: Kirill Voronin <[email protected]> | |
# Ediff with exit code | |
# Opens ediff in existing Emacs window using emacsclient | |
# and returns exit code when *ediff-diff* buffer closed | |
get_buffer() { | |
emacsclient --eval "(get-buffer \"$1\")" | |
} | |
ediff() { | |
emacsclient --eval "(ediff-merge-files \"$1\" \"$2\" nil \"$3\")" | |
} | |
ediff_check() { | |
[ "`get_buffer \"*ediff-diff*\"`" == "nil" ] && return 0 | |
return 1 | |
} | |
ediff $1 $2 $3 | |
while true; do | |
ediff_check && exit 0 | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment