aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Großjohann2002-07-11 20:26:19 +0000
committerKai Großjohann2002-07-11 20:26:19 +0000
commitcebb4ec6c59f776a6eac3d74d33c101c8a4afa2c (patch)
tree72fc5941d29057634e4ad5a41943f2fc56cc3077
parent505edaeb0e37f1a92bb5a22ec7e7a4e8c83f7615 (diff)
downloademacs-cebb4ec6c59f776a6eac3d74d33c101c8a4afa2c.tar.gz
emacs-cebb4ec6c59f776a6eac3d74d33c101c8a4afa2c.zip
(tramp-handle-make-symbolic-link): Implement.
-rw-r--r--lisp/ChangeLog1
-rw-r--r--lisp/net/tramp.el29
2 files changed, 20 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2664bf148f1..0a989ae5901 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -19,6 +19,7 @@
19 (tramp-handle-ange-ftp): Deleted. 19 (tramp-handle-ange-ftp): Deleted.
20 (tramp-disable-ange-ftp): New function, called at toplevel, 20 (tramp-disable-ange-ftp): New function, called at toplevel,
21 deletes Ange-FTP from file-name-handler-alist. 21 deletes Ange-FTP from file-name-handler-alist.
22 (tramp-handle-make-symbolic-link): Implement.
22 23
232002-07-10 Juanma Barranquero <lektu@terra.es> 242002-07-10 Juanma Barranquero <lektu@terra.es>
24 25
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index b29d478f17d..a845ed9335e 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1507,14 +1507,17 @@ If VAR is nil, then we bind `v' to the structure and `multi-method',
1507 1507
1508;;; File Name Handler Functions: 1508;;; File Name Handler Functions:
1509 1509
1510;; The following file name handler ops are not implemented (yet?).
1511
1512(defun tramp-handle-make-symbolic-link 1510(defun tramp-handle-make-symbolic-link
1513 (filename linkname &optional ok-if-already-exists) 1511 (filename linkname &optional ok-if-already-exists)
1514 "Like `make-symbolic-link' for tramp files. 1512 "Like `make-symbolic-link' for tramp files.
1515The LINKNAME argument should look like \"/path/to/target\" or 1513If LINKNAME is a non-Tramp file, it is used verbatim as the target of
1516\"relative-name\",and not like a Tramp filename." 1514the symlink. If LINKNAME is a Tramp file, only the path component is
1517 (error "Not implemented yet") 1515used as the target of the symlink.
1516
1517If LINKNAME is a Tramp file and the path component is relative, then
1518it is expanded first, before the path component is taken. Note that
1519this can give surprising results if the user/host for the source and
1520target of the symlink differ."
1518 (with-parsed-tramp-file-name linkname l 1521 (with-parsed-tramp-file-name linkname l
1519 (when (tramp-ange-ftp-file-name-p l-multi-method l-method) 1522 (when (tramp-ange-ftp-file-name-p l-multi-method l-method)
1520 (tramp-invoke-ange-ftp 'make-symbolic-link 1523 (tramp-invoke-ange-ftp 'make-symbolic-link
@@ -1527,8 +1530,7 @@ The LINKNAME argument should look like \"/path/to/target\" or
1527 "ln(1) does not exist on the remote host."))) 1530 "ln(1) does not exist on the remote host.")))
1528 1531
1529 ;; Do the 'confirm if exists' thing. 1532 ;; Do the 'confirm if exists' thing.
1530 (when (file-exists-p (expand-file-name filename 1533 (when (file-exists-p linkname)
1531 CCC))
1532 ;; What to do? 1534 ;; What to do?
1533 (if (or (null ok-if-already-exists) ; not allowed to exist 1535 (if (or (null ok-if-already-exists) ; not allowed to exist
1534 (and (numberp ok-if-already-exists) 1536 (and (numberp ok-if-already-exists)
@@ -1536,7 +1538,14 @@ The LINKNAME argument should look like \"/path/to/target\" or
1536 (format 1538 (format
1537 "File %s already exists; make it a link anyway? " 1539 "File %s already exists; make it a link anyway? "
1538 l-path))))) 1540 l-path)))))
1539 (signal 'file-already-exists (list "File already exists" l-path)))) 1541 (signal 'file-already-exists (list "File already exists" l-path))
1542 (delete-file linkname)))
1543
1544 ;; If FILENAME is a Tramp name, use just the path component.
1545 (when (tramp-tramp-file-p filename)
1546 (setq filename (tramp-file-name-path
1547 (tramp-dissect-file-name
1548 (expand-file-name filename)))))
1540 1549
1541 ;; Right, they are on the same host, regardless of user, method, etc. 1550 ;; Right, they are on the same host, regardless of user, method, etc.
1542 ;; We now make the link on the remote machine. This will occur as the user 1551 ;; We now make the link on the remote machine. This will occur as the user
@@ -1546,8 +1555,8 @@ The LINKNAME argument should look like \"/path/to/target\" or
1546 l-multi-method l-method l-user l-host 1555 l-multi-method l-method l-user l-host
1547 (format "cd %s && %s -sf %s %s" 1556 (format "cd %s && %s -sf %s %s"
1548 cwd ln 1557 cwd ln
1549 l-path 1558 filename
1550 filename) 1559 l-path)
1551 t))))) 1560 t)))))
1552 1561
1553 1562