diff options
| author | Michael Albinus | 2008-04-27 16:39:03 +0000 |
|---|---|---|
| committer | Michael Albinus | 2008-04-27 16:39:03 +0000 |
| commit | 87bdd2c7a5481583bcaf0853ad94561917d64534 (patch) | |
| tree | a9502801306c2c0799a7f76fd9c659397a9b68ac | |
| parent | 2788143d514792c0cb93cb31c017656c7e343937 (diff) | |
| download | emacs-87bdd2c7a5481583bcaf0853ad94561917d64534.tar.gz emacs-87bdd2c7a5481583bcaf0853ad94561917d64534.zip | |
* net/tramp.el (tramp-handle-make-symbolic-link)
(tramp-handle-file-name-directory)
(tramp-handle-file-name-nondirectory, tramp-handle-file-truename)
(tramp-do-copy-or-rename-file-directly)
(tramp-handle-insert-directory, tramp-handle-expand-file-name)
(tramp-handle-substitute-in-file-name)
(tramp-handle-insert-file-contents, tramp-handle-write-region)
* net/tramp-cache.el (tramp-get-file-property)
(tramp-set-file-property, tramp-flush-file-property)
(tramp-flush-directory-property)
* net/tramp-cpmpat.el (tramp-compat-make-temp-file)
* net/tramp-fish.el (tramp-fish-handle-expand-file-name): Disable
`file-name-handler-alist' when handling localname. It could have
a remote file syntax, like a VMS file name.
| -rw-r--r-- | lisp/ChangeLog | 17 | ||||
| -rw-r--r-- | lisp/net/tramp-cache.el | 9 | ||||
| -rw-r--r-- | lisp/net/tramp-compat.el | 11 | ||||
| -rw-r--r-- | lisp/net/tramp-fish.el | 6 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 87 |
5 files changed, 86 insertions, 44 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c7150bab8ec..10a3060edfe 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,20 @@ | |||
| 1 | 2008-04-27 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * net/tramp.el (tramp-handle-make-symbolic-link) | ||
| 4 | (tramp-handle-file-name-directory) | ||
| 5 | (tramp-handle-file-name-nondirectory, tramp-handle-file-truename) | ||
| 6 | (tramp-do-copy-or-rename-file-directly) | ||
| 7 | (tramp-handle-insert-directory, tramp-handle-expand-file-name) | ||
| 8 | (tramp-handle-substitute-in-file-name) | ||
| 9 | (tramp-handle-insert-file-contents, tramp-handle-write-region) | ||
| 10 | * net/tramp-cache.el (tramp-get-file-property) | ||
| 11 | (tramp-set-file-property, tramp-flush-file-property) | ||
| 12 | (tramp-flush-directory-property) | ||
| 13 | * net/tramp-compat.el (tramp-compat-make-temp-file) | ||
| 14 | * net/tramp-fish.el (tramp-fish-handle-expand-file-name): Disable | ||
| 15 | `file-name-handler-alist' when handling localname. It could have | ||
| 16 | a remote file syntax, like a VMS file name. | ||
| 17 | |||
| 1 | 2008-04-27 Vinicius Jose Latorre <viniciusjl@ig.com.br> | 18 | 2008-04-27 Vinicius Jose Latorre <viniciusjl@ig.com.br> |
| 2 | 19 | ||
| 3 | * whitespace.el: New version 11.1. | 20 | * whitespace.el: New version 11.1. |
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index 945823959cd..32c2a4a18f6 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el | |||
| @@ -95,7 +95,7 @@ | |||
| 95 | Returns DEFAULT if not set." | 95 | Returns DEFAULT if not set." |
| 96 | ;; Unify localname. | 96 | ;; Unify localname. |
| 97 | (setq vec (copy-sequence vec)) | 97 | (setq vec (copy-sequence vec)) |
| 98 | (aset vec 3 (directory-file-name file)) | 98 | (aset vec 3 (tramp-run-real-handler 'directory-file-name (list file))) |
| 99 | (let* ((hash (or (gethash vec tramp-cache-data) | 99 | (let* ((hash (or (gethash vec tramp-cache-data) |
| 100 | (puthash vec (make-hash-table :test 'equal) | 100 | (puthash vec (make-hash-table :test 'equal) |
| 101 | tramp-cache-data))) | 101 | tramp-cache-data))) |
| @@ -110,7 +110,7 @@ Returns DEFAULT if not set." | |||
| 110 | Returns VALUE." | 110 | Returns VALUE." |
| 111 | ;; Unify localname. | 111 | ;; Unify localname. |
| 112 | (setq vec (copy-sequence vec)) | 112 | (setq vec (copy-sequence vec)) |
| 113 | (aset vec 3 (directory-file-name file)) | 113 | (aset vec 3 (tramp-run-real-handler 'directory-file-name (list file))) |
| 114 | (let ((hash (or (gethash vec tramp-cache-data) | 114 | (let ((hash (or (gethash vec tramp-cache-data) |
| 115 | (puthash vec (make-hash-table :test 'equal) | 115 | (puthash vec (make-hash-table :test 'equal) |
| 116 | tramp-cache-data)))) | 116 | tramp-cache-data)))) |
| @@ -122,14 +122,15 @@ Returns VALUE." | |||
| 122 | "Remove all properties of FILE in the cache context of VEC." | 122 | "Remove all properties of FILE in the cache context of VEC." |
| 123 | ;; Unify localname. | 123 | ;; Unify localname. |
| 124 | (setq vec (copy-sequence vec)) | 124 | (setq vec (copy-sequence vec)) |
| 125 | (aset vec 3 (directory-file-name file)) | 125 | (aset vec 3 (tramp-run-real-handler 'directory-file-name (list file))) |
| 126 | (tramp-message vec 8 "%s" file) | 126 | (tramp-message vec 8 "%s" file) |
| 127 | (remhash vec tramp-cache-data)) | 127 | (remhash vec tramp-cache-data)) |
| 128 | 128 | ||
| 129 | (defun tramp-flush-directory-property (vec directory) | 129 | (defun tramp-flush-directory-property (vec directory) |
| 130 | "Remove all properties of DIRECTORY in the cache context of VEC. | 130 | "Remove all properties of DIRECTORY in the cache context of VEC. |
| 131 | Remove also properties of all files in subdirectories." | 131 | Remove also properties of all files in subdirectories." |
| 132 | (let ((directory (directory-file-name directory))) | 132 | (let ((directory (tramp-run-real-handler |
| 133 | 'directory-file-name (list directory)))) | ||
| 133 | (tramp-message vec 8 "%s" directory) | 134 | (tramp-message vec 8 "%s" directory) |
| 134 | (maphash | 135 | (maphash |
| 135 | '(lambda (key value) | 136 | '(lambda (key value) |
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index b07ffd5f56d..0f66ee2183d 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el | |||
| @@ -153,11 +153,12 @@ this is the function `temp-directory'." | |||
| 153 | (defsubst tramp-compat-make-temp-file (filename) | 153 | (defsubst tramp-compat-make-temp-file (filename) |
| 154 | "Create a temporary file (compat function). | 154 | "Create a temporary file (compat function). |
| 155 | Add the extension of FILENAME, if existing." | 155 | Add the extension of FILENAME, if existing." |
| 156 | (let ((prefix (expand-file-name | 156 | (let* (file-name-handler-alist |
| 157 | (symbol-value 'tramp-temp-name-prefix) | 157 | (prefix (expand-file-name |
| 158 | (tramp-compat-temporary-file-directory))) | 158 | (symbol-value 'tramp-temp-name-prefix) |
| 159 | (extension (file-name-extension filename t)) | 159 | (tramp-compat-temporary-file-directory))) |
| 160 | result) | 160 | (extension (file-name-extension filename t)) |
| 161 | result) | ||
| 161 | (condition-case nil | 162 | (condition-case nil |
| 162 | (setq result | 163 | (setq result |
| 163 | (funcall (symbol-function 'make-temp-file) prefix nil extension)) | 164 | (funcall (symbol-function 'make-temp-file) prefix nil extension)) |
diff --git a/lisp/net/tramp-fish.el b/lisp/net/tramp-fish.el index 639ea60f2a0..ee13d1e4516 100644 --- a/lisp/net/tramp-fish.el +++ b/lisp/net/tramp-fish.el | |||
| @@ -352,7 +352,7 @@ pass to the OPERATION." | |||
| 352 | (tramp-run-real-handler 'expand-file-name (list name nil))) | 352 | (tramp-run-real-handler 'expand-file-name (list name nil))) |
| 353 | ;; Dissect NAME. | 353 | ;; Dissect NAME. |
| 354 | (with-parsed-tramp-file-name name nil | 354 | (with-parsed-tramp-file-name name nil |
| 355 | (unless (file-name-absolute-p localname) | 355 | (unless (tramp-run-real-handler 'file-name-absolute-p (list localname)) |
| 356 | (setq localname (concat "~/" localname))) | 356 | (setq localname (concat "~/" localname))) |
| 357 | ;; Tilde expansion if necessary. | 357 | ;; Tilde expansion if necessary. |
| 358 | (when (string-match "\\`\\(~[^/]*\\)\\(.*\\)\\'" localname) | 358 | (when (string-match "\\`\\(~[^/]*\\)\\(.*\\)\\'" localname) |
| @@ -385,8 +385,8 @@ pass to the OPERATION." | |||
| 385 | (tramp-make-tramp-file-name | 385 | (tramp-make-tramp-file-name |
| 386 | method user host | 386 | method user host |
| 387 | (tramp-drop-volume-letter | 387 | (tramp-drop-volume-letter |
| 388 | (tramp-run-real-handler 'expand-file-name | 388 | (tramp-run-real-handler |
| 389 | (list localname)))))))) | 389 | 'expand-file-name (list localname)))))))) |
| 390 | 390 | ||
| 391 | (defun tramp-fish-handle-file-attributes (filename &optional id-format) | 391 | (defun tramp-fish-handle-file-attributes (filename &optional id-format) |
| 392 | "Like `file-attributes' for Tramp files." | 392 | "Like `file-attributes' for Tramp files." |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 4b0b66abf7f..1008897d9ea 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -2119,7 +2119,8 @@ this can give surprising results if the user/host for the source and | |||
| 2119 | target of the symlink differ." | 2119 | target of the symlink differ." |
| 2120 | (with-parsed-tramp-file-name linkname l | 2120 | (with-parsed-tramp-file-name linkname l |
| 2121 | (let ((ln (tramp-get-remote-ln l)) | 2121 | (let ((ln (tramp-get-remote-ln l)) |
| 2122 | (cwd (file-name-directory l-localname))) | 2122 | (cwd (tramp-run-real-handler |
| 2123 | 'file-name-directory (list l-localname)))) | ||
| 2123 | (unless ln | 2124 | (unless ln |
| 2124 | (tramp-error | 2125 | (tramp-error |
| 2125 | l 'file-error | 2126 | l 'file-error |
| @@ -2151,7 +2152,6 @@ target of the symlink differ." | |||
| 2151 | (tramp-send-command-and-check | 2152 | (tramp-send-command-and-check |
| 2152 | l (format "cd %s && %s -sf %s %s" cwd ln filename l-localname) t))))) | 2153 | l (format "cd %s && %s -sf %s %s" cwd ln filename l-localname) t))))) |
| 2153 | 2154 | ||
| 2154 | |||
| 2155 | (defun tramp-handle-load (file &optional noerror nomessage nosuffix must-suffix) | 2155 | (defun tramp-handle-load (file &optional noerror nomessage nosuffix must-suffix) |
| 2156 | "Like `load' for Tramp files." | 2156 | "Like `load' for Tramp files." |
| 2157 | (with-parsed-tramp-file-name (expand-file-name file) nil | 2157 | (with-parsed-tramp-file-name (expand-file-name file) nil |
| @@ -2194,12 +2194,13 @@ target of the symlink differ." | |||
| 2194 | (tramp-file-name-method v) | 2194 | (tramp-file-name-method v) |
| 2195 | (tramp-file-name-user v) | 2195 | (tramp-file-name-user v) |
| 2196 | (tramp-file-name-host v) | 2196 | (tramp-file-name-host v) |
| 2197 | (file-name-directory (or (tramp-file-name-localname v) ""))))) | 2197 | (tramp-run-real-handler |
| 2198 | 'file-name-directory (list (or (tramp-file-name-localname v) "")))))) | ||
| 2198 | 2199 | ||
| 2199 | (defun tramp-handle-file-name-nondirectory (file) | 2200 | (defun tramp-handle-file-name-nondirectory (file) |
| 2200 | "Like `file-name-nondirectory' but aware of Tramp files." | 2201 | "Like `file-name-nondirectory' but aware of Tramp files." |
| 2201 | (with-parsed-tramp-file-name file nil | 2202 | (with-parsed-tramp-file-name file nil |
| 2202 | (file-name-nondirectory localname))) | 2203 | (tramp-run-real-handler 'file-name-nondirectory (list localname)))) |
| 2203 | 2204 | ||
| 2204 | (defun tramp-handle-file-truename (filename &optional counter prev-dirs) | 2205 | (defun tramp-handle-file-truename (filename &optional counter prev-dirs) |
| 2205 | "Like `file-truename' for Tramp files." | 2206 | "Like `file-truename' for Tramp files." |
| @@ -2207,7 +2208,8 @@ target of the symlink differ." | |||
| 2207 | (with-file-property v localname "file-truename" | 2208 | (with-file-property v localname "file-truename" |
| 2208 | (let* ((directory-sep-char ?/) ; for XEmacs | 2209 | (let* ((directory-sep-char ?/) ; for XEmacs |
| 2209 | (steps (tramp-split-string localname "/")) | 2210 | (steps (tramp-split-string localname "/")) |
| 2210 | (localnamedir (file-name-as-directory localname)) | 2211 | (localnamedir (tramp-run-real-handler |
| 2212 | 'file-name-as-directory (list localname))) | ||
| 2211 | (is-dir (string= localname localnamedir)) | 2213 | (is-dir (string= localname localnamedir)) |
| 2212 | (thisstep nil) | 2214 | (thisstep nil) |
| 2213 | (numchase 0) | 2215 | (numchase 0) |
| @@ -3128,20 +3130,23 @@ the uid and gid from FILENAME." | |||
| 3128 | ((or t1 t2) | 3130 | ((or t1 t2) |
| 3129 | (cond | 3131 | (cond |
| 3130 | ;; We can do it directly. | 3132 | ;; We can do it directly. |
| 3131 | ((and (file-readable-p localname1) | 3133 | ((let (file-name-handler-alist) |
| 3132 | (file-writable-p (file-name-directory localname2)) | 3134 | (and (file-readable-p localname1) |
| 3133 | (or (file-directory-p localname2) | 3135 | (file-writable-p (file-name-directory localname2)) |
| 3134 | (file-writable-p localname2))) | 3136 | (or (file-directory-p localname2) |
| 3137 | (file-writable-p localname2)))) | ||
| 3135 | (if (eq op 'copy) | 3138 | (if (eq op 'copy) |
| 3136 | (tramp-compat-copy-file | 3139 | (tramp-compat-copy-file |
| 3137 | localname1 localname2 ok-if-already-exists | 3140 | localname1 localname2 ok-if-already-exists |
| 3138 | keep-date preserve-uid-gid) | 3141 | keep-date preserve-uid-gid) |
| 3139 | (rename-file localname1 localname2 ok-if-already-exists))) | 3142 | (tramp-run-real-handler |
| 3143 | 'rename-file (list localname1 localname2 ok-if-already-exists)))) | ||
| 3140 | 3144 | ||
| 3141 | ;; We can do it directly with `tramp-send-command' | 3145 | ;; We can do it directly with `tramp-send-command' |
| 3142 | ((and (file-readable-p (concat prefix localname1)) | 3146 | ((let (file-name-handler-alist) |
| 3147 | (and (file-readable-p (concat prefix localname1)) | ||
| 3143 | (file-writable-p | 3148 | (file-writable-p |
| 3144 | (file-name-directory (concat prefix localname2)))) | 3149 | (file-name-directory (concat prefix localname2))))) |
| 3145 | (tramp-do-copy-or-rename-file-directly | 3150 | (tramp-do-copy-or-rename-file-directly |
| 3146 | op (concat prefix localname1) (concat prefix localname2) | 3151 | op (concat prefix localname1) (concat prefix localname2) |
| 3147 | ok-if-already-exists keep-date t) | 3152 | ok-if-already-exists keep-date t) |
| @@ -3172,7 +3177,8 @@ the uid and gid from FILENAME." | |||
| 3172 | (tramp-compat-copy-file | 3177 | (tramp-compat-copy-file |
| 3173 | localname1 tmpfile ok-if-already-exists | 3178 | localname1 tmpfile ok-if-already-exists |
| 3174 | keep-date preserve-uid-gid) | 3179 | keep-date preserve-uid-gid) |
| 3175 | (rename-file localname1 tmpfile ok-if-already-exists)) | 3180 | (tramp-run-real-handler |
| 3181 | 'rename-file (list localname1 tmpfile ok-if-already-exists))) | ||
| 3176 | ;; We must change the ownership as local user. | 3182 | ;; We must change the ownership as local user. |
| 3177 | (tramp-set-file-uid-gid | 3183 | (tramp-set-file-uid-gid |
| 3178 | tmpfile | 3184 | tmpfile |
| @@ -3188,7 +3194,9 @@ the uid and gid from FILENAME." | |||
| 3188 | (tramp-shell-quote-argument tmpfile) | 3194 | (tramp-shell-quote-argument tmpfile) |
| 3189 | (tramp-shell-quote-argument localname2)))) | 3195 | (tramp-shell-quote-argument localname2)))) |
| 3190 | (t1 | 3196 | (t1 |
| 3191 | (rename-file tmpfile localname2 ok-if-already-exists))))))))) | 3197 | (tramp-run-real-handler |
| 3198 | 'rename-file | ||
| 3199 | (list tmpfile localname2 ok-if-already-exists)))))))))) | ||
| 3192 | 3200 | ||
| 3193 | ;; Set the time and mode. Mask possible errors. | 3201 | ;; Set the time and mode. Mask possible errors. |
| 3194 | ;; Won't be applied for 'rename. | 3202 | ;; Won't be applied for 'rename. |
| @@ -3198,7 +3206,6 @@ the uid and gid from FILENAME." | |||
| 3198 | (set-file-modes newname (file-modes filename))) | 3206 | (set-file-modes newname (file-modes filename))) |
| 3199 | (error))))) | 3207 | (error))))) |
| 3200 | 3208 | ||
| 3201 | |||
| 3202 | (defun tramp-do-copy-or-rename-file-out-of-band (op filename newname keep-date) | 3209 | (defun tramp-do-copy-or-rename-file-out-of-band (op filename newname keep-date) |
| 3203 | "Invoke rcp program to copy. | 3210 | "Invoke rcp program to copy. |
| 3204 | One of FILENAME and NEWNAME must be a Tramp name, the other must | 3211 | One of FILENAME and NEWNAME must be a Tramp name, the other must |
| @@ -3450,8 +3457,10 @@ This is like `dired-recursive-delete-directory' for Tramp files." | |||
| 3450 | switches filename (if wildcard "yes" "no") | 3457 | switches filename (if wildcard "yes" "no") |
| 3451 | (if full-directory-p "yes" "no")) | 3458 | (if full-directory-p "yes" "no")) |
| 3452 | (when wildcard | 3459 | (when wildcard |
| 3453 | (setq wildcard (file-name-nondirectory localname)) | 3460 | (setq wildcard (tramp-run-real-handler |
| 3454 | (setq localname (file-name-directory localname))) | 3461 | 'file-name-nondirectory (list localname))) |
| 3462 | (setq localname (tramp-run-real-handler | ||
| 3463 | 'file-name-directory (list localname)))) | ||
| 3455 | (when (listp switches) | 3464 | (when (listp switches) |
| 3456 | (setq switches (mapconcat 'identity switches " "))) | 3465 | (setq switches (mapconcat 'identity switches " "))) |
| 3457 | (unless full-directory-p | 3466 | (unless full-directory-p |
| @@ -3472,19 +3481,24 @@ This is like `dired-recursive-delete-directory' for Tramp files." | |||
| 3472 | (tramp-barf-unless-okay | 3481 | (tramp-barf-unless-okay |
| 3473 | v | 3482 | v |
| 3474 | (format "cd %s" (tramp-shell-quote-argument | 3483 | (format "cd %s" (tramp-shell-quote-argument |
| 3475 | (file-name-directory localname))) | 3484 | (tramp-run-real-handler |
| 3485 | 'file-name-directory (list localname)))) | ||
| 3476 | "Couldn't `cd %s'" | 3486 | "Couldn't `cd %s'" |
| 3477 | (tramp-shell-quote-argument (file-name-directory localname))) | 3487 | (tramp-shell-quote-argument |
| 3488 | (tramp-run-real-handler 'file-name-directory (list localname)))) | ||
| 3478 | (tramp-send-command | 3489 | (tramp-send-command |
| 3479 | v | 3490 | v |
| 3480 | (format "%s %s %s" | 3491 | (format "%s %s %s" |
| 3481 | (tramp-get-ls-command v) | 3492 | (tramp-get-ls-command v) |
| 3482 | switches | 3493 | switches |
| 3483 | (if (or wildcard | 3494 | (if (or wildcard |
| 3484 | (zerop (length (file-name-nondirectory localname)))) | 3495 | (zerop (length |
| 3496 | (tramp-run-real-handler | ||
| 3497 | 'file-name-nondirectory (list localname))))) | ||
| 3485 | "" | 3498 | "" |
| 3486 | (tramp-shell-quote-argument | 3499 | (tramp-shell-quote-argument |
| 3487 | (file-name-nondirectory localname)))))) | 3500 | (tramp-run-real-handler |
| 3501 | 'file-name-nondirectory (list localname))))))) | ||
| 3488 | ;; We cannot use `insert-buffer-substring' because the Tramp buffer | 3502 | ;; We cannot use `insert-buffer-substring' because the Tramp buffer |
| 3489 | ;; changes its contents before insertion due to calling | 3503 | ;; changes its contents before insertion due to calling |
| 3490 | ;; `expand-file' and alike. | 3504 | ;; `expand-file' and alike. |
| @@ -3514,7 +3528,7 @@ the result will be a local, non-Tramp, filename." | |||
| 3514 | (tramp-run-real-handler 'expand-file-name (list name nil)) | 3528 | (tramp-run-real-handler 'expand-file-name (list name nil)) |
| 3515 | ;; Dissect NAME. | 3529 | ;; Dissect NAME. |
| 3516 | (with-parsed-tramp-file-name name nil | 3530 | (with-parsed-tramp-file-name name nil |
| 3517 | (unless (file-name-absolute-p localname) | 3531 | (unless (tramp-run-real-handler 'file-name-absolute-p (list localname)) |
| 3518 | (setq localname (concat "~/" localname))) | 3532 | (setq localname (concat "~/" localname))) |
| 3519 | ;; Tilde expansion if necessary. This needs a shell which | 3533 | ;; Tilde expansion if necessary. This needs a shell which |
| 3520 | ;; groks tilde expansion! The function `tramp-find-shell' is | 3534 | ;; groks tilde expansion! The function `tramp-find-shell' is |
| @@ -3554,8 +3568,8 @@ the result will be a local, non-Tramp, filename." | |||
| 3554 | (tramp-make-tramp-file-name | 3568 | (tramp-make-tramp-file-name |
| 3555 | method user host | 3569 | method user host |
| 3556 | (tramp-drop-volume-letter | 3570 | (tramp-drop-volume-letter |
| 3557 | (tramp-run-real-handler 'expand-file-name | 3571 | (tramp-run-real-handler |
| 3558 | (list localname)))))))) | 3572 | 'expand-file-name (list localname)))))))) |
| 3559 | 3573 | ||
| 3560 | (defun tramp-replace-environment-variables (filename) | 3574 | (defun tramp-replace-environment-variables (filename) |
| 3561 | "Replace environment variables in FILENAME. | 3575 | "Replace environment variables in FILENAME. |
| @@ -3586,7 +3600,9 @@ beginning of local filename are not substituted." | |||
| 3586 | (when method (substitute-in-file-name method)) | 3600 | (when method (substitute-in-file-name method)) |
| 3587 | (when user (substitute-in-file-name user)) | 3601 | (when user (substitute-in-file-name user)) |
| 3588 | (when host (substitute-in-file-name host)) | 3602 | (when host (substitute-in-file-name host)) |
| 3589 | (when localname (substitute-in-file-name localname)))) | 3603 | (when localname |
| 3604 | (tramp-run-real-handler | ||
| 3605 | 'substitute-in-file-name (list localname))))) | ||
| 3590 | ;; Ignore in LOCALNAME everything before "//" or "/~". | 3606 | ;; Ignore in LOCALNAME everything before "//" or "/~". |
| 3591 | (when (and (stringp localname) (string-match ".+?/\\(/\\|~\\)" localname)) | 3607 | (when (and (stringp localname) (string-match ".+?/\\(/\\|~\\)" localname)) |
| 3592 | (setq filename | 3608 | (setq filename |
| @@ -3968,9 +3984,12 @@ coding system might not be determined. This function repairs it." | |||
| 3968 | (list (expand-file-name filename) 0)) | 3984 | (list (expand-file-name filename) 0)) |
| 3969 | 3985 | ||
| 3970 | (if (and (tramp-local-host-p v) | 3986 | (if (and (tramp-local-host-p v) |
| 3971 | (file-readable-p localname)) | 3987 | (let (file-name-handler-alist) (file-readable-p localname))) |
| 3972 | ;; Short track: if we are on the local host, we can run directly. | 3988 | ;; Short track: if we are on the local host, we can run directly. |
| 3973 | (setq result (insert-file-contents localname visit beg end replace)) | 3989 | (setq result |
| 3990 | (tramp-run-real-handler | ||
| 3991 | 'insert-file-contents | ||
| 3992 | (list localname visit beg end replace))) | ||
| 3974 | 3993 | ||
| 3975 | ;; `insert-file-contents-literally' takes care to avoid calling | 3994 | ;; `insert-file-contents-literally' takes care to avoid calling |
| 3976 | ;; jka-compr. By let-binding inhibit-file-name-operation, we | 3995 | ;; jka-compr. By let-binding inhibit-file-name-operation, we |
| @@ -4146,11 +4165,16 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |||
| 4146 | (tramp-get-remote-gid v 'integer)))) | 4165 | (tramp-get-remote-gid v 'integer)))) |
| 4147 | 4166 | ||
| 4148 | (if (and (tramp-local-host-p v) | 4167 | (if (and (tramp-local-host-p v) |
| 4149 | (file-writable-p (file-name-directory localname)) | 4168 | ;; `file-writable-p' calls 'file-expand-file-name'. We |
| 4150 | (or (file-directory-p localname) | 4169 | ;; cannot use `tramp-run-real-handler' therefore. |
| 4151 | (file-writable-p localname))) | 4170 | (let (file-name-handler-alist) |
| 4171 | (file-writable-p (file-name-directory localname)) | ||
| 4172 | (or (file-directory-p localname) | ||
| 4173 | (file-writable-p localname)))) | ||
| 4152 | ;; Short track: if we are on the local host, we can run directly. | 4174 | ;; Short track: if we are on the local host, we can run directly. |
| 4153 | (write-region start end localname append 'no-message lockname confirm) | 4175 | (tramp-run-real-handler |
| 4176 | 'write-region | ||
| 4177 | (list start end localname append 'no-message lockname confirm)) | ||
| 4154 | 4178 | ||
| 4155 | (let ((rem-dec (tramp-get-remote-coding v "remote-decoding")) | 4179 | (let ((rem-dec (tramp-get-remote-coding v "remote-decoding")) |
| 4156 | (loc-enc (tramp-get-local-coding v "local-encoding")) | 4180 | (loc-enc (tramp-get-local-coding v "local-encoding")) |
| @@ -6644,7 +6668,6 @@ Not actually used. Use `(format \"%o\" i)' instead?" | |||
| 6644 | (t (concat (tramp-decimal-to-octal (/ i 8)) | 6668 | (t (concat (tramp-decimal-to-octal (/ i 8)) |
| 6645 | (number-to-string (% i 8)))))) | 6669 | (number-to-string (% i 8)))))) |
| 6646 | 6670 | ||
| 6647 | |||
| 6648 | ;; Kudos to Gerd Moellmann for this suggestion. | 6671 | ;; Kudos to Gerd Moellmann for this suggestion. |
| 6649 | (defun tramp-octal-to-decimal (ostr) | 6672 | (defun tramp-octal-to-decimal (ostr) |
| 6650 | "Given a string of octal digits, return a decimal number." | 6673 | "Given a string of octal digits, return a decimal number." |