summaryrefslogtreecommitdiff
path: root/lisp/km-diff.el
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2016-02-14 12:42:03 -0500
committerKyle Meyer <kyle@kyleam.com>2016-02-14 12:42:03 -0500
commitfcc18caef01aed2173ad77845bcd0e3c56a7754d (patch)
tree8e58cf8393523a6c74eb47b890bdbd88716ab79c /lisp/km-diff.el
parent2ff55eb5efb4f1a4116d92ff25cd1d71831d1c33 (diff)
downloademacs.d-fcc18caef01aed2173ad77845bcd0e3c56a7754d.tar.gz
diff: Add diff-with-other-window command
Diffstat (limited to 'lisp/km-diff.el')
-rw-r--r--lisp/km-diff.el20
1 files changed, 15 insertions, 5 deletions
diff --git a/lisp/km-diff.el b/lisp/km-diff.el
index 05a8d0b..771cedf 100644
--- a/lisp/km-diff.el
+++ b/lisp/km-diff.el
@@ -21,6 +21,7 @@
;;; Code:
(require 'dash)
+(require 'diff)
(require 'ediff)
;;;###autoload
@@ -32,10 +33,7 @@
(abbreviate-file-name
(substring-no-properties (diff-find-file-name))))))
-;;;###autoload
-(defun km/ediff-with-other-window ()
- "Run `ediff' on current window's file and other window's file."
- (interactive)
+(defun km/diff--with-other-window (diff-func)
(let ((windows (window-list)))
(unless (= (length windows) 2)
(user-error "Function restricted to two-window frames"))
@@ -43,8 +41,20 @@
(window-buffer (car windows))))
(file-b (buffer-file-name
(window-buffer (cadr windows)))))
- (ediff file-a file-b)
+ (funcall diff-func file-a file-b)
(user-error "At least one buffer is not visiting a file"))))
+;;;###autoload
+(defun km/diff-with-other-window ()
+ "Run `diff' on current window's file and other window's file."
+ (interactive)
+ (km/diff--with-other-window #'diff))
+
+;;;###autoload
+(defun km/ediff-with-other-window ()
+ "Run `ediff' on current window's file and other window's file."
+ (interactive)
+ (km/diff--with-other-window #'ediff))
+
(provide 'km-diff)
;;; km-diff.el ends here