[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ztree bf34366 04/23: Merge pull request #45 from xiongt
From: |
Stefan Monnier |
Subject: |
[elpa] externals/ztree bf34366 04/23: Merge pull request #45 from xiongtx/ediff-restore |
Date: |
Thu, 17 Dec 2020 23:17:02 -0500 (EST) |
branch: externals/ztree
commit bf343665c9d97a5cb370572364865e42074af95c
Merge: 3a4df17 47a6e40
Author: Alexey Veretennikov <txm.fourier@gmail.com>
Commit: GitHub <noreply@github.com>
Merge pull request #45 from xiongtx/ediff-restore
Address #38, #39
---
ztree-diff.el | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/ztree-diff.el b/ztree-diff.el
index a4bd012..be30ca0 100644
--- a/ztree-diff.el
+++ b/ztree-diff.el
@@ -95,6 +95,8 @@ By default paths starting with dot (like .git) are ignored")
(defvar-local ztree-diff-wait-message nil
"Message showing while constructing the diff tree.")
+(defvar-local ztree-diff-ediff-previous-window-configuration nil
+ "Window configuration prior to calling `ediff'.")
;;;###autoload
(define-minor-mode ztreediff-mode
@@ -224,6 +226,33 @@ Argument NODE node containing paths to files to call a
diff on."
(let ((node (car found)))
(ztree-diff-simple-diff node)))))
+(defun ztree-diff-ediff-before-setup-hook-function ()
+ "Hook function for `ediff-before-setup-hook'.
+
+See the Info node `(ediff) hooks'.
+
+This hook function removes itself."
+ (setq ztree-diff--ediff-previous-window-configuration
(current-window-configuration))
+ (remove-hook 'ediff-before-setup-hook
#'ztree-diff-ediff-before-setup-hook-function))
+
+(defun ztree-diff-ediff-quit-hook-function ()
+ "Hook function for `ediff-quit-hook'.
+
+See the Info node `(ediff) hooks'.
+
+This hook function removes itself."
+ (set-window-configuration ztree-diff--ediff-previous-window-configuration)
+ (remove-hook 'ediff-quit-hook #'ztree-diff-ediff-quit-hook-function))
+
+(defun ztree-diff-ediff (file-a file-b &optional startup-hooks)
+ "Ediff that cleans up after itself.
+
+Ediff-related buffers are killed and the pre-Ediff window
+configuration is restored."
+ (add-hook 'ediff-before-setup-hook
#'ztree-diff-ediff-before-setup-hook-function)
+ (add-hook 'ediff-quit-hook #'ztree-diff-ediff-quit-hook-function t)
+ (ediff file-a file-b startup-hooks))
+
(defun ztree-diff-node-action (node hard)
"Perform action on NODE:
1 if both left and right sides present:
@@ -243,7 +272,7 @@ Argument NODE node containing paths to files to call a diff
on."
(if (eql (ztree-diff-node-different node) 'same)
(funcall open-f left)
(if hard
- (ediff left right)
+ (ztree-diff-ediff left right)
(ztree-diff-simple-diff node))))
(left (funcall open-f left))
(right (funcall open-f right))
- [elpa] externals/ztree updated (3a4df17 -> 0a5b25f), Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 11c6e3b 02/23: Address PR feedback, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 47a6e40 03/23: Do not kill Ediff registry buffer, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 3315ecd 01/23: Address #38, #39, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree bf34366 04/23: Merge pull request #45 from xiongtx/ediff-restore,
Stefan Monnier <=
- [elpa] externals/ztree 20b9c93 05/23: toggle show orphaned files, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree febc2d0 06/23: Merge pull request #46 from Iurie/master, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 0e0a39d 09/23: Issue #56: Preserve line/column position on refresh, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 67a1d90 11/23: Issue #56: Dont preserve a cursor position on widen/narrow operations, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 369fd05 10/23: Issue #50: Show file permission differences, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 00d3318 12/23: Issue #59: Position curson on the beginning of the text, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 3273e1f 13/23: Issue #60: ztree-dir change Emacs default directory, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree a3e0442 14/23: Issue #59: Place cursor at the beginning of the text, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 2f62ba7 18/23: Issue #62: Cleared warnings, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 4879576 19/23: Issue #39: restore cursor position and window configuration, Stefan Monnier, 2020/12/17