Skip to content

Instantly share code, notes, and snippets.

@yoursdearboy
Created October 22, 2019 11:30
Show Gist options
  • Save yoursdearboy/d438e917c055adcf7d38b2237c43edcf to your computer and use it in GitHub Desktop.
Save yoursdearboy/d438e917c055adcf7d38b2237c43edcf to your computer and use it in GitHub Desktop.
Emacs Ediff using emacsclient with exit code on exit
#!/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