Francis Litterio <[EMAIL PROTECTED]> writes: > Here's what I had to do to make it work: > > 1. In my .emacs startup file, I do: > > (require 'tramp) > (setq tramp-default-method "scpx") > > This is required when using TRAMP under NT Emacs as described in the > manual. > > to load up TRAMP. I have load-path set appropriately.
Right. Nothing special here. Or am I missing something? > 2. Next, my .emacs file executes this horror: > > (let ((shell-file-name "c:/apps/cygwin/bin/bash.exe")) > (shell-command "echo /tmp/ssh-*/agent.* 2>/dev/null" " *temp*")) > (save-excursion > (set-buffer " *temp*") > (end-of-line) > (if (> (buffer-size) 5) > (setenv "SSH_AUTH_SOCK" (buffer-substring (point-min) (point))) > (ding) > (message "my-general.el: WARNING: ssh-agent is not running!") > (sit-for 3))) > > The above mess is to cope with what I think is a fairly common > situation -- namely, where the user launches NT Emacs using a > shortcut on the desktop but starts ssh-agent from a bash shell also > launched from the desktop. Since Emacs is not a descendant of > ssh-agent, it does not inherit the SSH_AUTH_SOCK environment > variable (and neither does scp). > > My solution (above) is a total hack. It malfunctions if the echo > command outputs more than one pathname, which happens if you have old > ssh-agent socket directories lying around. If TRAMP had were to call > a hook at just the right moment, I could write some Elisp to find the > most recent ssh-agent socket file and setenv the SSH_AUTH_SOCK > environment variable within Emacs. > > Maybe the general solution is to create a tramp-methods key named > tramp-pre-rcp-hook, which is run just before tramp-rcp-program > executes? Whee. Isn't it enough to do it when Emacs starts, or perhaps when Tramp is loaded? > 3. Next, I had to make the following change to lisp/tramp.el. > > *************** > *** 3113,3118 **** > --- 3113,3119 ---- > "Like `insert-file-contents' for tramp files." > (barf-if-buffer-read-only) > (setq filename (expand-file-name filename)) > + (setq buffer-file-name filename) > (with-parsed-tramp-file-name filename nil > (when (tramp-ange-ftp-file-name-p multi-method method user host) > (tramp-invoke-ange-ftp 'insert-file-contents > > This may not be the right thing to do, but it prevents a > wrong-type-argument error from vc-file-not-found-hook and from > find-file-noselect-1 when they each evaluate (file-truename > buffer-file-name) with buffer-file-name set to nil. It is indeed not the right thing to do, since (if I understand correctly) this means that buffer-file-name changes if you do C-x i /some/other/file RET (if the other file is remote so that the above code is executed). Can you find out why vc-file-not-found-hook and find-file-noselect-1 complain when it is done via Tramp but not for local files? Maybe the problem can be solved another way. > 4. Next, I had to make the following change to lisp/tramp.el. > > *** 3024,3030 **** > (unless (file-exists-p filename) > (error "Cannot make local copy of non-existing file `%s'" > filename)) > ! (setq tmpfil (tramp-make-temp-file)) > (cond (rcp-program > ;; Use rcp-like program for file transfer. > (tramp-message-for-buffer > --- 3024,3030 ---- > (unless (file-exists-p filename) > (error "Cannot make local copy of non-existing file `%s'" > filename)) > ! (setq tmpfil (substring (tramp-make-temp-file) 2)) > (cond (rcp-program > ;; Use rcp-like program for file transfer. > (tramp-message-for-buffer > > This is to cope with the fact that, by default, NT Emacs has > temporary-file-directory set to C:/DOCUME~1/username/LOCALS~1/Temp/, > which is unacceptable to Cygwin's scp as the second argument, because > scp interprets the "c:" as a hostname! The substring call chops off > the "C:", leaving tmpfil set to a value that is acceptable to both > Cygwin's scp and NT Emacs (and, more importantly, means the same > thing to both of them). Would it help to introduce a kludge variable tramp-temp-dir which defaults to nil? You could set it to the right value, without "C:". kai -- ~/.signature is: umop ap!sdn (Frank Nobis) _______________________________________________ Tramp-devel mailing list [EMAIL PROTECTED] http://mail.freesoftware.fsf.org/mailman/listinfo/tramp-devel