Add support to call ediff through emacsclient
This way Emacs can be used in Perforce, for example, as the diff program: Location: C:/msys64/mingw64/bin/emacsclientw.exe Arguments: diff %1 %2
This commit is contained in:
parent
db42ad1a17
commit
48d513550d
1 changed files with 16 additions and 0 deletions
16
oni-ediff.el
16
oni-ediff.el
|
@ -47,6 +47,22 @@
|
|||
(`(,fileA ,fileB ,fileC) (ediff-files3 fileA fileB fileC))
|
||||
(_ (error "Invalid number of arguments, need either 2 or 3 files"))))
|
||||
|
||||
;;;###autoload
|
||||
(defun oni-ediff-server (fun files proc &optional nowait)
|
||||
(pcase files
|
||||
((and `((,fileB) (,fileA) (,command))
|
||||
(guard (string= (file-name-nondirectory command) "diff")))
|
||||
(select-frame-set-input-focus (selected-frame))
|
||||
(ediff-files (expand-file-name fileA)
|
||||
(expand-file-name fileB))
|
||||
nil)
|
||||
(_
|
||||
(message "Got args: \"%s\"" (list files proc nowait))
|
||||
(funcall fun files proc nowait))))
|
||||
|
||||
;;;###autoload
|
||||
(advice-add 'server-visit-files :around #'oni-ediff-server)
|
||||
|
||||
(setq ediff-window-setup-function 'ediff-setup-windows-plain)
|
||||
(setq ediff-split-window-function 'split-window-horizontally)
|
||||
|
||||
|
|
Loading…
Reference in a new issue