new vc rcs file checkin problem with tramp

Michael Albinus michael.albinus at gmx.de
Thu Sep 27 16:58:32 EDT 2007


Ville Skyttä <scop at xemacs.org> writes:

> But in the absence of process-file or similar that we could use the tramp 
> handlers for, let's leave tramp as is (patched) and go all the way then in 
> vc - the attached patch is not that pretty but I think it should fix this 
> issue.  Could you test it?

Sorry to enter your discussion. But I believe it is not a good idea to
have tramp-related code in vc*.el. In order to hide such dependencies,
tramp-vc.el was introduced.

I will do my best, but I cannot guarantee that the API will be kept
stable for internal Tramp functions. Therefore any code using Tramp
internal functions might fail in the future. And indeed,
`tramp-send-command-and-check' has a different parameter list in Tramp
2.1. And since Tramp 2.1 is also intended for XEmacs, your patch would
fail there already.

However, even if you take Tramp functionality directly, you should
minimize dependencies.

>  (defun vc-user-login-name (file)
>    "Return the name under which the user accesses the given FILE."
>    (or (and (eq (string-match tramp-file-name-regexp file) 0)

Hmm. In GNU Emacs (please forgive me) the function `file-remote-p'
supports file name handlers for magic file names. Such a call is much
more robust wrt Tramp internals.

    (or (and (file-remote-p file)

I believe it might be a good idea for XEmacs to expand its own
`file-remote-p' such a way. But it isn't applicable just now, I
understand.

>             ;; tramp case: execute "whoami" via tramp
> -           (let ((default-directory (file-name-directory file)))
> -             (with-temp-buffer
> -               (if (not (zerop (process-file "whoami" nil t)))

Maybe you can save this approach. All file name handler based functions
in Tramp are implemented as `tramp-handle-<function>' with exactly the
same parameter list. So you shall define something like this:

(or (functionp 'process-file)
    (defalias  'process-file 'tramp-handle-process-file))

The other altrnative would be to call `tramp-handle-process-file' directly.
But this would be more work to remove this hack once XEmacs knows
`process-file' as well (given, you have other places to use this
function too).

> -                   ;; fall through if "whoami" didn't work
> -                   nil
> -                 ;; remove trailing newline
> -                 (delete-region (1- (point-max)) (point-max))
> -                 (buffer-string)))))
> +           ;; XEmacs change: we don't have process-file or call-process for
> +           ;; which we could apply the tramp handler, use tramp directly
> +           (require 'tramp)
> +           (with-parsed-tramp-file-name file nil
> +             (if (not (zerop (tramp-send-command-and-check
> +                              multi-method method user host "whoami")))

As I said already, this won't work with Tramp 2.1 (it doesn't know
multi-method anymore). 

Best regards, Michael.



More information about the XEmacs-Beta mailing list