diff --git a/oni-ediff.el b/oni-ediff.el index 6d87d27..b18e625 100644 --- a/oni-ediff.el +++ b/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)