aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2009-10-08 15:19:56 +0000
committerMichael Albinus2009-10-08 15:19:56 +0000
commita17632c1dc8fdcfc956f1a779e66cdea81f4a755 (patch)
tree7cc72db6bfa210d67679f089b4191f7697786b2e
parent5be883cd9875e53da3b582c148c9d6dcd3a4825a (diff)
downloademacs-a17632c1dc8fdcfc956f1a779e66cdea81f4a755.tar.gz
emacs-a17632c1dc8fdcfc956f1a779e66cdea81f4a755.zip
* net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
(tramp-file-name-real-host, tramp-file-name-port): Apply `save-match-data.
-rw-r--r--lisp/net/tramp.el50
1 files changed, 27 insertions, 23 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index baac3247963..f266d314b67 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3905,11 +3905,11 @@ the result will be a local, non-Tramp, filename."
3905 (while (string-match "//" localname) 3905 (while (string-match "//" localname)
3906 (setq localname (replace-match "/" t t localname))) 3906 (setq localname (replace-match "/" t t localname)))
3907 ;; No tilde characters in file name, do normal 3907 ;; No tilde characters in file name, do normal
3908 ;; expand-file-name (this does "/./" and "/../"). We bind 3908 ;; `expand-file-name' (this does "/./" and "/../"). We bind
3909 ;; `directory-sep-char' here for XEmacs on Windows, which 3909 ;; `directory-sep-char' here for XEmacs on Windows, which would
3910 ;; would otherwise use backslash. `default-directory' is 3910 ;; otherwise use backslash. `default-directory' is bound,
3911 ;; bound, because on Windows there would be problems with UNC 3911 ;; because on Windows there would be problems with UNC shares or
3912 ;; shares or Cygwin mounts. 3912 ;; Cygwin mounts.
3913 (let ((directory-sep-char ?/) 3913 (let ((directory-sep-char ?/)
3914 (default-directory (tramp-compat-temporary-file-directory))) 3914 (default-directory (tramp-compat-temporary-file-directory)))
3915 (tramp-make-tramp-file-name 3915 (tramp-make-tramp-file-name
@@ -7296,35 +7296,39 @@ Not actually used. Use `(format \"%o\" i)' instead?"
7296;; "user%domain". Sometimes, we must extract these parts. 7296;; "user%domain". Sometimes, we must extract these parts.
7297(defun tramp-file-name-real-user (vec) 7297(defun tramp-file-name-real-user (vec)
7298 "Return the user name of VEC without domain." 7298 "Return the user name of VEC without domain."
7299 (let ((user (tramp-file-name-user vec))) 7299 (save-match-data
7300 (if (and (stringp user) 7300 (let ((user (tramp-file-name-user vec)))
7301 (string-match tramp-user-with-domain-regexp user)) 7301 (if (and (stringp user)
7302 (match-string 1 user) 7302 (string-match tramp-user-with-domain-regexp user))
7303 user))) 7303 (match-string 1 user)
7304 user))))
7304 7305
7305(defun tramp-file-name-domain (vec) 7306(defun tramp-file-name-domain (vec)
7306 "Return the domain name of VEC." 7307 "Return the domain name of VEC."
7307 (let ((user (tramp-file-name-user vec))) 7308 (save-match-data
7308 (and (stringp user) 7309 (let ((user (tramp-file-name-user vec)))
7309 (string-match tramp-user-with-domain-regexp user) 7310 (and (stringp user)
7310 (match-string 2 user)))) 7311 (string-match tramp-user-with-domain-regexp user)
7312 (match-string 2 user)))))
7311 7313
7312;; The host part of a Tramp file name vector can be of kind 7314;; The host part of a Tramp file name vector can be of kind
7313;; "host#port". Sometimes, we must extract these parts. 7315;; "host#port". Sometimes, we must extract these parts.
7314(defun tramp-file-name-real-host (vec) 7316(defun tramp-file-name-real-host (vec)
7315 "Return the host name of VEC without port." 7317 "Return the host name of VEC without port."
7316 (let ((host (tramp-file-name-host vec))) 7318 (save-match-data
7317 (if (and (stringp host) 7319 (let ((host (tramp-file-name-host vec)))
7318 (string-match tramp-host-with-port-regexp host)) 7320 (if (and (stringp host)
7319 (match-string 1 host) 7321 (string-match tramp-host-with-port-regexp host))
7320 host))) 7322 (match-string 1 host)
7323 host))))
7321 7324
7322(defun tramp-file-name-port (vec) 7325(defun tramp-file-name-port (vec)
7323 "Return the port number of VEC." 7326 "Return the port number of VEC."
7324 (let ((host (tramp-file-name-host vec))) 7327 (save-match-data
7325 (and (stringp host) 7328 (let ((host (tramp-file-name-host vec)))
7326 (string-match tramp-host-with-port-regexp host) 7329 (and (stringp host)
7327 (string-to-number (match-string 2 host))))) 7330 (string-match tramp-host-with-port-regexp host)
7331 (string-to-number (match-string 2 host))))))
7328 7332
7329(defun tramp-tramp-file-p (name) 7333(defun tramp-tramp-file-p (name)
7330 "Return t if NAME is a Tramp file." 7334 "Return t if NAME is a Tramp file."