From aff67808c108e2b24bbc626d66647d6c759134b9 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 19 Mar 2008 21:06:37 +0000 Subject: [PATCH] * net/tramp.el (tramp-let-maybe): Removed. (tramp-drop-volume-letter): Don't use `replace-regexp-in-string'. It does not exist under XEmacs. (tramp-handle-file-truename, tramp-handle-expand-file-name) (tramp-completion-file-name-handler): Let-bind `directory-sep-char'. --- lisp/ChangeLog | 12 +++++++++++ lisp/net/tramp.el | 51 +++++++++++++++++++---------------------------- 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e5f9e969815..ed6f30769b0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,15 @@ +2008-03-19 Michael Albinus + + * net/tramp.el (tramp-let-maybe): Removed. + (tramp-drop-volume-letter): Don't use `replace-regexp-in-string'. + It does not exist under XEmacs. + (tramp-handle-file-truename, tramp-handle-expand-file-name) + (tramp-completion-file-name-handler): Let-bind + `directory-sep-char'. + + * net/tramp-fish.el (tramp-fish-handle-expand-file-name): Let-bind + `directory-sep-char'. + 2008-03-19 Stefan Monnier * help-fns.el (describe-function-1): Don't signal "missing arglist" diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index d530da37e22..fa5cdafca56 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -5,7 +5,7 @@ ;; (copyright statements below in code to be updated with the above notice) -;; Author: Kai Großjohann +;; Author: Kai Großjohann ;; Michael Albinus ;; Keywords: comm, processes @@ -1957,18 +1957,6 @@ FILE must be a local file name on a connection identified via VEC." (put 'with-connection-property 'edebug-form-spec t) (font-lock-add-keywords 'emacs-lisp-mode '("\\")) -;;;###autoload -(defmacro tramp-let-maybe (variable value &rest body) - "Let-bind VARIABLE to VALUE in BODY, but only if VARIABLE is not obsolete. -BODY is executed whether or not the variable is obsolete. -The intent is to protect against `obsolete variable' warnings." - `(if (get ',variable 'byte-obsolete-variable) - (progn ,@body) - (let ((,variable ,value)) - ,@body))) -(put 'tramp-let-maybe 'lisp-indent-function 2) -(put 'tramp-let-maybe 'edebug-form-spec t) - (defsubst tramp-make-tramp-temp-file (vec) "Create a temporary file on the remote host identified by VEC. Return the local name of the temporary file." @@ -2201,9 +2189,9 @@ target of the symlink differ." "Like `file-truename' for Tramp files." (with-parsed-tramp-file-name (expand-file-name filename) nil (with-file-property v localname "file-truename" - (let* ((steps (tramp-split-string localname "/")) - (localnamedir (tramp-let-maybe directory-sep-char ?/ ;for XEmacs - (file-name-as-directory localname))) + (let* ((directory-sep-char ?/) ; for XEmacs + (steps (tramp-split-string localname "/")) + (localnamedir (file-name-as-directory localname)) (is-dir (string= localname localnamedir)) (thisstep nil) (numchase 0) @@ -3505,7 +3493,10 @@ The function `tramp-handle-expand-file-name' calls `expand-file-name' locally on a remote file name. When the local system is a W32 system but the remote system is Unix, this introduces a superfluous drive letter into the file name. This function removes it." - (save-match-data (replace-regexp-in-string tramp-root-regexp "/" name))) + (save-match-data + (if (string-match tramp-root-regexp name) + (replace-match "/" nil t name) + name))) (defalias 'tramp-drop-volume-letter 'identity))) @@ -3558,13 +3549,13 @@ the result will be a local, non-Tramp, filename." ;; would otherwise use backslash. `default-directory' is ;; bound, because on Windows there would be problems with UNC ;; shares or Cygwin mounts. - (tramp-let-maybe directory-sep-char ?/ - (let ((default-directory (tramp-compat-temporary-file-directory))) - (tramp-make-tramp-file-name - method user host - (tramp-drop-volume-letter - (tramp-run-real-handler 'expand-file-name - (list localname))))))))) + (let ((directory-sep-char ?/) + (default-directory (tramp-compat-temporary-file-directory))) + (tramp-make-tramp-file-name + method user host + (tramp-drop-volume-letter + (tramp-run-real-handler 'expand-file-name + (list localname)))))))) (defun tramp-handle-substitute-in-file-name (filename) "Like `substitute-in-file-name' for Tramp files. @@ -4500,11 +4491,11 @@ Fall back to normal file name handler if no Tramp handler exists." Falls back to normal file name handler if no Tramp file name handler exists." ;; We bind `directory-sep-char' here for XEmacs on Windows, which ;; would otherwise use backslash. - (tramp-let-maybe directory-sep-char ?/ - (let ((fn (assoc operation tramp-completion-file-name-handler-alist))) - (if fn - (save-match-data (apply (cdr fn) args)) - (tramp-completion-run-real-handler operation args)))))) + (let ((directory-sep-char ?/) + (fn (assoc operation tramp-completion-file-name-handler-alist))) + (if fn + (save-match-data (apply (cdr fn) args)) + (tramp-completion-run-real-handler operation args))))) ;;;###autoload (defsubst tramp-register-file-name-handler () @@ -7371,7 +7362,7 @@ Only works for Bourne-like shells." ;; transfer method to use. (Greg Stark) ;; * Remove unneeded parameters from methods. ;; * Invoke rsync once for copying a whole directory hierarchy. -;; (Francesco Potortì) +;; (Francesco Potortì) ;; * Make it work for different encodings, and for different file name ;; encodings, too. (Daniel Pittman) ;; * Progress reports while copying files. (Michael Kifer) -- 2.39.2