Skip to content

Instantly share code, notes, and snippets.

@redguardtoo
Created April 10, 2020 09:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save redguardtoo/c2b902d8341b771720d3c271a5c31189 to your computer and use it in GitHub Desktop.
Save redguardtoo/c2b902d8341b771720d3c271a5c31189 to your computer and use it in GitHub Desktop.
Use Emacs in ediff to resolve vcs conflicts
#!/bin/sh
[ -z "$MYEMACSCLIENT" ] && MYEMACSCLIENT="emacs"
# $1=$BASE, $2=$LOCAL, $3=$REMOTE, $4=$MERGED
if [ "$MYEMACSCLIENT" = "emacs" ]; then
$MYEMACSCLIENT -nw -Q --eval "(setq startup-now t)" -l "$HOME/.emacs.d/init.el" --eval "(progn (setq ediff-quit-hook 'kill-emacs) (if (file-readable-p \"$3\") (ediff-merge-files-with-ancestor \"$1\" \"$2\" \"$3\" nil \"$4\") (ediff-merge-files \"$2\" \"$3\" nil \"$4\")))"
else
$MYEMACSCLIENT -nw --eval "(progn (setq ediff-quit-hook 'kill-emacs) (if (file-readable-p \"$3\") (ediff-merge-files-with-ancestor \"$1\" \"$2\" \"$3\" nil \"$4\") (ediff-merge-files \"$2\" \"$3\" nil \"$4\")))"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment