[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 725f388 42/92: Preparation to copy implementation done
From: |
Alexey Veretennikov |
Subject: |
[elpa] master 725f388 42/92: Preparation to copy implementation done |
Date: |
Thu, 11 Jun 2015 19:48:04 +0000 |
branch: master
commit 725f388c6b41df75f8c680b7f12d5422d2ebbd49
Author: Alexey Veretennikov <address@hidden>
Commit: Alexey Veretennikov <address@hidden>
Preparation to copy implementation done
---
ztree-diff.el | 45 +++++++++++++++++++++++++++++++++++----------
ztree-view.el | 2 +-
2 files changed, 36 insertions(+), 11 deletions(-)
diff --git a/ztree-diff.el b/ztree-diff.el
index f08f89f..50c8b7c 100644
--- a/ztree-diff.el
+++ b/ztree-diff.el
@@ -134,16 +134,41 @@ including . and ..")
(interactive)
(let ((found (ztree-find-node-at-point)))
(when found
- (let ((side (cdr found))
- (node-side (ztree-diff-node-side node)))
- ))))
- ;; determine a side to copy from/to
- ;; (eq node-side 'both)
- ;; (eq node-side side))
-
- ;; (parent (ztree-diff-node-parent node)))
- ;; (when
-
+ (let* ((node (car found))
+ (side (cdr found))
+ (node-side (ztree-diff-node-side node))
+ (copy-to-right t) ; copy from left to right
+ (node-left (ztree-diff-node-left-path node))
+ (node-right (ztree-diff-node-right-path node))
+ (source-path nil)
+ (destination-path nil)
+ (parent (ztree-diff-node-parent node)))
+ (when parent
+ ;; determine a side to copy from/to
+ ;; algorithm:
+ ;; 1) if both side are present, use the side
+ ;; variable
+ (setq copy-to-right (if (eq node-side 'both)
+ (eq side 'left)
+ ;; 2) if one of sides is absent, copy from
+ ;; the side where the file is present
+ (eq node-side 'left)))
+ ;; 3) in both cases determine if the destination
+ ;; directory is in place
+ (setq source-path (if copy-to-right node-left node-right)
+ destination-path (if copy-to-right
+ (ztree-diff-node-right-path parent)
+ (ztree-diff-node-left-path parent)))
+ (when (and source-path destination-path
+ (yes-or-no-p (format "Copy [%s]%s to [%s]%s/ ?"
+ (if copy-to-right "LEFT" "RIGHT")
+ (ztree-diff-node-short-name node)
+ (if copy-to-right "RIGHT" "LEFT")
+ destination-path)))
+ nil ; do copy
+ ))))))
+
+
(defun ztree-diff (dir1 dir2)
"Creates an interactive buffer with the directory tree of the path given"
(interactive "DLeft directory \nDRight directory ")
diff --git a/ztree-view.el b/ztree-view.el
index e999bff..6e6cfce 100644
--- a/ztree-view.el
+++ b/ztree-view.el
@@ -195,7 +195,7 @@ if there is no node"
(let ((center (/ (window-width) 2))
(node (ztree-find-node-in-line (line-number-at-pos))))
(when node
- (cons node (if (> (current-column) center) 'left 'right)))))
+ (cons node (if (> (current-column) center) 'right 'left)))))
(defun ztree-is-expanded-node (node)
- [elpa] master 44743c1 37/92: Added progress indication to the diff model, (continued)
- [elpa] master 44743c1 37/92: Added progress indication to the diff model, Alexey Veretennikov, 2015/06/11
- [elpa] master 99a0cf7 36/92: Started work for identifying parents in nodes, Alexey Veretennikov, 2015/06/11
- [elpa] master 291a115 32/92: Header is now customizable, Alexey Veretennikov, 2015/06/11
- [elpa] master f9620df 34/92: Added action on modified files, Alexey Veretennikov, 2015/06/11
- [elpa] master 900c8fa 38/92: Refactored using defrecord macro, Alexey Veretennikov, 2015/06/11
- [elpa] master 6154ab8 21/92: Split view and models - for directory tree and for diff tree, Alexey Veretennikov, 2015/06/11
- [elpa] master 8335785 39/92: Added comment, Alexey Veretennikov, 2015/06/11
- [elpa] master 1ab3b48 43/92: Implemented file copying, Alexey Veretennikov, 2015/06/11
- [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 <=
- [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, 2015/06/11
- [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