/[tramp]/tramp/lisp/tramp-smb.el
ViewVC logotype

Diff of /tramp/lisp/tramp-smb.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2.9 by albinus, Thu Nov 21 22:04:25 2002 UTC revision 2.10 by albinus, Fri Nov 22 22:51:36 2002 UTC
# Line 24  Line 24 
24    
25  ;;; Commentary:  ;;; Commentary:
26    
27  ;; Access functions for SMB servers like SAMBA or M$ based operating systems  ;; Access functions for SMB servers like SAMBA or M$ Windows from Tramp.
 ;; from Tramp.  
28    
29  ;;; Code:  ;;; Code:
30    
# Line 138  This variable is local to each buffer.") Line 137  This variable is local to each buffer.")
137      (set-file-modes . tramp-smb-not-handled-yet)      (set-file-modes . tramp-smb-not-handled-yet)
138      (set-visited-file-modtime . tramp-smb-not-handled)      (set-visited-file-modtime . tramp-smb-not-handled)
139      (shell-command . tramp-smb-not-handled)      (shell-command . tramp-smb-not-handled)
140      (substitute-in-file-name . tramp-smb-handle-substitute-in-file-name)      ;; `substitute-in-file-name' performed by default handler
141      (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory)      (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory)
142      (vc-registered . tramp-smb-not-handled)      (vc-registered . tramp-smb-not-handled)
143      (verify-visited-file-modtime . tramp-smb-not-handled)      (verify-visited-file-modtime . tramp-smb-not-handled)
# Line 459  WILDCARD and FULL-DIRECTORY-P are not ha Line 458  WILDCARD and FULL-DIRECTORY-P are not ha
458    
459    (delete-file filename))    (delete-file filename))
460    
 (defun tramp-smb-handle-substitute-in-file-name (filename)  
   "Like `substitute-in-file-name' for tramp files.  
 Preserves \"$\" in file names, before \"/\" or at end of file name."  
   (tramp-run-real-handler  
    'substitute-in-file-name  
    (list (if (string-match "\\(\\$\\)\\(/\\|$\\)" filename)  
              (replace-match "$$" nil nil filename 1)  
            filename))))  
   
461  (defun tramp-smb-handle-write-region  (defun tramp-smb-handle-write-region
462    (start end filename &optional append visit lockname confirm)    (start end filename &optional append visit lockname confirm)
463    "Like `write-region' for tramp files."    "Like `write-region' for tramp files."
# Line 555  If CONVERT is non-nil exchange \"/\" by Line 545  If CONVERT is non-nil exchange \"/\" by
545                   (match-string 1 res)                   (match-string 1 res)
546                 "")))                 "")))
547    
548          ;; Sometimes we have discarded `substitute-in-file-name'
549        (when (string-match "\\(\\$\\$\\)\\(/\\|$\\)" res)        (when (string-match "\\(\\$\\$\\)\\(/\\|$\\)" res)
550          (setq res (replace-match "$" nil nil res 1)))          (setq res (replace-match "$" nil nil res 1)))
551    
# Line 901  Return the difference in the format of a Line 892  Return the difference in the format of a
892      (list (- (car t1) (car t2) (if borrow 1 0))      (list (- (car t1) (car t2) (if borrow 1 0))
893            (- (+ (if borrow 65536 0) (cadr t1)) (cadr t2)))))            (- (+ (if borrow 65536 0) (cadr t1)) (cadr t2)))))
894    
895    
896    ;; `PC-do-completion' touches the returning "$$" by `substitute-in-file-name'.
897    ;; Must be corrected.
898    
899    (defadvice PC-do-completion (around tramp-smb-advice-PC-do-completion activate)
900      "Changes \"$\" back to \"$$\" in minibuffer."
901      (if (funcall PC-completion-as-file-name-predicate)
902    
903          (progn
904            ;; Substitute file names
905            (let* ((beg (or (and (functionp 'minibuffer-prompt-end) ; Emacs 21
906                                 (funcall 'minibuffer-prompt-end))
907                            (point-min)))
908                   (end (point-max))
909                   (str (substitute-in-file-name (buffer-substring beg end))))
910              (delete-region beg end)
911              (insert str)
912              (ad-set-arg 2 (point)))
913    
914            ;; Do `PC-do-completion' without substitution
915            (let* (save)
916              (fset 'save (symbol-function 'substitute-in-file-name))
917              (fset 'substitute-in-file-name (symbol-function 'identity))
918              ad-do-it
919              (fset 'substitute-in-file-name (symbol-function 'save)))
920    
921            ;; Expand "$"
922            (let* ((beg (or (and (functionp 'minibuffer-prompt-end) ; Emacs 21
923                                 (funcall 'minibuffer-prompt-end))
924                            (point-min)))
925                   (end (point-max))
926                   (str (buffer-substring beg end)))
927              (delete-region beg end)
928              (insert (if (string-match "\\(\\$\\)\\(/\\|$\\)" str)
929                          (replace-match "$$" nil nil str 1)
930                        str))))
931    
932        ;; No file names. Behave unchanged.
933        ad-do-it))
934    
935  (provide 'tramp-smb)  (provide 'tramp-smb)
936    
937  ;;; TODO:  ;;; TODO:
# Line 908  Return the difference in the format of a Line 939  Return the difference in the format of a
939  ;; * Support M$ Windows on local side.  Apply "net use" but "smbclient".  ;; * Support M$ Windows on local side.  Apply "net use" but "smbclient".
940  ;; * Provide a local smb.conf. The default one might not be readable.  ;; * Provide a local smb.conf. The default one might not be readable.
941  ;; * Error handling in most of the functions. Brrrr.  ;; * Error handling in most of the functions. Brrrr.
942    ;;   Example: error in case password is wrong.
943  ;; * Read password from "~/.netrc".  ;; * Read password from "~/.netrc".
944  ;; * Use different buffers for different shares.  By this, the password  ;; * Use different buffers for different shares.  By this, the password
945  ;;   won't be requested again when changing shares on the same host.  ;;   won't be requested again when changing shares on the same host.
946  ;; * Return more comprehensive file permission string.  ;; * Return more comprehensive file permission string.
 ;; * Handle '$' respectively '$$' correctly. Currently, it is done in  
 ;;   `tramp-smb-handle-substitute-in-file-name' and `tramp-smb-get-path'.  
 ;;   But that's not the full game; "C-x f" in dired converts "$" to "$$"  
 ;;   overzealous.  
947  ;; * Handle WILDCARD and FULL-DIRECTORY-P in  ;; * Handle WILDCARD and FULL-DIRECTORY-P in
948  ;;   `tramp-smb-handle-insert-directory'.  ;;   `tramp-smb-handle-insert-directory'. Remove workaround returning "".
949  ;; * Maybe local tmp files should have the same extension like the original  ;; * Maybe local tmp files should have the same extension like the original
950  ;;   files.  Strange behaviour with jka-compr otherwise?  ;;   files.  Strange behaviour with jka-compr otherwise?
951  ;; * Copy files in dired from SMB to another method doesn't work.  ;; * Copy files in dired from SMB to another method doesn't work.

Legend:
Removed from v.2.9  
changed lines
  Added in v.2.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26