summaryrefslogtreecommitdiff
path: root/lisp/net/tramp-smb.el
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2005-01-22 21:39:38 +0000
committerMiles Bader <miles@gnu.org>2005-01-22 21:39:38 +0000
commit18643d1d412928c57690271c8b7a65e50503441f (patch)
treea9303ce501314fc316c20ca29928b2fa168d0421 /lisp/net/tramp-smb.el
parentcfa4901a57cc9920eec0401d8b33abac7d3f8e5b (diff)
parentddff82cf89b20912729a1483da3f28608b44115a (diff)
downloademacs-18643d1d412928c57690271c8b7a65e50503441f.tar.gz
emacs-18643d1d412928c57690271c8b7a65e50503441f.tar.bz2
emacs-18643d1d412928c57690271c8b7a65e50503441f.zip
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-4
Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-41 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-46 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-47 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-4 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-5 Update from CVS: exi/gnus-faq.texi ([4.1]): Typo. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-6 Update from CVS
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: