Mercurial > emacs
comparison lisp/net/tramp-smb.el @ 59582:92796330257a
Sync with Tramp 2.0.47.
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Sun, 16 Jan 2005 13:18:31 +0000 |
parents | 1fbbe0bcfaac |
children | aac0a33f5772 6d92d69fae33 |
comparison
equal
deleted
inserted
replaced
59581:26fb5a3f95ac | 59582:92796330257a |
---|---|
170 (make-symbolic-link . tramp-smb-not-handled) | 170 (make-symbolic-link . tramp-smb-not-handled) |
171 (rename-file . tramp-smb-handle-rename-file) | 171 (rename-file . tramp-smb-handle-rename-file) |
172 (set-file-modes . tramp-smb-not-handled) | 172 (set-file-modes . tramp-smb-not-handled) |
173 (set-visited-file-modtime . tramp-smb-not-handled) | 173 (set-visited-file-modtime . tramp-smb-not-handled) |
174 (shell-command . tramp-smb-not-handled) | 174 (shell-command . tramp-smb-not-handled) |
175 ;; `substitute-in-file-name' performed by default handler | 175 (substitute-in-file-name . tramp-smb-handle-substitute-in-file-name) |
176 (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory) | 176 (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory) |
177 (vc-registered . tramp-smb-not-handled) | 177 (vc-registered . tramp-smb-not-handled) |
178 (verify-visited-file-modtime . tramp-smb-not-handled) | 178 (verify-visited-file-modtime . tramp-smb-not-handled) |
179 (write-region . tramp-smb-handle-write-region) | 179 (write-region . tramp-smb-handle-write-region) |
180 ) | 180 ) |
614 nil tramp-smb-method user host | 614 nil tramp-smb-method user host |
615 5 "Copying file %s to file %s...done" filename newname) | 615 5 "Copying file %s to file %s...done" filename newname) |
616 (error "Cannot rename `%s'" filename))))))) | 616 (error "Cannot rename `%s'" filename))))))) |
617 | 617 |
618 (delete-file filename)) | 618 (delete-file filename)) |
619 | |
620 (defun tramp-smb-handle-substitute-in-file-name (filename) | |
621 "Like `handle-substitute-in-file-name' for tramp files. | |
622 Catches errors for shares like \"C$/\", which are common in Microsoft Windows." | |
623 (condition-case nil | |
624 (tramp-run-real-handler 'substitute-in-file-name (list filename)) | |
625 (error filename))) | |
619 | 626 |
620 (defun tramp-smb-handle-write-region | 627 (defun tramp-smb-handle-write-region |
621 (start end filename &optional append visit lockname confirm) | 628 (start end filename &optional append visit lockname confirm) |
622 "Like `write-region' for tramp files." | 629 "Like `write-region' for tramp files." |
623 (unless (eq append nil) | 630 (unless (eq append nil) |
1082 (let ((borrow (< (cadr t1) (cadr t2)))) | 1089 (let ((borrow (< (cadr t1) (cadr t2)))) |
1083 (list (- (car t1) (car t2) (if borrow 1 0)) | 1090 (list (- (car t1) (car t2) (if borrow 1 0)) |
1084 (- (+ (if borrow 65536 0) (cadr t1)) (cadr t2))))) | 1091 (- (+ (if borrow 65536 0) (cadr t1)) (cadr t2))))) |
1085 | 1092 |
1086 | 1093 |
1087 ;; `PC-do-completion' touches the returning "$$" by `substitute-in-file-name'. | |
1088 ;; Must be corrected. | |
1089 | |
1090 (defadvice PC-do-completion (around tramp-smb-advice-PC-do-completion) | |
1091 "Changes \"$\" back to \"$$\" in minibuffer." | |
1092 (if (funcall PC-completion-as-file-name-predicate) | |
1093 | |
1094 (progn | |
1095 ;; Substitute file names | |
1096 (let* ((beg (or (and (functionp 'minibuffer-prompt-end) ; Emacs 21 | |
1097 (funcall 'minibuffer-prompt-end)) | |
1098 (point-min))) | |
1099 (end (point-max)) | |
1100 (str (substitute-in-file-name (buffer-substring beg end)))) | |
1101 (delete-region beg end) | |
1102 (insert str) | |
1103 (ad-set-arg 2 (point))) | |
1104 | |
1105 ;; Do `PC-do-completion' without substitution | |
1106 (let* (save) | |
1107 (fset 'save (symbol-function 'substitute-in-file-name)) | |
1108 (unwind-protect | |
1109 (progn | |
1110 (fset 'substitute-in-file-name (symbol-function 'identity)) | |
1111 ad-do-it) | |
1112 (fset 'substitute-in-file-name (symbol-function 'save)))) | |
1113 | |
1114 ;; Expand "$" | |
1115 (let* ((beg (or (and (functionp 'minibuffer-prompt-end) ; Emacs 21 | |
1116 (funcall 'minibuffer-prompt-end)) | |
1117 (point-min))) | |
1118 (end (point-max)) | |
1119 (str (buffer-substring beg end))) | |
1120 (delete-region beg end) | |
1121 (insert (if (string-match "\\(\\$\\)\\(/\\|$\\)" str) | |
1122 (replace-match "$$" nil nil str 1) | |
1123 str)))) | |
1124 | |
1125 ;; No file names. Behave unchanged. | |
1126 ad-do-it)) | |
1127 | |
1128 ;; Activate advice. Recent Emacsen don't need that. | |
1129 (when (functionp 'PC-do-completion) | |
1130 (condition-case nil | |
1131 (substitute-in-file-name "C$/") | |
1132 (error | |
1133 (ad-activate 'PC-do-completion)))) | |
1134 | |
1135 (provide 'tramp-smb) | 1094 (provide 'tramp-smb) |
1136 | 1095 |
1137 ;;; TODO: | 1096 ;;; TODO: |
1138 | 1097 |
1139 ;; * Provide a local smb.conf. The default one might not be readable. | 1098 ;; * Provide a local smb.conf. The default one might not be readable. |