summaryrefslogtreecommitdiff
path: root/lisp/net/tramp-smb.el
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2005-01-16 13:18:31 +0000
committerMichael Albinus <michael.albinus@gmx.de>2005-01-16 13:18:31 +0000
commit01917a18b40405b2cb7eaf279e8db13875c9c5be (patch)
tree387f0176ba4ab98141ed1d41ff8fe03dd74577eb /lisp/net/tramp-smb.el
parent50af5100a6e0234668d100ca5d4cb3479436b8c0 (diff)
downloademacs-01917a18b40405b2cb7eaf279e8db13875c9c5be.tar.gz
Sync with Tramp 2.0.47.
Diffstat (limited to 'lisp/net/tramp-smb.el')
-rw-r--r--lisp/net/tramp-smb.el57
1 files changed, 8 insertions, 49 deletions
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index d0a7cf7b65f..6fa0433a574 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -172,7 +172,7 @@ This variable is local to each buffer.")
(set-file-modes . tramp-smb-not-handled)
(set-visited-file-modtime . tramp-smb-not-handled)
(shell-command . tramp-smb-not-handled)
- ;; `substitute-in-file-name' performed by default handler
+ (substitute-in-file-name . tramp-smb-handle-substitute-in-file-name)
(unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory)
(vc-registered . tramp-smb-not-handled)
(verify-visited-file-modtime . tramp-smb-not-handled)
@@ -617,6 +617,13 @@ WILDCARD and FULL-DIRECTORY-P are not handled."
(delete-file filename))
+(defun tramp-smb-handle-substitute-in-file-name (filename)
+ "Like `handle-substitute-in-file-name' for tramp files.
+Catches errors for shares like \"C$/\", which are common in Microsoft Windows."
+ (condition-case nil
+ (tramp-run-real-handler 'substitute-in-file-name (list filename))
+ (error filename)))
+
(defun tramp-smb-handle-write-region
(start end filename &optional append visit lockname confirm)
"Like `write-region' for tramp files."
@@ -1084,54 +1091,6 @@ Return the difference in the format of a time value."
(- (+ (if borrow 65536 0) (cadr t1)) (cadr t2)))))
-;; `PC-do-completion' touches the returning "$$" by `substitute-in-file-name'.
-;; Must be corrected.
-
-(defadvice PC-do-completion (around tramp-smb-advice-PC-do-completion)
- "Changes \"$\" back to \"$$\" in minibuffer."
- (if (funcall PC-completion-as-file-name-predicate)
-
- (progn
- ;; Substitute file names
- (let* ((beg (or (and (functionp 'minibuffer-prompt-end) ; Emacs 21
- (funcall 'minibuffer-prompt-end))
- (point-min)))
- (end (point-max))
- (str (substitute-in-file-name (buffer-substring beg end))))
- (delete-region beg end)
- (insert str)
- (ad-set-arg 2 (point)))
-
- ;; Do `PC-do-completion' without substitution
- (let* (save)
- (fset 'save (symbol-function 'substitute-in-file-name))
- (unwind-protect
- (progn
- (fset 'substitute-in-file-name (symbol-function 'identity))
- ad-do-it)
- (fset 'substitute-in-file-name (symbol-function 'save))))
-
- ;; Expand "$"
- (let* ((beg (or (and (functionp 'minibuffer-prompt-end) ; Emacs 21
- (funcall 'minibuffer-prompt-end))
- (point-min)))
- (end (point-max))
- (str (buffer-substring beg end)))
- (delete-region beg end)
- (insert (if (string-match "\\(\\$\\)\\(/\\|$\\)" str)
- (replace-match "$$" nil nil str 1)
- str))))
-
- ;; No file names. Behave unchanged.
- ad-do-it))
-
-;; Activate advice. Recent Emacsen don't need that.
-(when (functionp 'PC-do-completion)
- (condition-case nil
- (substitute-in-file-name "C$/")
- (error
- (ad-activate 'PC-do-completion))))
-
(provide 'tramp-smb)
;;; TODO: