aboutsummaryrefslogtreecommitdiffstats
path: root/oni-ediff.el
diff options
context:
space:
mode:
authorGravatar Tom Willemse2020-11-06 16:42:58 -0800
committerGravatar Tom Willemse2020-11-06 16:42:58 -0800
commit48d513550d16f5ab49e56eb4bdccd1d9cdf67b44 (patch)
tree06345f559deff7f8cd3b01105bf977c31888408e /oni-ediff.el
parentdb42ad1a171b00132b0d3228b737e2631c4b6fd9 (diff)
downloademacs-config-48d513550d16f5ab49e56eb4bdccd1d9cdf67b44.tar.gz
emacs-config-48d513550d16f5ab49e56eb4bdccd1d9cdf67b44.zip
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
Diffstat (limited to 'oni-ediff.el')
-rw-r--r--oni-ediff.el16
1 files changed, 16 insertions, 0 deletions
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)