Switch license to GPLv3 or later.
[bpt/emacs.git] / lisp / net / tramp-smb.el
index cd096df..a3cf522 100644 (file)
@@ -1,6 +1,6 @@
 ;;; tramp-smb.el --- Tramp access functions for SMB servers -*- coding: iso-8859-1; -*-
 
-;; Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
@@ -9,7 +9,7 @@
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -19,8 +19,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
 (require 'tramp)
 
 ;; Pacify byte-compiler
-(eval-when-compile
-  (require 'cl)
-  (require 'custom)
-  ;; Emacs 19.34 compatibility hack -- is this needed?
-  (or (>= emacs-major-version 20)
-      (load "cl-seq")))
+(eval-when-compile (require 'custom))
 
 ;; Avoid byte-compiler warnings if the byte-compiler supports this.
 ;; Currently, XEmacs supports this.
       (defalias 'warnings 'identity) ; Pacify Emacs byte-compiler
       (byte-compiler-options (warnings (- unused-vars))))))
 
-;; XEmacs byte-compiler raises warning abouts `last-coding-system-used'.
-(eval-when-compile
-  (unless (boundp 'last-coding-system-used)
-    (defvar last-coding-system-used nil)))
-
 ;; Define SMB method ...
 (defcustom tramp-smb-method "smb"
   "*Method to connect SAMBA and M$ SMB servers."
@@ -389,7 +379,7 @@ KEEP-DATE is not handled in case NEWNAME resides on an SMB server."
     (save-excursion
       (let ((share (tramp-smb-get-share localname))
            (file (tramp-smb-get-localname localname t))
-           (tmpfil (tramp-make-temp-file)))
+           (tmpfil (tramp-make-temp-file filename)))
        (unless (file-exists-p filename)
          (error "Cannot make local copy of non-existing file `%s'" filename))
        (tramp-message-for-buffer
@@ -598,16 +588,9 @@ Catches errors for shares like \"C$/\", which are common in Microsoft Windows."
       (let ((share (tramp-smb-get-share localname))
            (file (tramp-smb-get-localname localname t))
            (curbuf (current-buffer))
-           ;; We use this to save the value of `last-coding-system-used'
-           ;; after writing the tmp file.  At the end of the function,
-           ;; we set `last-coding-system-used' to this saved value.
-           ;; This way, any intermediary coding systems used while
-           ;; talking to the remote shell or suchlike won't hose this
-           ;; variable.  This approach was snarfed from ange-ftp.el.
-           coding-system-used
            tmpfil)
        ;; Write region into a tmp file.
-       (setq tmpfil (tramp-make-temp-file))
+       (setq tmpfil (tramp-make-temp-file filename))
        ;; We say `no-message' here because we don't want the visited file
        ;; modtime data to be clobbered from the temp file.  We call
        ;; `set-visited-file-modtime' ourselves later on.
@@ -616,9 +599,6 @@ Catches errors for shares like \"C$/\", which are common in Microsoft Windows."
         (if confirm ; don't pass this arg unless defined for backward compat.
             (list start end tmpfil append 'no-message lockname confirm)
           (list start end tmpfil append 'no-message lockname)))
-       ;; Now, `last-coding-system-used' has the right value.  Remember it.
-       (when (boundp 'last-coding-system-used)
-         (setq coding-system-used last-coding-system-used))
 
        (tramp-smb-maybe-open-connection user host share)
        (tramp-message-for-buffer
@@ -636,10 +616,7 @@ Catches errors for shares like \"C$/\", which are common in Microsoft Windows."
          (error "Buffer has changed from `%s' to `%s'"
                 curbuf (current-buffer)))
        (when (eq visit t)
-         (set-visited-file-modtime))
-       ;; Make `last-coding-system-used' have the right value.
-       (when (boundp 'last-coding-system-used)
-         (setq last-coding-system-used coding-system-used))))))
+         (set-visited-file-modtime))))))
 
 
 ;; Internal file name functions
@@ -997,10 +974,10 @@ Returns nil if an error message has appeared."
     ;; Algorithm: get waiting output.  See if last line contains
     ;; tramp-smb-prompt sentinel or tramp-smb-errors strings.
     ;; If not, wait a bit and again get waiting output.
-    (while (and (not found) (not err))
+    (while (not found)
 
       ;; Accept pending output.
-      (accept-process-output proc)
+      (tramp-accept-process-output proc)
 
       ;; Search for prompt.
       (goto-char (point-min))