diff options
| -rw-r--r-- | lisp/ChangeLog | 1 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 29 |
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 | ||
| 23 | 2002-07-10 Juanma Barranquero <lektu@terra.es> | 24 | 2002-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. |
| 1515 | The LINKNAME argument should look like \"/path/to/target\" or | 1513 | If LINKNAME is a non-Tramp file, it is used verbatim as the target of |
| 1516 | \"relative-name\",and not like a Tramp filename." | 1514 | the symlink. If LINKNAME is a Tramp file, only the path component is |
| 1517 | (error "Not implemented yet") | 1515 | used as the target of the symlink. |
| 1516 | |||
| 1517 | If LINKNAME is a Tramp file and the path component is relative, then | ||
| 1518 | it is expanded first, before the path component is taken. Note that | ||
| 1519 | this can give surprising results if the user/host for the source and | ||
| 1520 | target 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 | ||