1713 |
this can give surprising results if the user/host for the source and |
this can give surprising results if the user/host for the source and |
1714 |
target of the symlink differ." |
target of the symlink differ." |
1715 |
(with-parsed-tramp-file-name linkname l |
(with-parsed-tramp-file-name linkname l |
1716 |
(when (tramp-ange-ftp-file-name-p l-multi-method l-method) |
(when (tramp-ange-ftp-file-name-p l-multi-method l-method l-user l-host) |
1717 |
(tramp-invoke-ange-ftp 'make-symbolic-link |
(tramp-invoke-ange-ftp 'make-symbolic-link |
1718 |
filename linkname ok-if-already-exists)) |
filename linkname ok-if-already-exists)) |
1719 |
(let ((ln (tramp-get-remote-ln l-multi-method l-method l-user l-host)) |
(let ((ln (tramp-get-remote-ln l-multi-method l-method l-user l-host)) |
1759 |
(unless (file-name-absolute-p file) |
(unless (file-name-absolute-p file) |
1760 |
(error "Tramp cannot `load' files without absolute path name")) |
(error "Tramp cannot `load' files without absolute path name")) |
1761 |
(with-parsed-tramp-file-name file nil |
(with-parsed-tramp-file-name file nil |
1762 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
1763 |
(tramp-invoke-ange-ftp 'load |
(tramp-invoke-ange-ftp 'load |
1764 |
file noerror nomessage nosuffix must-suffix)) |
file noerror nomessage nosuffix must-suffix)) |
1765 |
(unless nosuffix |
(unless nosuffix |
1794 |
"Like `file-name-directory' but aware of TRAMP files." |
"Like `file-name-directory' but aware of TRAMP files." |
1795 |
;; everything except the last filename thing is the directory |
;; everything except the last filename thing is the directory |
1796 |
(with-parsed-tramp-file-name file nil |
(with-parsed-tramp-file-name file nil |
1797 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
1798 |
(tramp-invoke-ange-ftp 'file-name-directory file)) |
(tramp-invoke-ange-ftp 'file-name-directory file)) |
1799 |
;; For the following condition, two possibilities should be tried: |
;; For the following condition, two possibilities should be tried: |
1800 |
;; (1) (string= path "") |
;; (1) (string= path "") |
1820 |
(defun tramp-handle-file-name-nondirectory (file) |
(defun tramp-handle-file-name-nondirectory (file) |
1821 |
"Like `file-name-nondirectory' but aware of TRAMP files." |
"Like `file-name-nondirectory' but aware of TRAMP files." |
1822 |
(with-parsed-tramp-file-name file nil |
(with-parsed-tramp-file-name file nil |
1823 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
1824 |
(tramp-invoke-ange-ftp 'file-name-nondirectory file)) |
(tramp-invoke-ange-ftp 'file-name-nondirectory file)) |
1825 |
(file-name-nondirectory path))) |
(file-name-nondirectory path))) |
1826 |
|
|
1830 |
;; Ange-FTP does not support truename processing, but for |
;; Ange-FTP does not support truename processing, but for |
1831 |
;; convenience we pretend it did and forward the call to Ange-FTP |
;; convenience we pretend it did and forward the call to Ange-FTP |
1832 |
;; anyway. Ange-FTP then just invokes `identity'. |
;; anyway. Ange-FTP then just invokes `identity'. |
1833 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
1834 |
(tramp-invoke-ange-ftp 'file-truename filename)) |
(tramp-invoke-ange-ftp 'file-truename filename)) |
1835 |
(let* ((steps (tramp-split-string path "/")) |
(let* ((steps (tramp-split-string path "/")) |
1836 |
(pathdir (let ((directory-sep-char ?/)) |
(pathdir (let ((directory-sep-char ?/)) |
1903 |
(defun tramp-handle-file-exists-p (filename) |
(defun tramp-handle-file-exists-p (filename) |
1904 |
"Like `file-exists-p' for tramp files." |
"Like `file-exists-p' for tramp files." |
1905 |
(with-parsed-tramp-file-name filename nil |
(with-parsed-tramp-file-name filename nil |
1906 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
1907 |
(tramp-invoke-ange-ftp 'file-exists-p filename)) |
(tramp-invoke-ange-ftp 'file-exists-p filename)) |
1908 |
(save-excursion |
(save-excursion |
1909 |
(zerop (tramp-send-command-and-check |
(zerop (tramp-send-command-and-check |
1921 |
rather than as numbers." |
rather than as numbers." |
1922 |
(let (result) |
(let (result) |
1923 |
(with-parsed-tramp-file-name filename nil |
(with-parsed-tramp-file-name filename nil |
1924 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
1925 |
(tramp-invoke-ange-ftp 'file-attributes filename)) |
(tramp-invoke-ange-ftp 'file-attributes filename)) |
1926 |
(when (tramp-handle-file-exists-p filename) |
(when (tramp-handle-file-exists-p filename) |
1927 |
;; file exists, find out stuff |
;; file exists, find out stuff |
2056 |
;; handle, either, but at least it pretends to. I wonder if |
;; handle, either, but at least it pretends to. I wonder if |
2057 |
;; Ange-FTP should also pretend to grok |
;; Ange-FTP should also pretend to grok |
2058 |
;; `set-visited-file-modtime', for consistency? |
;; `set-visited-file-modtime', for consistency? |
2059 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2060 |
(throw 'tramp-forward-to-ange-ftp |
(throw 'tramp-forward-to-ange-ftp |
2061 |
(tramp-run-real-handler 'set-visited-file-modtime |
(tramp-run-real-handler 'set-visited-file-modtime |
2062 |
(list time-list)))) |
(list time-list)))) |
2091 |
(with-current-buffer buf |
(with-current-buffer buf |
2092 |
(let ((f (buffer-file-name))) |
(let ((f (buffer-file-name))) |
2093 |
(with-parsed-tramp-file-name f nil |
(with-parsed-tramp-file-name f nil |
2094 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2095 |
;; This one requires a hack since the file name is not passed |
;; This one requires a hack since the file name is not passed |
2096 |
;; on the arg list. |
;; on the arg list. |
2097 |
(let ((buffer-file-name (tramp-make-ange-ftp-file-name |
(let ((buffer-file-name (tramp-make-ange-ftp-file-name |
2130 |
(defun tramp-handle-set-file-modes (filename mode) |
(defun tramp-handle-set-file-modes (filename mode) |
2131 |
"Like `set-file-modes' for tramp files." |
"Like `set-file-modes' for tramp files." |
2132 |
(with-parsed-tramp-file-name filename nil |
(with-parsed-tramp-file-name filename nil |
2133 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2134 |
(tramp-invoke-ange-ftp 'set-file-modes mode filename)) |
(tramp-invoke-ange-ftp 'set-file-modes mode filename)) |
2135 |
(save-excursion |
(save-excursion |
2136 |
(unless (zerop (tramp-send-command-and-check |
(unless (zerop (tramp-send-command-and-check |
2149 |
(defun tramp-handle-file-executable-p (filename) |
(defun tramp-handle-file-executable-p (filename) |
2150 |
"Like `file-executable-p' for tramp files." |
"Like `file-executable-p' for tramp files." |
2151 |
(with-parsed-tramp-file-name filename nil |
(with-parsed-tramp-file-name filename nil |
2152 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2153 |
(tramp-invoke-ange-ftp 'file-executable-p filename)) |
(tramp-invoke-ange-ftp 'file-executable-p filename)) |
2154 |
(zerop (tramp-run-test "-x" filename)))) |
(zerop (tramp-run-test "-x" filename)))) |
2155 |
|
|
2156 |
(defun tramp-handle-file-readable-p (filename) |
(defun tramp-handle-file-readable-p (filename) |
2157 |
"Like `file-readable-p' for tramp files." |
"Like `file-readable-p' for tramp files." |
2158 |
(with-parsed-tramp-file-name filename nil |
(with-parsed-tramp-file-name filename nil |
2159 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2160 |
(tramp-invoke-ange-ftp 'file-readable-p filename)) |
(tramp-invoke-ange-ftp 'file-readable-p filename)) |
2161 |
(zerop (tramp-run-test "-r" filename)))) |
(zerop (tramp-run-test "-r" filename)))) |
2162 |
|
|
2163 |
(defun tramp-handle-file-accessible-directory-p (filename) |
(defun tramp-handle-file-accessible-directory-p (filename) |
2164 |
"Like `file-accessible-directory-p' for tramp files." |
"Like `file-accessible-directory-p' for tramp files." |
2165 |
(with-parsed-tramp-file-name filename nil |
(with-parsed-tramp-file-name filename nil |
2166 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2167 |
(tramp-invoke-ange-ftp 'file-accessible-directory-p filename)) |
(tramp-invoke-ange-ftp 'file-accessible-directory-p filename)) |
2168 |
(and (zerop (tramp-run-test "-d" filename)) |
(and (zerop (tramp-run-test "-d" filename)) |
2169 |
(zerop (tramp-run-test "-r" filename)) |
(zerop (tramp-run-test "-r" filename)) |
2206 |
(with-parsed-tramp-file-name file1 v1 |
(with-parsed-tramp-file-name file1 v1 |
2207 |
(with-parsed-tramp-file-name file2 v2 |
(with-parsed-tramp-file-name file2 v2 |
2208 |
(when (and (tramp-ange-ftp-file-name-p |
(when (and (tramp-ange-ftp-file-name-p |
2209 |
v1-multi-method v1-method) |
v1-multi-method v1-method v1-user v1-host) |
2210 |
(tramp-ange-ftp-file-name-p |
(tramp-ange-ftp-file-name-p |
2211 |
v2-multi-method v2-method)) |
v2-multi-method v2-method v2-user v2-host)) |
2212 |
(tramp-invoke-ange-ftp 'file-newer-than-file-p |
(tramp-invoke-ange-ftp 'file-newer-than-file-p |
2213 |
file1 file2)) |
file1 file2)) |
2214 |
(unless (and (equal v1-multi-method v2-multi-method) |
(unless (and (equal v1-multi-method v2-multi-method) |
2234 |
(defun tramp-handle-file-modes (filename) |
(defun tramp-handle-file-modes (filename) |
2235 |
"Like `file-modes' for tramp files." |
"Like `file-modes' for tramp files." |
2236 |
(with-parsed-tramp-file-name filename nil |
(with-parsed-tramp-file-name filename nil |
2237 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2238 |
(tramp-invoke-ange-ftp 'file-modes filename)) |
(tramp-invoke-ange-ftp 'file-modes filename)) |
2239 |
(when (file-exists-p filename) |
(when (file-exists-p filename) |
2240 |
(tramp-mode-string-to-int |
(tramp-mode-string-to-int |
2251 |
;; |
;; |
2252 |
;; Alternatives: `cd %s', `test -d %s' |
;; Alternatives: `cd %s', `test -d %s' |
2253 |
(with-parsed-tramp-file-name filename nil |
(with-parsed-tramp-file-name filename nil |
2254 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2255 |
(tramp-invoke-ange-ftp 'file-directory-p filename)) |
(tramp-invoke-ange-ftp 'file-directory-p filename)) |
2256 |
(save-excursion |
(save-excursion |
2257 |
(zerop |
(zerop |
2264 |
(defun tramp-handle-file-regular-p (filename) |
(defun tramp-handle-file-regular-p (filename) |
2265 |
"Like `file-regular-p' for tramp files." |
"Like `file-regular-p' for tramp files." |
2266 |
(with-parsed-tramp-file-name filename nil |
(with-parsed-tramp-file-name filename nil |
2267 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2268 |
(tramp-invoke-ange-ftp 'file-regular-p filename)) |
(tramp-invoke-ange-ftp 'file-regular-p filename)) |
2269 |
(and (tramp-handle-file-exists-p filename) |
(and (tramp-handle-file-exists-p filename) |
2270 |
(eq ?- (aref (nth 8 (tramp-handle-file-attributes filename)) 0))))) |
(eq ?- (aref (nth 8 (tramp-handle-file-attributes filename)) 0))))) |
2272 |
(defun tramp-handle-file-symlink-p (filename) |
(defun tramp-handle-file-symlink-p (filename) |
2273 |
"Like `file-symlink-p' for tramp files." |
"Like `file-symlink-p' for tramp files." |
2274 |
(with-parsed-tramp-file-name filename nil |
(with-parsed-tramp-file-name filename nil |
2275 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2276 |
(tramp-invoke-ange-ftp 'file-symlink-p filename)) |
(tramp-invoke-ange-ftp 'file-symlink-p filename)) |
2277 |
(let ((x (car (tramp-handle-file-attributes filename)))) |
(let ((x (car (tramp-handle-file-attributes filename)))) |
2278 |
(when (stringp x) x)))) |
(when (stringp x) x)))) |
2280 |
(defun tramp-handle-file-writable-p (filename) |
(defun tramp-handle-file-writable-p (filename) |
2281 |
"Like `file-writable-p' for tramp files." |
"Like `file-writable-p' for tramp files." |
2282 |
(with-parsed-tramp-file-name filename nil |
(with-parsed-tramp-file-name filename nil |
2283 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2284 |
(tramp-invoke-ange-ftp 'file-writable-p filename)) |
(tramp-invoke-ange-ftp 'file-writable-p filename)) |
2285 |
(if (tramp-handle-file-exists-p filename) |
(if (tramp-handle-file-exists-p filename) |
2286 |
;; Existing files must be writable. |
;; Existing files must be writable. |
2294 |
(defun tramp-handle-file-ownership-preserved-p (filename) |
(defun tramp-handle-file-ownership-preserved-p (filename) |
2295 |
"Like `file-ownership-preserved-p' for tramp files." |
"Like `file-ownership-preserved-p' for tramp files." |
2296 |
(with-parsed-tramp-file-name filename nil |
(with-parsed-tramp-file-name filename nil |
2297 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2298 |
(tramp-invoke-ange-ftp 'file-ownership-preserved-p filename)) |
(tramp-invoke-ange-ftp 'file-ownership-preserved-p filename)) |
2299 |
(or (not (tramp-handle-file-exists-p filename)) |
(or (not (tramp-handle-file-exists-p filename)) |
2300 |
;; Existing files must be writable. |
;; Existing files must be writable. |
2314 |
(defun tramp-handle-directory-file-name (directory) |
(defun tramp-handle-directory-file-name (directory) |
2315 |
"Like `directory-file-name' for tramp files." |
"Like `directory-file-name' for tramp files." |
2316 |
(with-parsed-tramp-file-name directory nil |
(with-parsed-tramp-file-name directory nil |
2317 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2318 |
(tramp-invoke-ange-ftp 'directory-file-name directory)) |
(tramp-invoke-ange-ftp 'directory-file-name directory)) |
2319 |
(let ((directory-length-1 (1- (length directory)))) |
(let ((directory-length-1 (1- (length directory)))) |
2320 |
(save-match-data |
(save-match-data |
2330 |
&optional full match nosort files-only) |
&optional full match nosort files-only) |
2331 |
"Like `directory-files' for tramp files." |
"Like `directory-files' for tramp files." |
2332 |
(with-parsed-tramp-file-name directory nil |
(with-parsed-tramp-file-name directory nil |
2333 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2334 |
(tramp-invoke-ange-ftp 'directory-files |
(tramp-invoke-ange-ftp 'directory-files |
2335 |
directory full match nosort files-only)) |
directory full match nosort files-only)) |
2336 |
(let (result x) |
(let (result x) |
2387 |
(defun tramp-handle-file-name-all-completions (filename directory) |
(defun tramp-handle-file-name-all-completions (filename directory) |
2388 |
"Like `file-name-all-completions' for tramp files." |
"Like `file-name-all-completions' for tramp files." |
2389 |
(with-parsed-tramp-file-name directory nil |
(with-parsed-tramp-file-name directory nil |
2390 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2391 |
(tramp-invoke-ange-ftp 'file-name-all-completions |
(tramp-invoke-ange-ftp 'file-name-all-completions |
2392 |
filename directory)) |
filename directory)) |
2393 |
(unless (save-match-data (string-match "/" filename)) |
(unless (save-match-data (string-match "/" filename)) |
2440 |
"tramp-handle-file-name-completion invoked on non-tramp directory `%s'" |
"tramp-handle-file-name-completion invoked on non-tramp directory `%s'" |
2441 |
directory)) |
directory)) |
2442 |
(with-parsed-tramp-file-name directory nil |
(with-parsed-tramp-file-name directory nil |
2443 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2444 |
(tramp-invoke-ange-ftp 'file-name-completion |
(tramp-invoke-ange-ftp 'file-name-completion |
2445 |
filename directory)) |
filename directory)) |
2446 |
(try-completion |
(try-completion |
2464 |
(equal v1-host v2-host)) |
(equal v1-host v2-host)) |
2465 |
(error "add-name-to-file: %s" |
(error "add-name-to-file: %s" |
2466 |
"only implemented for same method, same user, same host")) |
"only implemented for same method, same user, same host")) |
2467 |
(when (and (tramp-ange-ftp-file-name-p v1-multi-method v1-method) |
(when (and (tramp-ange-ftp-file-name-p v1-multi-method v1-method v1-user v1-host) |
2468 |
(tramp-ange-ftp-file-name-p v2-multi-method v2-method)) |
(tramp-ange-ftp-file-name-p v2-multi-method v2-method v2-user v2-host)) |
2469 |
(tramp-invoke-ange-ftp 'add-name-to-file |
(tramp-invoke-ange-ftp 'add-name-to-file |
2470 |
filename newname ok-if-already-exists)) |
filename newname ok-if-already-exists)) |
2471 |
(when (tramp-ange-ftp-file-name-p v1-multi-method v1-method) |
(when (tramp-ange-ftp-file-name-p v1-multi-method v1-method v1-user v1-host) |
2472 |
(tramp-invoke-ange-ftp 'add-name-to-file |
(tramp-invoke-ange-ftp 'add-name-to-file |
2473 |
filename newname ok-if-already-exists)) |
filename newname ok-if-already-exists)) |
2474 |
(when (tramp-ange-ftp-file-name-p v2-multi-method v2-method) |
(when (tramp-ange-ftp-file-name-p v2-multi-method v2-method v2-user v2-host) |
2475 |
(tramp-invoke-ange-ftp 'add-name-to-file |
(tramp-invoke-ange-ftp 'add-name-to-file |
2476 |
filename newname ok-if-already-exists)) |
filename newname ok-if-already-exists)) |
2477 |
(when (and (not ok-if-already-exists) |
(when (and (not ok-if-already-exists) |
2549 |
(with-parsed-tramp-file-name filename v1 |
(with-parsed-tramp-file-name filename v1 |
2550 |
(with-parsed-tramp-file-name newname v2 |
(with-parsed-tramp-file-name newname v2 |
2551 |
;; Possibly invoke Ange-FTP. |
;; Possibly invoke Ange-FTP. |
2552 |
(when (and (tramp-ange-ftp-file-name-p v1-multi-method v1-method) |
(when (and (tramp-ange-ftp-file-name-p v1-multi-method v1-method v1-user v1-host) |
2553 |
(tramp-ange-ftp-file-name-p v2-multi-method v2-method)) |
(tramp-ange-ftp-file-name-p v2-multi-method v2-method v2-user v2-host)) |
2554 |
(if (eq op 'copy) |
(if (eq op 'copy) |
2555 |
(tramp-invoke-ange-ftp |
(tramp-invoke-ange-ftp |
2556 |
'copy-file filename newname ok-if-already-exists keep-date) |
'copy-file filename newname ok-if-already-exists keep-date) |
2640 |
"Like `make-directory' for tramp files." |
"Like `make-directory' for tramp files." |
2641 |
(setq dir (expand-file-name dir)) |
(setq dir (expand-file-name dir)) |
2642 |
(with-parsed-tramp-file-name dir nil |
(with-parsed-tramp-file-name dir nil |
2643 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2644 |
(tramp-invoke-ange-ftp 'make-directory dir parents)) |
(tramp-invoke-ange-ftp 'make-directory dir parents)) |
2645 |
(save-excursion |
(save-excursion |
2646 |
(tramp-barf-unless-okay |
(tramp-barf-unless-okay |
2656 |
"Like `delete-directory' for tramp files." |
"Like `delete-directory' for tramp files." |
2657 |
(setq directory (expand-file-name directory)) |
(setq directory (expand-file-name directory)) |
2658 |
(with-parsed-tramp-file-name directory nil |
(with-parsed-tramp-file-name directory nil |
2659 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2660 |
(tramp-invoke-ange-ftp 'delete-directory directory)) |
(tramp-invoke-ange-ftp 'delete-directory directory)) |
2661 |
(save-excursion |
(save-excursion |
2662 |
(tramp-send-command |
(tramp-send-command |
2669 |
"Like `delete-file' for tramp files." |
"Like `delete-file' for tramp files." |
2670 |
(setq filename (expand-file-name filename)) |
(setq filename (expand-file-name filename)) |
2671 |
(with-parsed-tramp-file-name filename nil |
(with-parsed-tramp-file-name filename nil |
2672 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2673 |
(tramp-invoke-ange-ftp 'delete-file filename)) |
(tramp-invoke-ange-ftp 'delete-file filename)) |
2674 |
(save-excursion |
(save-excursion |
2675 |
(unless (zerop (tramp-send-command-and-check |
(unless (zerop (tramp-send-command-and-check |
2686 |
"Recursively delete the directory given. |
"Recursively delete the directory given. |
2687 |
This is like `dired-recursive-delete-directory' for tramp files." |
This is like `dired-recursive-delete-directory' for tramp files." |
2688 |
(with-parsed-tramp-file-name filename nil |
(with-parsed-tramp-file-name filename nil |
2689 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2690 |
(tramp-invoke-ange-ftp 'dired-recursive-delete-directory |
(tramp-invoke-ange-ftp 'dired-recursive-delete-directory |
2691 |
filename)) |
filename)) |
2692 |
;; run a shell command 'rm -r <path>' |
;; run a shell command 'rm -r <path>' |
2709 |
(defun tramp-handle-dired-call-process (program discard &rest arguments) |
(defun tramp-handle-dired-call-process (program discard &rest arguments) |
2710 |
"Like `dired-call-process' for tramp files." |
"Like `dired-call-process' for tramp files." |
2711 |
(with-parsed-tramp-file-name default-directory nil |
(with-parsed-tramp-file-name default-directory nil |
2712 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2713 |
(let ((default-directory |
(let ((default-directory |
2714 |
(tramp-make-ange-ftp-file-name user host path))) |
(tramp-make-ange-ftp-file-name user host path))) |
2715 |
(tramp-invoke-ange-ftp 'dired-call-process |
(tramp-invoke-ange-ftp 'dired-call-process |
2756 |
(setq switches (replace-match "" nil t switches))) |
(setq switches (replace-match "" nil t switches))) |
2757 |
(setq filename (expand-file-name filename)) |
(setq filename (expand-file-name filename)) |
2758 |
(with-parsed-tramp-file-name filename nil |
(with-parsed-tramp-file-name filename nil |
2759 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2760 |
(tramp-invoke-ange-ftp 'insert-directory |
(tramp-invoke-ange-ftp 'insert-directory |
2761 |
filename switches wildcard full-directory-p)) |
filename switches wildcard full-directory-p)) |
2762 |
(tramp-message-for-buffer |
(tramp-message-for-buffer |
2834 |
(defun tramp-handle-unhandled-file-name-directory (filename) |
(defun tramp-handle-unhandled-file-name-directory (filename) |
2835 |
"Like `unhandled-file-name-directory' for tramp files." |
"Like `unhandled-file-name-directory' for tramp files." |
2836 |
(with-parsed-tramp-file-name filename nil |
(with-parsed-tramp-file-name filename nil |
2837 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2838 |
(tramp-invoke-ange-ftp 'unhandled-file-name-directory |
(tramp-invoke-ange-ftp 'unhandled-file-name-directory |
2839 |
filename)) |
filename)) |
2840 |
(expand-file-name "~/"))) |
(expand-file-name "~/"))) |
2870 |
(list name nil)) |
(list name nil)) |
2871 |
;; Dissect NAME. |
;; Dissect NAME. |
2872 |
(with-parsed-tramp-file-name name nil |
(with-parsed-tramp-file-name name nil |
2873 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2874 |
(tramp-invoke-ange-ftp 'expand-file-name name nil)) |
(tramp-invoke-ange-ftp 'expand-file-name name nil)) |
2875 |
(unless (file-name-absolute-p path) |
(unless (file-name-absolute-p path) |
2876 |
(setq path (concat "~/" path))) |
(setq path (concat "~/" path))) |
2912 |
`tramp-end-of-output', followed by another newline." |
`tramp-end-of-output', followed by another newline." |
2913 |
(when (tramp-tramp-file-p default-directory) |
(when (tramp-tramp-file-p default-directory) |
2914 |
(with-parsed-tramp-file-name default-directory nil |
(with-parsed-tramp-file-name default-directory nil |
2915 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2916 |
(let ((default-directory (tramp-make-ange-ftp-file-name |
(let ((default-directory (tramp-make-ange-ftp-file-name |
2917 |
user host path))) |
user host path))) |
2918 |
(tramp-invoke-ange-ftp 'shell-command |
(tramp-invoke-ange-ftp 'shell-command |
2975 |
(defun tramp-handle-file-local-copy (filename) |
(defun tramp-handle-file-local-copy (filename) |
2976 |
"Like `file-local-copy' for tramp files." |
"Like `file-local-copy' for tramp files." |
2977 |
(with-parsed-tramp-file-name filename nil |
(with-parsed-tramp-file-name filename nil |
2978 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
2979 |
(tramp-invoke-ange-ftp 'file-local-copy filename)) |
(tramp-invoke-ange-ftp 'file-local-copy filename)) |
2980 |
(let ((trampbuf (get-buffer-create "*tramp output*")) |
(let ((trampbuf (get-buffer-create "*tramp output*")) |
2981 |
(rcp-program (tramp-get-rcp-program |
(rcp-program (tramp-get-rcp-program |
3087 |
(barf-if-buffer-read-only) |
(barf-if-buffer-read-only) |
3088 |
(setq filename (expand-file-name filename)) |
(setq filename (expand-file-name filename)) |
3089 |
(with-parsed-tramp-file-name filename nil |
(with-parsed-tramp-file-name filename nil |
3090 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
3091 |
(tramp-invoke-ange-ftp 'insert-file-contents |
(tramp-invoke-ange-ftp 'insert-file-contents |
3092 |
filename visit beg end replace)) |
filename visit beg end replace)) |
3093 |
(if (not (tramp-handle-file-exists-p filename)) |
(if (not (tramp-handle-file-exists-p filename)) |
3147 |
filename)) |
filename)) |
3148 |
(error "File not overwritten"))) |
(error "File not overwritten"))) |
3149 |
(with-parsed-tramp-file-name filename nil |
(with-parsed-tramp-file-name filename nil |
3150 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
3151 |
(tramp-invoke-ange-ftp 'write-region |
(tramp-invoke-ange-ftp 'write-region |
3152 |
start end filename append visit)) |
start end filename append visit)) |
3153 |
(let ((curbuf (current-buffer)) |
(let ((curbuf (current-buffer)) |
3481 |
(tramp-run-real-handler 'ange-ftp-hook-function |
(tramp-run-real-handler 'ange-ftp-hook-function |
3482 |
(cons operation args))))) |
(cons operation args))))) |
3483 |
|
|
3484 |
(defun tramp-ange-ftp-file-name-p (multi-method method) |
(defun tramp-ange-ftp-file-name-p (multi-method method user host) |
3485 |
"Check if it's a filename that should be forwarded to Ange-FTP." |
"Check if it's a filename that should be forwarded to Ange-FTP." |
3486 |
(and tramp-unified-filenames |
(and tramp-unified-filenames |
3487 |
(null multi-method) |
(null multi-method) |
3488 |
(string= method tramp-ftp-method))) |
(string= (tramp-find-method multi-method method user host) tramp-ftp-method))) |
3489 |
|
|
3490 |
|
|
3491 |
;;; Interactions with other packages: |
;;; Interactions with other packages: |
3496 |
(defun tramp-handle-expand-many-files (name) |
(defun tramp-handle-expand-many-files (name) |
3497 |
"Like `PC-expand-many-files' for tramp files." |
"Like `PC-expand-many-files' for tramp files." |
3498 |
(with-parsed-tramp-file-name name nil |
(with-parsed-tramp-file-name name nil |
3499 |
(when (tramp-ange-ftp-file-name-p multi-method method) |
(when (tramp-ange-ftp-file-name-p multi-method method user host) |
3500 |
(tramp-invoke-ange-ftp 'expand-many-files name)) |
(tramp-invoke-ange-ftp 'expand-many-files name)) |
3501 |
(save-match-data |
(save-match-data |
3502 |
(if (or (string-match "\\*" name) |
(if (or (string-match "\\*" name) |