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

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

[elpa] master 364eced 76/92: Make it work over TRAMP


From: Alexey Veretennikov
Subject: [elpa] master 364eced 76/92: Make it work over TRAMP
Date: Thu, 11 Jun 2015 19:48:17 +0000

branch: master
commit 364eced12e60d49bfd6a84b0de5f75fb78648d4d
Author: Philippe Vaucher <address@hidden>
Commit: Philippe Vaucher <address@hidden>

    Make it work over TRAMP
    
    Fixes #7
---
 ztree-diff-model.el |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/ztree-diff-model.el b/ztree-diff-model.el
index c915d90..d2dfd1f 100644
--- a/ztree-diff-model.el
+++ b/ztree-diff-model.el
@@ -105,12 +105,21 @@
        (string-equal (ztree-diff-node-right-path node1)
                      (ztree-diff-node-right-path node1))))
 
+(defun ztree-diff-untrampify-filename (file)
+  "Returns `file' as the local file name."
+  (require 'tramp)
+  (if (not (tramp-tramp-file-p file))
+      file
+    (tramp-file-name-localname (tramp-dissect-file-name file))))
+
 (defun ztree-diff-model-files-equal (file1 file2)
   "Compare files using external diff. Returns t if equal"
-  (let ((diff-output (shell-command-to-string (concat "diff -q" " " file1 " " 
file2))))
+  (let* ((file1-untrampified (ztree-diff-untrampify-filename file1))
+         (file2-untrampified (ztree-diff-untrampify-filename file2))
+         (diff-command (concat "diff -q" " " file1-untrampified " " 
file2-untrampified))
+         (diff-output (shell-command-to-string diff-command)))
     (not (> (length diff-output) 2))))
 
-
 (defun ztree-directory-files (dir)
   "Returns the list of full paths of files in a directory, filtering out . and 
.."
   (ztree-filter #'(lambda (file) (let ((simple-name (file-short-name file)))



reply via email to

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