]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/ztree/ztree-diff.el
* ztree/ztree-diff-model.el (ztree-diff-node): Use cl-defstruct
[gnu-emacs-elpa] / packages / ztree / ztree-diff.el
index ff9b3235f1207de464b1bb920410dba88107c230..ea66a6e99587219660bffdd89b79d9f16f6c3a2a 100644 (file)
@@ -217,9 +217,11 @@ Argument NODE node containing paths to files to call a diff on."
 2 if left or right present - view left or rigth"
   (let ((left (ztree-diff-node-left-path node))
         (right (ztree-diff-node-right-path node))
+        ;; FIXME: The GNU convention is to only use "path" for lists of
+        ;; directories as in load-path.
         (open-f #'(lambda (path) (if hard (find-file path)
-                                  (let ((split-width-threshold nil))
-                                    (view-file-other-window path))))))
+                              (let ((split-width-threshold nil))
+                                (view-file-other-window path))))))
     (cond ((and left right)
            (if (not (ztree-diff-node-different node))
                (funcall open-f left)
@@ -252,11 +254,11 @@ COPY-TO-RIGHT specifies which side of the NODE to update."
         (progn              ; otherwise:
           ;; assuming all went ok when left and right nodes are the same
           ;; set both as not different
-          (ztree-diff-node-set-different node nil)
+          (setf (ztree-diff-node-different node) nil)
           ;; update left/right paths
           (if copy-to-right
-              (ztree-diff-node-set-right-path node target-path)
-            (ztree-diff-node-set-left-path node target-path))
+              (setf (ztree-diff-node-right-path node) target-path)
+            (setf (ztree-diff-node-left-path node) target-path))
           (ztree-diff-node-update-all-parents-diff node)
           (ztree-refresh-buffer (line-number-at-pos)))))))
 
@@ -283,10 +285,10 @@ COPY-TO-RIGHT specifies which side of the NODE to update."
         (progn
           (message target-full-path)
           (if copy-to-right
-              (ztree-diff-node-set-right-path node
-                                              target-full-path)
-            (ztree-diff-node-set-left-path node
-                                           target-full-path))
+              (setf (ztree-diff-node-right-path node)
+                    target-full-path)
+            (setf (ztree-diff-node-left-path node)
+                  target-full-path))
           (ztree-diff-model-update-node node)
           (ztree-diff-node-update-all-parents-diff node)
           (ztree-refresh-buffer (line-number-at-pos)))))))
@@ -411,7 +413,7 @@ COPY-TO-RIGHT specifies which side of the NODE to update."
                   (setq children (ztree-filter
                                   #'(lambda (x) (not (ztree-diff-node-equal x node)))
                                   children))
-                  (ztree-diff-node-set-children parent children))
+                  (setf (ztree-diff-node-children parent) children))
                 (ztree-diff-node-update-all-parents-diff node)
                 ;;(ztree-diff-model-partial-rescan node)
                 (ztree-refresh-buffer (line-number-at-pos))))))))))