fourier / ztree

Directory tree comparison mode for Emacs
http://www.emacswiki.org/emacs/ZtreeDiff
GNU General Public License v3.0
239 stars 21 forks source link

Make it work over TRAMP #9

Closed Silex closed 10 years ago

Silex commented 10 years ago

Fixes #7

Silex commented 10 years ago

I tested and it seems to work. The trick is that for most emacs operations work fine with a TRAMP filename (e.g directory-files), but for the diff command shell-command-as-string works directly over TRAMP and there you'd talk about local file names.

fourier commented 10 years ago

I don't understand the following:

How would you expect results from comparing remote files? It looks like you still comparing the local files.

Silex commented 10 years ago

No, the shell-command* family work both locally and remotely. Before executing the command, if pwd is from a TRAMP directory, shell-command* forwards your command over the remote host, executes it there, and returns the result.

The untrampify part is to turn a path like /scpx:root@dev.stvs.ch:/root/foo/bar.txt into /root/foo/bar.txt, that way shell-command-as-string is called like (shell-command-as-string "diff -q /root/foo/bar.txt") instead of (shell-command-as-string "diff -q /scpx:root@dev.stvs.ch:/root/foo/bar.txt")

Basically, both shell-command and directory-files are smart about TRAMP but they are not compatible in their smartness. shell-command does its magic transparently by looking at pwd, while directory-files handles paths with protocols like scpx:// or ssh:// etc.

fourier commented 10 years ago

Ok, then please add (require 'tramp) to be able to perform the ztree-diff from default emacs

Silex commented 10 years ago

Done :wink:

fourier commented 10 years ago

Thanks, merged.

Silex commented 10 years ago

:+1: