diff options
author | Kyle Meyer <kyle@kyleam.com> | 2016-02-15 23:29:33 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2016-02-15 23:29:33 -0500 |
commit | af287828c90c9251ad6af23dc47531549f3d2fd2 (patch) | |
tree | 3dafc25f4cb26062a1fddc89b5a3ddb3e7b6e2b6 | |
parent | 8d15b9f5a7de07f2f956fea3ed4007b68a9fb50c (diff) | |
download | emacs.d-af287828c90c9251ad6af23dc47531549f3d2fd2.tar.gz |
ediff: Restore window configuration
-rw-r--r-- | init.el | 5 | ||||
-rw-r--r-- | lisp/km-diff.el | 12 |
2 files changed, 16 insertions, 1 deletions
@@ -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 |