[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 7f1ec58 53/92: Fixed topmost name in comparison tree
From: |
Alexey Veretennikov |
Subject: |
[elpa] master 7f1ec58 53/92: Fixed topmost name in comparison tree |
Date: |
Thu, 11 Jun 2015 19:48:08 +0000 |
branch: master
commit 7f1ec58b32b6373835494f9d5323e3f1b6f557fe
Author: Alexey Veretennikov <address@hidden>
Commit: Alexey Veretennikov <address@hidden>
Fixed topmost name in comparison tree
---
ztree-diff-model.el | 18 ++++++++++++------
ztree-diff.el | 8 ++++++--
ztree-view.el | 2 +-
3 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/ztree-diff-model.el b/ztree-diff-model.el
index ab5a42c..810d447 100644
--- a/ztree-diff-model.el
+++ b/ztree-diff-model.el
@@ -50,7 +50,12 @@
;; short-name - is the file or directory name
;; children - list of nodes - files or directories if the node is a directory
;; different = {nil, 'new, 'diff} - means comparison status
-(defrecord ztree-diff-node (parent left-path right-path short-name children
different))
+(defrecord ztree-diff-node (parent left-path right-path short-name
right-short-name children different))
+
+(defun ztree-diff-node-short-name-wrapper (node &optional right-side)
+ (if (not right-side)
+ (ztree-diff-node-short-name node)
+ (ztree-diff-node-right-short-name node)))
(defun ztree-diff-node-is-directory (node)
@@ -98,6 +103,7 @@
(when (eq side 'left) file)
(when (eq side 'right) file)
(file-short-name file)
+ (file-short-name file)
nil
'new))
(children (ztree-diff-model-subtree node file side)))
@@ -108,6 +114,7 @@
(when (eq side 'left) file)
(when (eq side 'right) file)
(file-short-name file)
+ (file-short-name file)
nil
'new)
result)))
@@ -156,7 +163,7 @@ the rest is the combined list of nodes"
(different nil)
;; create the current node to be set as parent to
;; subdirectories
- (node (ztree-diff-node-create parent file1 nil simple-name nil
nil))
+ (node (ztree-diff-node-create parent file1 nil simple-name
simple-name nil nil))
;; 1. find if the file is in the second directory and the type
;; is the same - i.e. both are directories or both are files
(file2 (ztree-find list2
@@ -201,7 +208,7 @@ the rest is the combined list of nodes"
(isdir (file-directory-p file2))
(children nil)
;; create the node to be added to the results list
- (node (ztree-diff-node-create parent nil file2 simple-name nil
'new))
+ (node (ztree-diff-node-create parent nil file2 simple-name
simple-name nil 'new))
;; 1. find if the file is in the first directory and the type
;; is the same - i.e. both are directories or both are files
(file1 (ztree-find list1
@@ -230,9 +237,8 @@ the rest is the combined list of nodes"
(setq ztree-diff-model-wait-message (concat "Comparing " dir1 " and " dir2 "
..."))
(let* ((model
(ztree-diff-node-create nil dir1 dir2
- (concat (file-short-name dir1)
- " <--> "
- (file-short-name dir2))
+ (file-short-name dir1)
+ (file-short-name dir2)
nil
nil))
(traverse (ztree-diff-node-traverse model dir1 dir2)))
diff --git a/ztree-diff.el b/ztree-diff.el
index 020f646..5b2d5f7 100644
--- a/ztree-diff.el
+++ b/ztree-diff.el
@@ -353,13 +353,17 @@ apparently shall not be visible"
"Creates an interactive buffer with the directory tree of the path given"
(interactive "DLeft directory \nDRight directory ")
(let* ((difference (ztree-diff-model-create dir1 dir2))
- (buf-name (concat "*" (ztree-diff-node-short-name difference) "*")))
+ (buf-name (concat "*"
+ (ztree-diff-node-short-name difference)
+ " <--> "
+ (ztree-diff-node-right-short-name difference)
+ "*")))
(setq ztree-diff-filter-list (list ztree-diff-hidden-files-regexp))
(ztree-view buf-name
difference
'ztree-node-is-visible
'ztree-diff-insert-buffer-header
- 'ztree-diff-node-short-name
+ 'ztree-diff-node-short-name-wrapper
'ztree-diff-node-is-directory
'ztree-diff-node-equal
'ztree-diff-node-children
diff --git a/ztree-view.el b/ztree-view.el
index e7fdadd..c10de77 100644
--- a/ztree-view.el
+++ b/ztree-view.el
@@ -427,7 +427,7 @@ list of leafs"
(expandable (funcall ztree-node-is-expandable-fun node))
(short-name (funcall ztree-node-short-name-fun node)))
(if ztree-node-side-fun ; 2-sided tree
- (let ((right-short-name short-name)
+ (let ((right-short-name (funcall ztree-node-short-name-fun node t))
(side (funcall ztree-node-side-fun node))
(width (window-width)))
(when (eq side 'left) (setq right-short-name ""))
- [elpa] master af28a78 41/92: Started implementation of the copy functionality, (continued)
- [elpa] master af28a78 41/92: Started implementation of the copy functionality, Alexey Veretennikov, 2015/06/11
- [elpa] master 75b89a6 48/92: Fixed typo, Alexey Veretennikov, 2015/06/11
- [elpa] master 725f388 42/92: Preparation to copy implementation done, Alexey Veretennikov, 2015/06/11
- [elpa] master f78b859 47/92: Updated readme, Alexey Veretennikov, 2015/06/11
- [elpa] master 20d8217 44/92: Implemented directory copying, Alexey Veretennikov, 2015/06/11
- [elpa] master d590f88 40/92: Added minor mode for ztree diff, to create custom keybindings, Alexey Veretennikov, 2015/06/11
- [elpa] master 81b6a4b 49/92: Added delete functionality, Alexey Veretennikov, 2015/06/11
- [elpa] master c3580db 46/92: Updated readme; renamed the ztree to ztree-dir, Alexey Veretennikov, 2015/06/11
- [elpa] master 3867ed3 45/92: Implemented support for hiding matched(equal) files, Alexey Veretennikov, 2015/06/11
- [elpa] master 15baed9 50/92: Repaired full rescan; added 'v' keybinding to quickly view files, Alexey Veretennikov, 2015/06/11
- [elpa] master 7f1ec58 53/92: Fixed topmost name in comparison tree,
Alexey Veretennikov <=
- [elpa] master 56dce0e 51/92: Updated README, Alexey Veretennikov, 2015/06/11
- [elpa] master d791ebe 54/92: Readme is updated, Alexey Veretennikov, 2015/06/11
- [elpa] master 8ba9ca2 55/92: Added simple diff by using SPACE, Alexey Veretennikov, 2015/06/11
- [elpa] master c816a66 56/92: Updated readme, Alexey Veretennikov, 2015/06/11
- [elpa] master 0c9d8b6 52/92: Added 'd' hotkey and left/light paths to the header, Alexey Veretennikov, 2015/06/11
- [elpa] master a45a108 57/92: Logical operation on the file by pressing either RET or SPC - diff/ediff when different view/open when same, Alexey Veretennikov, 2015/06/11
- [elpa] master ba34d9c 58/92: Updated readme, Alexey Veretennikov, 2015/06/11
- [elpa] master 56320ab 62/92: Fix footer line and add Code section header, Alexey Veretennikov, 2015/06/11
- [elpa] master 11bcff0 60/92: Updated docstrings; removed debug print from partial rescan, Alexey Veretennikov, 2015/06/11
- [elpa] master 865afb0 59/92: Implemented partial rescan/refresh feature ('r' hotkey), Alexey Veretennikov, 2015/06/11