summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init.el5
-rw-r--r--lisp/km-diff.el12
2 files changed, 16 insertions, 1 deletions
diff --git a/init.el b/init.el
index e94eafb..59f0d73 100644
--- a/init.el
+++ b/init.el
@@ -1460,7 +1460,10 @@
(define-key km/external-map "o" #'km/diff-with-other-window)
(define-key km/external-map "O" #'km/ediff-with-other-window)
(after 'diff-mode
- (define-key diff-mode-map (kbd "C-c C-l") #'km/diff-lock-buffer)))
+ (define-key diff-mode-map (kbd "C-c C-l") #'km/diff-lock-buffer))
+ (after 'ediff
+ (add-hook 'ediff-before-setup-hook #'km/ediff-save-window-config)
+ (add-hook 'ediff-quit-hook #'km/ediff-restore-window-config)))
;;; Text modes
diff --git a/lisp/km-diff.el b/lisp/km-diff.el
index 771cedf..b5d3c4b 100644
--- a/lisp/km-diff.el
+++ b/lisp/km-diff.el
@@ -56,5 +56,17 @@
(interactive)
(km/diff--with-other-window #'ediff))
+(defvar km/ediff-previous-window-config nil)
+
+;;;###autoload
+(defun km/ediff-save-window-config ()
+ (setq km/ediff-previous-window-config (current-window-configuration)))
+
+;;;###autoload
+(defun km/ediff-restore-window-config ()
+ (when km/ediff-previous-window-config
+ (set-window-configuration km/ediff-previous-window-config)
+ (setq km/ediff-previous-window-config nil)))
+
(provide 'km-diff)
;;; km-diff.el ends here