3015 |
(barf-if-buffer-read-only) |
(barf-if-buffer-read-only) |
3016 |
(setq filename (expand-file-name filename)) |
(setq filename (expand-file-name filename)) |
3017 |
(with-parsed-tramp-file-name filename nil |
(with-parsed-tramp-file-name filename nil |
3018 |
(if (not (tramp-handle-file-exists-p filename)) |
(if (not (file-exists-p filename)) |
3019 |
(progn |
(progn |
3020 |
(when visit |
(when visit |
3021 |
(setq buffer-file-name filename) |
(setq buffer-file-name filename) |
3023 |
(set-buffer-modified-p nil)) |
(set-buffer-modified-p nil)) |
3024 |
(signal 'file-error |
(signal 'file-error |
3025 |
(format "File `%s' not found on remote host" filename)) |
(format "File `%s' not found on remote host" filename)) |
3026 |
(list (tramp-handle-expand-file-name filename) 0)) |
(list (expand-file-name filename) 0)) |
3027 |
(let ((local-copy (tramp-handle-file-local-copy filename)) |
(let ((local-copy (file-local-copy filename)) |
3028 |
(coding-system-used nil) |
(coding-system-used nil) |
3029 |
(result nil)) |
(result nil)) |
3030 |
(when visit |
(when visit |
3034 |
(tramp-message-for-buffer |
(tramp-message-for-buffer |
3035 |
multi-method method user host |
multi-method method user host |
3036 |
9 "Inserting local temp file `%s'..." local-copy) |
9 "Inserting local temp file `%s'..." local-copy) |
3037 |
(setq result |
(setq result (insert-file-contents local-copy nil beg end replace)) |
|
(tramp-run-real-handler 'insert-file-contents |
|
|
(list local-copy nil beg end replace))) |
|
3038 |
;; Now `last-coding-system-used' has right value. Remember it. |
;; Now `last-coding-system-used' has right value. Remember it. |
3039 |
(when (boundp 'last-coding-system-used) |
(when (boundp 'last-coding-system-used) |
3040 |
(setq coding-system-used last-coding-system-used)) |
(setq coding-system-used last-coding-system-used)) |