emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 0c9d8b6 52/92: Added 'd' hotkey and left/light paths to th


From: Alexey Veretennikov
Subject: [elpa] master 0c9d8b6 52/92: Added 'd' hotkey and left/light paths to the header
Date: Thu, 11 Jun 2015 19:48:08 +0000

branch: master
commit 0c9d8b6f9af270bf193cdb973a0958df9f6d6e64
Author: Alexey Veretennikov <address@hidden>
Commit: Alexey Veretennikov <address@hidden>

    Added 'd' hotkey and left/light paths to the header
---
 README.md     |    3 ++-
 ztree-diff.el |   32 ++++++++++++++++++++++++++++++--
 2 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 0bded3d..5f62493 100644
--- a/README.md
+++ b/README.md
@@ -50,8 +50,9 @@ Then you need to specify the left and right directories to 
compare.
 ###Hotkeys supported
 The basic hotkeys are the same as in the **ztree-dir**. Additionally:
  * `RET` or `Space` on different files starts the **Ediff**
+ * `d` key show the simple diff window for the current file instead of 
**Ediff**
  * `TAB` to fast switch between panels
- * `h` key toggle show/hide identical files/directories
+ * `h` key to toggle show/hide identical files/directories
  * `C` key to copy current file or directory to the left or right panel
  * `D` key to delete current file or directory
  * `v` key to quick view the current file
diff --git a/ztree-diff.el b/ztree-diff.el
index 2e8cce8..020f646 100644
--- a/ztree-diff.el
+++ b/ztree-diff.el
@@ -93,6 +93,7 @@ including . and ..")
     (,(kbd "h") . ztree-diff-toggle-show-equal-files)
     (,(kbd "D") . ztree-diff-delete-file)
     (,(kbd "v") . ztree-diff-view-file)
+    (,(kbd "d") . ztree-diff-simple-diff-files)
     ([f5] . ztree-diff-full-rescan)))
 
 
@@ -105,7 +106,14 @@ including . and ..")
 (defun ztree-diff-insert-buffer-header ()
   (insert-with-face "Differences tree" ztreep-diff-header-face)
   (newline)
-  (insert-with-face"Legend:" ztreep-diff-header-small-face)
+  (when ztree-diff-dirs-pair
+    (insert-with-face (concat "Left:  " (car ztree-diff-dirs-pair))
+                      ztreep-diff-header-small-face)
+    (newline)
+    (insert-with-face (concat "Right: " (cdr ztree-diff-dirs-pair))
+                      ztreep-diff-header-small-face)
+    (newline))
+  (insert-with-face "Legend:" ztreep-diff-header-small-face)
   (newline)
   (insert-with-face " Normal file " ztreep-diff-model-normal-face)
   (insert-with-face "- same on both sides" ztreep-diff-header-small-face)
@@ -127,6 +135,24 @@ including . and ..")
     (ztree-diff (car ztree-diff-dirs-pair) (cdr ztree-diff-dirs-pair))))
 
 
+(defun ztree-diff-simple-diff-files ()
+  "Create a simple diff buffer for files from left and right panels"
+  (interactive)
+  (let ((found (ztree-find-node-at-point)))
+    (when found
+      (let* ((node (car found))
+             (node-left (ztree-diff-node-left-path node))
+             (node-right (ztree-diff-node-right-path node)))
+        (when (and
+               node-left
+               node-right
+               (not (file-directory-p node-left)))
+          ;; show the diff window on the bottom
+          ;; to not to crush tree appearance
+          (let ((split-width-threshold nil))
+            (diff node-left node-right)))))))
+
+
 (defun ztree-diff-node-action (node)
   (let ((left (ztree-diff-node-left-path node))
         (right (ztree-diff-node-right-path node)))
@@ -341,7 +367,9 @@ apparently shall not be visible"
                 'ztree-diff-node-action
                 'ztree-diff-node-side)
     (ztreediff-mode)
-    (setq ztree-diff-dirs-pair (cons dir1 dir2))))
+    (setq ztree-diff-dirs-pair (cons dir1 dir2))
+    (ztree-refresh-buffer)))
+          
 
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]