diff options
author | Kyle Meyer <kyle@kyleam.com> | 2014-10-31 23:21:57 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2014-10-31 23:21:57 -0400 |
commit | 5457f5552ad91cb9c88552bc22122d3dbd93bc49 (patch) | |
tree | f0f4f921aff1bb27cb1f4edb3794e019b925f97a | |
parent | ead70ce0060c1efb815f9f099d6e98c26523971d (diff) | |
download | emacs.d-5457f5552ad91cb9c88552bc22122d3dbd93bc49.tar.gz |
Add command ediff-with-other-window
-rw-r--r-- | lisp/init-external.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/init-external.el b/lisp/init-external.el index 9732b58..c82b32d 100644 --- a/lisp/init-external.el +++ b/lisp/init-external.el @@ -97,10 +97,24 @@ monitor setup)." (revert-buffer) (view-mode 1)) +(defun km/ediff-with-other-window () + "Run Ediff on current window's file and other window's file." + (interactive) + (let ((windows (window-list))) + (unless (= (length windows) 2) + (user-error "Function restricted to two-window frames")) + (-if-let* ((file-a (buffer-file-name + (window-buffer (car windows)))) + (file-b (buffer-file-name + (window-buffer (cadr windows))))) + (ediff file-a file-b) + (user-error "At least one buffer is not visiting a file")))) + (setq ediff-window-setup-function 'ediff-setup-windows-plain) (define-key km/external-map "d" 'diff) (define-key km/external-map "e" 'ediff) +(define-key km/external-map "o" 'km/ediff-with-other-window) (after 'diff (define-key diff-mode-map (kbd "C-c C-g") 'km/revert-buffer-and-view)) |