Using ediff as git mergetool

前端 未结 12 511
天命终不由人
天命终不由人 2020-12-12 10:22

I would like to be able to use ediff with \"git mergetool\".

I found some patches that alter the source code, which I don\'t want to do. Instead, I\'d like to add ed

12条回答
  •  爱一瞬间的悲伤
    2020-12-12 11:07

    There is a way to use the ediff-merge-files-with-ancestor function with emacsclient.

    The simplest one (for the GNU/Linux user) is to do a shell read from a pipe after the emacsclient call. An hook added in append to ediff-quit-hook (it must be run after ediff-cleanup-mess otherwise ediff session is not terminated properly) will shot a character in the pipe through shell-command.

    A more refined one will use a semaphore.

    And here arrives the Unix power user.

    Then arrives the Emacs Guru (Stefan Monnier) and tells you that you can call

    emacsclient --eval '(progn (ediff-merge-files-wit.......) (recursive edit))'

    after adding

    (throw 'exit )

    somewhere at the end of ediff-quit-hook. No named pipe, no semaphores, just Emacs LISP. Simple, elegant and does not require weird tests to avoid using pipes or semaphores when they are not used.

    Thank you Stefan!

提交回复
热议问题