]> git.eshelyaron.com Git - emacs.git/commitdiff
* net/tramp-compat.el: New file.
authorMichael Albinus <michael.albinus@gmx.de>
Sun, 30 Sep 2007 16:43:07 +0000 (16:43 +0000)
committerMichael Albinus <michael.albinus@gmx.de>
Sun, 30 Sep 2007 16:43:07 +0000 (16:43 +0000)
* net/tramp.el:
* net/tramp-fish.el:
* net/tramp-smb.el:
* net/tramp-uu.el:
* net/trampver.el: Move compatibility code to tramp-compat.el.
Apply `mapc' instead of `mapcar' when the code needs side effects
only.  Move utf-8 coding cookie to the second line.

lisp/ChangeLog
lisp/net/tramp-compat.el [new file with mode: 0644]
lisp/net/tramp-fish.el
lisp/net/tramp-smb.el
lisp/net/tramp-uu.el
lisp/net/tramp.el
lisp/net/trampver.el

index 1a82d1bd9e441415f41d73ac86612cae2625ff66..0133a946b766cb6cfbbc192aaf849c47f83764a5 100644 (file)
@@ -1,3 +1,15 @@
+2007-09-30  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp-compat.el: New file.
+
+       * net/tramp.el:
+       * net/tramp-fish.el:
+       * net/tramp-smb.el:
+       * net/tramp-uu.el:
+       * net/trampver.el: Move compatibility code to tramp-compat.el.
+       Apply `mapc' instead of `mapcar' when the code needs side effects
+       only.  Move utf-8 coding cookie to the second line.
+
 2007-09-30  Reiner Steib  <Reiner.Steib@gmx.de>
 
        * term/x-win.el (x-gtk-stock-map): Add Gnus and MH-E icons.
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
new file mode 100644 (file)
index 0000000..9d32db3
--- /dev/null
@@ -0,0 +1,164 @@
+;;; tramp-gw.el --- Tramp compatibility functions
+
+;; Copyright (C) 2007 Free Software Foundation, Inc.
+
+;; Author: Michael Albinus <michael.albinus@gmx.de>
+;; Keywords: comm, processes
+
+;; This file is part of GNU Emacs.
+
+;; 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 3, or (at your option)
+;; any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, see
+;; <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Tramp's main Emacs version for development is GNU Emacs 23.  This
+;; package provides compatibility functions for GNU Emacs 21, GNU
+;; Emacs 22 and XEmacs 21.4+.
+
+;;; Code:
+
+;; Pacify byte-compiler
+(eval-when-compile
+  (require 'cl)
+  (require 'custom))
+
+;; Avoid byte-compiler warnings if the byte-compiler supports this.
+;; Currently, XEmacs supports this.
+;(eval-when-compile
+;  (when (featurep 'xemacs)
+;    (byte-compiler-options (warnings (- unused-vars)))))
+
+;; `last-coding-system-used' is unknown in XEmacs.
+(eval-when-compile
+  (unless (boundp 'last-coding-system-used)
+    (defvar last-coding-system-used nil)))
+
+;; `directory-sep-char' is an obsolete variable in Emacs.  But it is
+;; used in XEmacs, so we set it here and there.  The following is needed
+;; to pacify Emacs byte-compiler.
+(eval-when-compile
+  (unless (boundp 'byte-compile-not-obsolete-var)
+    (defvar byte-compile-not-obsolete-var nil))
+  (setq byte-compile-not-obsolete-var 'directory-sep-char))
+
+;; `with-temp-message' does not exists in XEmacs.
+(eval-and-compile
+  (condition-case nil
+      (with-temp-message (current-message) nil)
+    (error (defmacro with-temp-message (message &rest body) `(progn ,@body)))))
+
+;; `set-buffer-multibyte' comes from Emacs Leim.
+(eval-and-compile
+  (unless (fboundp 'set-buffer-multibyte)
+    (defalias 'set-buffer-multibyte 'ignore)))
+
+;; `font-lock-add-keywords' does not exist in XEmacs.
+(eval-and-compile
+  (unless (fboundp 'font-lock-add-keywords)
+    (defalias 'font-lock-add-keywords 'ignore)))
+
+(defsubst tramp-compat-line-end-position ()
+  "Return point at end of line (compat function).
+Calls `line-end-position' or `point-at-eol' if defined, else
+own implementation."
+  (cond
+   ((fboundp 'line-end-position) (funcall (symbol-function 'line-end-position)))
+   ((fboundp 'point-at-eol)     (funcall (symbol-function 'point-at-eol)))
+   (t (save-excursion (end-of-line) (point)))))
+
+(defsubst tramp-compat-temporary-file-directory ()
+  "Return name of directory for temporary files (compat function).
+For Emacs, this is the variable `temporary-file-directory', for XEmacs
+this is the function `temp-directory'."
+  (cond
+   ((boundp 'temporary-file-directory)
+    (symbol-value 'temporary-file-directory))
+   ((fboundp 'temp-directory)
+    (funcall (symbol-function 'temp-directory))) ;pacify byte-compiler
+   ((let ((d (getenv "TEMP"))) (and d (file-directory-p d)))
+    (file-name-as-directory (getenv "TEMP")))
+   ((let ((d (getenv "TMP"))) (and d (file-directory-p d)))
+    (file-name-as-directory (getenv "TMP")))
+   ((let ((d (getenv "TMPDIR"))) (and d (file-directory-p d)))
+    (file-name-as-directory (getenv "TMPDIR")))
+   ((file-exists-p "c:/temp") (file-name-as-directory "c:/temp"))
+   (t (message (concat "Neither `temporary-file-directory' nor "
+                      "`temp-directory' is defined -- using /tmp."))
+      (file-name-as-directory "/tmp"))))
+
+;; `most-positive-fixnum' arrived in Emacs 22.
+(defsubst tramp-compat-most-positive-fixnum ()
+  "Return largest positive integer value (compat function)."
+  (cond ((boundp 'most-positive-fixnum)
+         (symbol-value 'most-positive-fixnum))
+       (t 134217727)))
+
+;; ID-FORMAT exists since Emacs 22.
+(defun tramp-compat-file-attributes (filename &optional id-format)
+  "Like `file-attributes' for Tramp files (compat function)."
+  (cond
+   ((or (null id-format) (eq id-format 'integer))
+    (file-attributes filename))
+   ((file-remote-p filename)
+    (funcall (symbol-function 'tramp-handle-file-attributes)
+            filename id-format))
+   (t (condition-case nil
+         (funcall (symbol-function 'file-attributes) filename id-format)
+       (error (file-attributes filename))))))
+
+;; PRESERVE-UID-GID has been introduced with Emacs 23.  It does not
+;; hurt to ignore it for other (X)Emacs versions.
+(defun tramp-compat-copy-file
+  (filename newname &optional ok-if-already-exists keep-date preserve-uid-gid)
+  "Like `copy-file' for Tramp files (compat function)."
+  (if preserve-uid-gid
+      (funcall
+       (symbol-function 'copy-file)
+       filename newname ok-if-already-exists keep-date preserve-uid-gid)
+    (copy-file filename newname ok-if-already-exists keep-date)))
+
+;; `copy-tree' is introduced with Emacs 22.  We've adapted the
+;; implementation from Emacs 23.
+(defun tramp-compat-copy-tree (tree)
+  "Make a copy of TREE (compat function)."
+  (if (functionp 'copy-tree)
+      (funcall (symbol-function 'copy-tree) tree)
+    (let (result)
+      (while (consp tree)
+       (let ((newcar (car tree)))
+         (if (consp (car tree))
+             (setq newcar (tramp-compat-copy-tree (car tree))))
+         (push newcar result))
+       (setq tree (cdr tree)))
+      (nconc (nreverse result) tree))))
+
+(eval-and-compile
+  (unless (fboundp 'file-remote-p)
+    (defalias 'file-remote-p 'tramp-handle-file-remote-p))
+
+  (unless (fboundp 'process-file)
+    (defalias 'process-file 'tramp-handle-process-file))
+
+  (unless (fboundp 'start-file-process)
+    (defalias 'start-file-process 'tramp-handle-start-file-process))
+
+  (unless (fboundp 'set-file-times)
+    (defalias 'set-file-times 'tramp-handle-set-file-times)))
+
+(provide 'tramp-compat)
+
+;;; TODO:
+
+;;; tramp-compat.el ends here
index 005e69b67c9a808ac6b942f92b02410ec253e257..89788c5bcb545e1445d74d5f32152d582e23b761 100644 (file)
 
 (require 'tramp)
 (require 'tramp-cache)
-
-;; Pacify byte-compiler
-(eval-when-compile
-  (require 'cl)
-  (require 'custom))
-
-;; Avoid byte-compiler warnings if the byte-compiler supports this.
-;; Currently, XEmacs supports this.
-(eval-when-compile
-  (when (featurep 'xemacs)
-      (byte-compiler-options (warnings (- unused-vars)))))
+(require 'tramp-compat)
 
 ;; `directory-sep-char' is an obsolete variable in Emacs.  But it is
 ;; used in XEmacs, so we set it here and there.  The following is needed
 ;; to pacify Emacs byte-compiler.
 (eval-when-compile
-  (unless (boundp 'byte-compile-not-obsolete-var)
-    (defvar byte-compile-not-obsolete-var nil))
   (setq byte-compile-not-obsolete-var 'directory-sep-char))
 
+;; Pacify byte-compiler
+(eval-when-compile
+  (require 'cl)
+  (require 'custom))
+
 ;; Define FISH method ...
 (defcustom tramp-fish-method "fish"
   "*Method to connect via FISH protocol."
@@ -386,7 +379,7 @@ pass to the OPERATION."
              (tramp-fish-send-command-and-check v "#PWD")
              (with-current-buffer (tramp-get-buffer v)
                (goto-char (point-min))
-               (buffer-substring (point) (tramp-line-end-position)))))
+               (buffer-substring (point) (tramp-compat-line-end-position)))))
          (setq localname (concat uname fname))))
       ;; There might be a double slash, for example when "~/"
       ;; expands to "/". Remove this.
@@ -399,7 +392,7 @@ pass to the OPERATION."
       ;; bound, because on Windows there would be problems with UNC
       ;; shares or Cygwin mounts.
       (tramp-let-maybe directory-sep-char ?/
-       (let ((default-directory (tramp-temporary-file-directory)))
+       (let ((default-directory (tramp-compat-temporary-file-directory)))
          (tramp-make-tramp-file-name
           method user host
           (tramp-drop-volume-letter
@@ -701,11 +694,10 @@ target of the symlink differ."
   "Like `set-file-times' for Tramp files."
   (with-parsed-tramp-file-name filename nil
     (let ((time (if (or (null time) (equal time '(0 0))) (current-time) time)))
-      (zerop (apply
-             'process-file
-             (list "touch" nil nil nil "-t"
-                   (format-time-string "%Y%m%d%H%M.%S" time)
-                   (tramp-shell-quote-argument localname)))))))
+      (zerop (process-file
+             "touch" nil nil nil "-t"
+             (format-time-string "%Y%m%d%H%M.%S" time)
+             (tramp-shell-quote-argument localname))))))
 
 (defun tramp-fish-handle-write-region
   (start end filename &optional append visit lockname confirm)
@@ -740,10 +732,10 @@ target of the symlink differ."
 (defun tramp-fish-handle-executable-find (command)
   "Like `executable-find' for Tramp files."
   (with-temp-buffer
-    (if (zerop (apply 'process-file (list "which" nil t nil command)))
+    (if (zerop (process-file "which" nil t nil command))
        (progn
          (goto-char (point-min))
-         (buffer-substring (point-min) (tramp-line-end-position))))))
+         (buffer-substring (point-min) (tramp-compat-line-end-position))))))
 
 (defun tramp-fish-handle-process-file
   (program &optional infile destination display &rest args)
@@ -936,7 +928,7 @@ KEEP-DATE is non-nil, preserve the time stamp when copying."
               (tramp-shell-quote-argument v2-localname)))))
   ;; KEEP-DATE handling.
   (when (and keep-date (functionp 'set-file-times))
-    (apply 'set-file-times (list newname (nth 5 (file-attributes filename)))))
+    (set-file-times newname (nth 5 (file-attributes filename))))
   ;; Set the mode.
   (set-file-modes newname (file-modes filename)))
 
@@ -1133,7 +1125,8 @@ connection if a previous connection has died for some reason."
             (coding-system-for-read 'binary)
             (coding-system-for-write 'binary)
             ;; This must be done in order to avoid our file name handler.
-            (p (let ((default-directory (tramp-temporary-file-directory)))
+            (p (let ((default-directory
+                       (tramp-compat-temporary-file-directory)))
                  (start-process
                   (or (tramp-get-connection-property vec "process-name" nil)
                       (tramp-buffer-name vec))
index c7ea3a12163ac9dcb04ae9d2718e62e8e1678d29..c9d709ff08a23ab7ab1ba1560fd1f693b5efba5e 100644 (file)
 
 (require 'tramp)
 (require 'tramp-cache)
+(require 'tramp-compat)
 
 ;; Pacify byte-compiler
-(eval-when-compile (require 'custom))
-
-;; Avoid byte-compiler warnings if the byte-compiler supports this.
-;; Currently, XEmacs supports this.
 (eval-when-compile
-  (when (featurep 'xemacs)
-      (byte-compiler-options (warnings (- unused-vars)))))
+  (require 'cl)
+  (require 'custom))
 
 ;; Define SMB method ...
 (defcustom tramp-smb-method "smb"
@@ -763,7 +760,7 @@ If SHARE is result, entries are of type dir. Otherwise, shares are listed.
 Result is the list (LOCALNAME MODE SIZE MTIME)."
 ;; We are called from `tramp-smb-get-file-entries', which sets the
 ;; current buffer.
-  (let ((line (buffer-substring (point) (tramp-line-end-position)))
+  (let ((line (buffer-substring (point) (tramp-compat-line-end-position)))
        localname mode size month day hour min sec year mtime)
 
     (if (not share)
@@ -891,7 +888,7 @@ connection if a previous connection has died for some reason."
        (when (and p (processp p)) (delete-process p))
 
        (unless (let ((default-directory
-                       (tramp-temporary-file-directory)))
+                       (tramp-compat-temporary-file-directory)))
                  (executable-find tramp-smb-program))
          (error "Cannot find command %s in %s" tramp-smb-program exec-path))
 
@@ -930,7 +927,8 @@ connection if a previous connection has died for some reason."
 
          (let* ((coding-system-for-read nil)
                 (process-connection-type tramp-process-connection-type)
-                (p (let ((default-directory (tramp-temporary-file-directory)))
+                (p (let ((default-directory
+                           (tramp-compat-temporary-file-directory)))
                      (apply #'start-process
                             (tramp-buffer-name vec) (tramp-get-buffer vec)
                             tramp-smb-program args))))
index c399a0b211d4276ec14871c2b13fb83a558740c0..d9994e9dc83a4efc9cfabcd017e34b8bc21fecbe 100644 (file)
@@ -1,5 +1,5 @@
-;;; -*- coding: utf-8; -*-
 ;;; tramp-uu.el --- uuencode in Lisp
+;;; -*- coding: utf-8; -*-
 
 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006,
 ;;   2007 Free Software Foundation, Inc.
index 83d4b0ce95d056f813106898f1c8c4f6bceafc22..9c446137545a5ab82468febce72581aeb443060a 100644 (file)
@@ -1,5 +1,5 @@
-;;; -*- mode: Emacs-Lisp; coding: utf-8; -*-
 ;;; tramp.el --- Transparent Remote Access, Multiple Protocol
+;;; -*- mode: Emacs-Lisp; coding: utf-8; -*-
 
 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007 Free Software Foundation, Inc.
             (when (featurep 'trampver)
               (unload-feature 'trampver 'force))))
 
+(require 'tramp-compat)
+
+;; `directory-sep-char' is an obsolete variable in Emacs.  But it is
+;; used in XEmacs, so we set it here and there.  The following is needed
+;; to pacify Emacs byte-compiler.
+(eval-when-compile
+  (setq byte-compile-not-obsolete-var 'directory-sep-char))
+
 (require 'custom)
 
 (if (featurep 'xemacs)
 (require 'shell)
 (require 'advice)
 
-;; `copy-tree' is part of subr.el since Emacs 22.
-(eval-when-compile
-  (unless (functionp 'copy-tree)
-    (require 'cl)))
-
 ;; Requiring 'tramp-cache results in an endless loop.
 (autoload 'tramp-get-file-property "tramp-cache")
 (autoload 'tramp-set-file-property "tramp-cache")
                    (when (featurep 'tramp-util)
                      (unload-feature 'tramp-util 'force)))))))
 
-;; Avoid byte-compiler warnings if the byte-compiler supports this.
-;; Currently, XEmacs supports this.
-(eval-when-compile
-  (when (featurep 'xemacs)
-    (byte-compiler-options (warnings (- unused-vars)))))
-
-;; `last-coding-system-used' is unknown in XEmacs.
-(eval-when-compile
-  (unless (boundp 'last-coding-system-used)
-    (defvar last-coding-system-used nil)))
-
-;; `directory-sep-char' is an obsolete variable in Emacs.  But it is
-;; used in XEmacs, so we set it here and there.  The following is needed
-;; to pacify Emacs byte-compiler.
-(eval-when-compile
-  (unless (boundp 'byte-compile-not-obsolete-var)
-    (defvar byte-compile-not-obsolete-var nil))
-  (setq byte-compile-not-obsolete-var 'directory-sep-char))
-
-;; `with-temp-message' does not exists in XEmacs.
-(eval-and-compile
-  (condition-case nil
-      (with-temp-message (current-message) nil)
-    (error (defmacro with-temp-message (message &rest body) `(progn ,@body)))))
-
-;; `set-buffer-multibyte' comes from Emacs Leim.
-(eval-and-compile
-  (unless (fboundp 'set-buffer-multibyte)
-    (defalias 'set-buffer-multibyte 'ignore)))
-
 ;;; User Customizable Internal Variables:
 
 (defgroup tramp nil
@@ -1113,7 +1086,7 @@ The answer will be provided by `tramp-action-process-alive',
   "*Prefix to use for temporary files.
 If this is a relative file name (such as \"tramp.\"), it is considered
 relative to the directory name returned by the function
-`tramp-temporary-file-directory' (which see).  It may also be an
+`tramp-compat-temporary-file-directory' (which see).  It may also be an
 absolute file name; don't forget to include a prefix for the filename
 part, though."
   :group 'tramp
@@ -1933,15 +1906,6 @@ an input event arrives.  The other arguments are passed to `tramp-error'."
               (tramp-get-buffer vec-or-proc)))
          (sit-for 30))))))
 
-(defsubst tramp-line-end-position nil
-  "Return point at end of line.
-Calls `line-end-position' or `point-at-eol' if defined, else
-own implementation."
-  (cond
-   ((fboundp 'line-end-position) (funcall (symbol-function 'line-end-position)))
-   ((fboundp 'point-at-eol)     (funcall (symbol-function 'point-at-eol)))
-   (t (save-excursion (end-of-line) (point)))))
-
 (defmacro with-parsed-tramp-file-name (filename var &rest body)
   "Parse a Tramp filename and make components available in the body.
 
@@ -1970,9 +1934,7 @@ If VAR is nil, then we bind `v' to the structure and `method', `user',
 
 (put 'with-parsed-tramp-file-name 'lisp-indent-function 2)
 (put 'with-parsed-tramp-file-name 'edebug-form-spec '(form symbolp body))
-(when (functionp 'font-lock-add-keywords)
-  (apply 'font-lock-add-keywords
-        (list 'emacs-lisp-mode '("\\<with-parsed-tramp-file-name\\>"))))
+(font-lock-add-keywords 'emacs-lisp-mode '("\\<with-parsed-tramp-file-name\\>"))
 
 (defmacro with-file-property (vec file property &rest body)
   "Check in Tramp cache for PROPERTY, otherwise execute BODY and set cache.
@@ -1990,9 +1952,7 @@ FILE must be a local file name on a connection identified via VEC."
 
 (put 'with-file-property 'lisp-indent-function 3)
 (put 'with-file-property 'edebug-form-spec t)
-(when (functionp 'font-lock-add-keywords)
-  (apply 'font-lock-add-keywords
-        (list 'emacs-lisp-mode '("\\<with-file-property\\>"))))
+(font-lock-add-keywords 'emacs-lisp-mode '("\\<with-file-property\\>"))
 
 (defmacro with-connection-property (key property &rest body)
   "Checks in Tramp for property PROPERTY, otherwise executes BODY and set."
@@ -2007,9 +1967,7 @@ FILE must be a local file name on a connection identified via VEC."
 
 (put 'with-connection-property 'lisp-indent-function 2)
 (put 'with-connection-property 'edebug-form-spec t)
-(when (functionp 'font-lock-add-keywords)
-  (apply 'font-lock-add-keywords
-        (list 'emacs-lisp-mode '("\\<with-connection-property\\>"))))
+(font-lock-add-keywords 'emacs-lisp-mode '("\\<with-connection-property\\>"))
 
 (defmacro tramp-let-maybe (variable value &rest body)
   "Let-bind VARIABLE to VALUE in BODY, but only if VARIABLE is not obsolete.
@@ -2026,7 +1984,7 @@ The intent is to protect against `obsolete variable' warnings."
   (concat
    (funcall (if (fboundp 'make-temp-file) 'make-temp-file 'make-temp-name)
            (expand-file-name tramp-temp-name-prefix
-                             (tramp-temporary-file-directory)))
+                             (tramp-compat-temporary-file-directory)))
    (file-name-extension filename t)))
 
 (defsubst tramp-make-tramp-temp-file (vec)
@@ -2103,16 +2061,15 @@ Adds another overlay hiding filename parts according to Tramp's
 special handling of `substitute-in-file-name'."
   (when (symbol-value 'minibuffer-completing-file-name)
     (setq tramp-rfn-eshadow-overlay
-         (apply
-          'make-overlay
-          (list (apply (symbol-function 'minibuffer-prompt-end))
-                (apply (symbol-function 'minibuffer-prompt-end)))))
+         (funcall (symbol-function 'make-overlay)
+                  (funcall (symbol-function 'minibuffer-prompt-end))
+                  (funcall (symbol-function 'minibuffer-prompt-end))))
     ;; Copy rfn-eshadow-overlay properties.
-    (let ((props (apply 'overlay-properties
-                       (list (symbol-value 'rfn-eshadow-overlay)))))
+    (let ((props (funcall (symbol-function 'overlay-properties)
+                         (symbol-value 'rfn-eshadow-overlay))))
       (while props
-       (apply 'overlay-put
-              (list tramp-rfn-eshadow-overlay (pop props) (pop props)))))))
+       (funcall (symbol-function 'overlay-put)
+                tramp-rfn-eshadow-overlay (pop props) (pop props))))))
 
 (when (boundp 'rfn-eshadow-setup-minibuffer-hook)
   (add-hook 'rfn-eshadow-setup-minibuffer-hook
@@ -2124,15 +2081,15 @@ This is intended to be used as a minibuffer `post-command-hook' for
 `file-name-shadow-mode'; the minibuffer should have already
 been set up by `rfn-eshadow-setup-minibuffer'."
   ;; In remote files name, there is a shadowing just for the local part.
-  (let ((end (or (apply 'overlay-end (list (symbol-value 'rfn-eshadow-overlay)))
-                (apply (symbol-function 'minibuffer-prompt-end)))))
-    (when (apply 'file-remote-p
-                (list (buffer-substring-no-properties end (point-max))))
+  (let ((end (or (funcall (symbol-function 'overlay-end)
+                         (symbol-value 'rfn-eshadow-overlay))
+                (funcall (symbol-function 'minibuffer-prompt-end)))))
+    (when (file-remote-p (buffer-substring-no-properties end (point-max)))
       (narrow-to-region
        (1+ (or (string-match "/" (buffer-string) end) end)) (point-max))
       (let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay)
            (rfn-eshadow-update-overlay-hook nil))
-       (apply (symbol-function 'rfn-eshadow-update-overlay)))
+       (funcall (symbol-function 'rfn-eshadow-update-overlay)))
       (widen))))
 
 (when (boundp 'rfn-eshadow-update-overlay-hook)
@@ -2416,7 +2373,7 @@ target of the symlink differ."
       (when symlinkp
        (search-forward "-> ")
        (setq res-symlink-target
-             (buffer-substring (point) (tramp-line-end-position))))
+             (buffer-substring (point) (tramp-compat-line-end-position))))
       ;; return data gathered
       (list
        ;; 0. t for directory, string (name linked to) for symbolic
@@ -2574,7 +2531,7 @@ of."
 (defun tramp-handle-set-file-times (filename &optional time)
   "Like `set-file-times' for Tramp files."
   (zerop
-   (if (apply 'file-remote-p (list filename))
+   (if (file-remote-p filename)
        (with-parsed-tramp-file-name filename nil
         (tramp-flush-file-property v localname)
         (let ((time (if (or (null time) (equal time '(0 0)))
@@ -2615,7 +2572,7 @@ and gid of the corresponding user is taken.  Both parameters must be integers."
   ;;      another implementation, see `dired-do-chown'.  OTOH, it is
   ;;      mostly working with su(do)? when it is needed, so it shall
   ;;      succeed in the majority of cases.
-  (if (apply 'file-remote-p (list filename))
+  (if (file-remote-p filename)
       (with-parsed-tramp-file-name filename nil
        (let ((uid (or (and (integerp uid) uid)
                       (tramp-get-remote-uid v 'integer)))
@@ -2630,7 +2587,7 @@ and gid of the corresponding user is taken.  Both parameters must be integers."
     ;; `set-file-uid-gid'.
     (let ((uid (or (and (integerp uid) uid) (tramp-get-local-uid 'integer)))
          (gid (or (and (integerp gid) gid) (tramp-get-local-uid 'integer)))
-         (default-directory (tramp-temporary-file-directory)))
+         (default-directory (tramp-compat-temporary-file-directory)))
       (call-process
        "chown" nil nil nil
        (format "%d:%d" uid gid) (tramp-shell-quote-argument filename)))))
@@ -2793,7 +2750,7 @@ and gid of the corresponding user is taken.  Both parameters must be integers."
   (when (file-directory-p directory)
     (setq directory (expand-file-name directory))
     (let* ((temp
-           (copy-tree
+           (tramp-compat-copy-tree
             (with-parsed-tramp-file-name directory nil
               (with-file-property
                   v localname
@@ -2887,7 +2844,8 @@ and gid of the corresponding user is taken.  Both parameters must be integers."
           (with-current-buffer (tramp-get-buffer v)
             (goto-char (point-max))
             (while (zerop (forward-line -1))
-              (push (buffer-substring (point)  (tramp-line-end-position))
+              (push (buffer-substring
+                     (point) (tramp-compat-line-end-position))
                     result)))
 
           result)))))))
@@ -2943,17 +2901,23 @@ and gid of the corresponding user is taken.  Both parameters must be integers."
   (filename newname &optional ok-if-already-exists keep-date preserve-uid-gid)
   "Like `copy-file' for Tramp files."
   ;; Check if both files are local -- invoke normal copy-file.
-  ;; Otherwise, use tramp from local system.
+  ;; Otherwise, use Tramp from local system.
   (setq filename (expand-file-name filename))
   (setq newname (expand-file-name newname))
-  ;; At least one file a tramp file?
-  (if (or (tramp-tramp-file-p filename)
-          (tramp-tramp-file-p newname))
-      (tramp-do-copy-or-rename-file
-       'copy filename newname ok-if-already-exists keep-date preserve-uid-gid)
+  (cond
+   ;; At least one file a tramp file?
+   ((or (tramp-tramp-file-p filename)
+       (tramp-tramp-file-p newname))
+    (tramp-do-copy-or-rename-file
+     'copy filename newname ok-if-already-exists keep-date preserve-uid-gid))
+   ;; Compat section.
+   (preserve-uid-gid
     (tramp-run-real-handler
      'copy-file
-     (list filename newname ok-if-already-exists keep-date preserve-uid-gid))))
+     (list filename newname ok-if-already-exists keep-date preserve-uid-gid)))
+   (t
+    (tramp-run-real-handler
+     'copy-file (list filename newname ok-if-already-exists keep-date)))))
 
 (defun tramp-handle-rename-file
   (filename newname &optional ok-if-already-exists)
@@ -3082,7 +3046,7 @@ KEEP-DATE is non-nil if NEWNAME should have the same timestamp as FILENAME."
                (jka-compr-inhibit t))
            (write-region (point-min) (point-max) newname))))
     ;; KEEP-DATE handling.
-    (when keep-date (apply 'set-file-times (list newname modtime)))
+    (when keep-date (set-file-times newname modtime))
     ;; Set the mode.
     (set-file-modes newname (file-modes filename))
     ;; If the operation was `rename', delete the original file.
@@ -3113,7 +3077,7 @@ the uid and gid from FILENAME."
              (if t1 (tramp-handle-file-remote-p filename 'localname) filename))
             (localname2
              (if t2 (tramp-handle-file-remote-p newname 'localname) newname))
-            (prefix (apply 'file-remote-p (list (if t1 filename newname))))
+            (prefix (file-remote-p (if t1 filename newname)))
             (tmpfile (tramp-make-temp-file localname1)))
 
        (cond
@@ -3145,10 +3109,9 @@ the uid and gid from FILENAME."
           ((and (file-readable-p localname1)
                 (file-writable-p (file-name-directory localname2)))
            (if (eq op 'copy)
-               (apply
-                'copy-file
-                (list localname1 localname2 ok-if-already-exists
-                      keep-date preserve-uid-gid))
+               (tramp-compat-copy-file
+                localname1 localname2 ok-if-already-exists
+                keep-date preserve-uid-gid)
              (rename-file localname1 localname2 ok-if-already-exists)))
 
           ;; We can do it directly with `tramp-send-command'
@@ -3181,10 +3144,9 @@ the uid and gid from FILENAME."
               (tramp-get-local-gid 'integer)))
             (t2
              (if (eq op 'copy)
-                 (apply
-                  'copy-file
-                  (list localname1 tmpfile ok-if-already-exists
-                        keep-date preserve-uid-gid))
+                 (tramp-compat-copy-file
+                  localname1 tmpfile ok-if-already-exists
+                  keep-date preserve-uid-gid)
                (rename-file localname1 tmpfile ok-if-already-exists))
              ;; We must change the ownership as local user.
              (tramp-set-file-uid-gid
@@ -3202,10 +3164,9 @@ the uid and gid from FILENAME."
                  (tramp-shell-quote-argument localname2))))
             (t1
              (if (eq op 'copy)
-                 (apply
-                  'copy-file
-                  (list tmpfile localname2 ok-if-already-exists
-                        keep-date preserve-uid-gid))
+                 (tramp-compat-copy-file
+                  tmpfile localname2 ok-if-already-exists
+                  keep-date preserve-uid-gid)
                (rename-file tmpfile localname2 ok-if-already-exists))))
 
            ;; Remove temporary file.
@@ -3215,8 +3176,7 @@ the uid and gid from FILENAME."
       ;; Won't be applied for 'rename.
       (condition-case nil
          (when (and keep-date (not preserve-uid-gid))
-           (apply 'set-file-times
-                  (list newname (nth 5 (file-attributes filename))))
+           (set-file-times newname (nth 5 (file-attributes filename)))
            (set-file-modes newname (file-modes filename)))
        (error)))))
 
@@ -3269,7 +3229,7 @@ be a local filename.  The method used must be an out-of-band method."
       ;; Check for program.
       (when (and (fboundp 'executable-find)
                 (not (let ((default-directory
-                             (tramp-temporary-file-directory)))
+                             (tramp-compat-temporary-file-directory)))
                        (executable-find copy-program))))
        (tramp-error
         v 'file-error "Cannot find copy program: %s" copy-program))
@@ -3293,7 +3253,7 @@ be a local filename.  The method used must be an out-of-band method."
              ;; set a timeout, because the copying of large files can
              ;; last longer than 60 secs.
              (let ((p (let ((default-directory
-                              (tramp-temporary-file-directory)))
+                              (tramp-compat-temporary-file-directory)))
                         (apply 'start-process
                                (tramp-get-connection-property
                                 v "process-name" nil)
@@ -3315,8 +3275,7 @@ be a local filename.  The method used must be an out-of-band method."
 
       ;; Handle KEEP-DATE argument.
       (when (and keep-date (not copy-keep-date))
-       (apply 'set-file-times
-              (list newname (nth 5 (file-attributes filename)))))
+       (set-file-times newname (nth 5 (file-attributes filename))))
 
       ;; Set the mode.
       (unless (and keep-date copy-keep-date)
@@ -3576,7 +3535,7 @@ the result will be a local, non-Tramp, filename."
              (tramp-send-command v (format "cd %s; pwd" uname))
              (with-current-buffer (tramp-get-buffer v)
                (goto-char (point-min))
-               (buffer-substring (point) (tramp-line-end-position)))))
+               (buffer-substring (point) (tramp-compat-line-end-position)))))
          (setq localname (concat uname fname))))
       ;; There might be a double slash, for example when "~/"
       ;; expands to "/". Remove this.
@@ -3589,7 +3548,7 @@ the result will be a local, non-Tramp, filename."
       ;; bound, because on Windows there would be problems with UNC
       ;; shares or Cygwin mounts.
       (tramp-let-maybe directory-sep-char ?/
-       (let ((default-directory (tramp-temporary-file-directory)))
+       (let ((default-directory (tramp-compat-temporary-file-directory)))
          (tramp-make-tramp-file-name
           method user host
           (tramp-drop-volume-letter
@@ -3627,7 +3586,7 @@ beginning of local filename are not substituted."
 ;; In XEmacs, electricity is implemented via a key map for ?/ and ?~,
 ;; which calls corresponding functions (see minibuf.el).
 (when (fboundp 'minibuffer-electric-separator)
-  (mapcar
+  (mapc
    '(lambda (x)
       (eval
        `(defadvice ,x
@@ -3828,7 +3787,7 @@ beginning of local filename are not substituted."
        (if (integerp asynchronous)
            (apply 'tramp-handle-start-file-process
                   "*Async Shell*" buffer args)
-         (apply 'tramp-handle-process-file
+         (apply 'process-file
                 (car args) nil buffer nil (cdr args)))
       ;; Insert error messages if they were separated.
       (when (listp buffer)
@@ -3838,7 +3797,7 @@ beginning of local filename are not substituted."
       ;; There's some output, display it.
       (when (with-current-buffer output-buffer (> (point-max) (point-min)))
        (if (functionp 'display-message-or-buffer)
-           (apply 'display-message-or-buffer (list output-buffer))
+           (funcall (symbol-function 'display-message-or-buffer) output-buffer)
          (pop-to-buffer output-buffer))))))
 
 ;; File Editing.
@@ -4035,13 +3994,13 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file."
     ;; UNIQUIFY element of `auto-save-file-name-transforms'); but for
     ;; all other cases we must do it ourselves.
     (when (boundp 'auto-save-file-name-transforms)
-      (mapcar
+      (mapc
        '(lambda (x)
          (when (and (string-match (car x) buffer-file-name)
                     (not (car (cddr x))))
            (setq tramp-auto-save-directory
                  (or tramp-auto-save-directory
-                     (tramp-temporary-file-directory)))))
+                     (tramp-compat-temporary-file-directory)))))
        (symbol-value 'auto-save-file-name-transforms)))
     ;; Create directory.
     (when tramp-auto-save-directory
@@ -4165,7 +4124,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file."
                      ;; files, it seems.)  The file in question is a
                      ;; tmp file anyway.
                      (let ((default-directory
-                             (tramp-temporary-file-directory)))
+                             (tramp-compat-temporary-file-directory)))
                        (funcall loc-enc (point-min) (point-max))))
 
                  (tramp-message
@@ -4202,7 +4161,8 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file."
                  (erase-buffer)
                  (and
                   ;; cksum runs locally
-                  (let ((default-directory (tramp-temporary-file-directory)))
+                  (let ((default-directory
+                          (tramp-compat-temporary-file-directory)))
                     (zerop (call-process "cksum" tmpfil t)))
                   ;; cksum runs remotely
                   (zerop
@@ -4499,9 +4459,12 @@ Falls back to normal file name handler if no tramp file name handler exists."
   ;; `partial-completion-mode' is unknown in XEmacs.  So we should
   ;; load it unconditionally there.  In the GNU Emacs case, method/
   ;; user/host name completion shall be bound to `partial-completion-mode'.
+  ;; `ido-mode' and `icy-mode' are other packages which extend file
+  ;; name completion.
   (when (or (not (boundp 'partial-completion-mode))
            (symbol-value 'partial-completion-mode)
-           (featurep 'ido))
+           (featurep 'ido)
+           (featurep 'icicles))
     (add-to-list 'file-name-handler-alist
                 (cons tramp-completion-file-name-regexp
                       'tramp-completion-file-name-handler))
@@ -4557,8 +4520,8 @@ Falls back to normal file name handler if no tramp file name handler exists."
              ;;-   method user host
              ;;-   (format "echo %s" (comint-quote-filename localname))))
              (tramp-send-command v (format "echo %s" localname))
-             (setq bufstr (buffer-substring (point-min)
-                                            (tramp-line-end-position)))
+             (setq bufstr (buffer-substring
+                           (point-min) (tramp-compat-line-end-position)))
              (with-current-buffer (tramp-get-buffer v)
                (goto-char (point-min))
                (if (string-equal localname bufstr)
@@ -4651,19 +4614,20 @@ Falls back to normal file name handler if no tramp file name handler exists."
 
              ;; Method dependent user / host combinations.
              (progn
-               (mapcar
+               (mapc
                 (lambda (x)
                   (setq all-user-hosts
                         (append all-user-hosts
                                 (funcall (nth 0 x) (nth 1 x)))))
                 (tramp-get-completion-function m))
 
-               (setq result (append result
-                 (mapcar
-                  (lambda (x)
-                    (tramp-get-completion-user-host
-                     method user host (nth 0 x) (nth 1 x)))
-                  (delq nil all-user-hosts)))))
+               (setq result
+                     (append result
+                             (mapcar
+                              (lambda (x)
+                                (tramp-get-completion-user-host
+                                 method user host (nth 0 x) (nth 1 x)))
+                              (delq nil all-user-hosts)))))
 
            ;; Possible methods.
            (setq result
@@ -4790,7 +4754,7 @@ They are collected by `tramp-completion-dissect-file-name1'."
             (concat tramp-prefix-regexp "/$"))
           1 nil 3 nil)))
 
-    (mapcar (lambda (regexp)
+    (mapc (lambda (regexp)
       (add-to-list 'result
        (tramp-completion-dissect-file-name1 regexp name)))
       (list
@@ -4872,7 +4836,7 @@ PARTIAL-USER must match USER, PARTIAL-HOST must match HOST."
 Either user or host may be nil."
   ;; On Windows, there are problems in completion when
   ;; `default-directory' is remote.
-  (let ((default-directory (tramp-temporary-file-directory))
+  (let ((default-directory (tramp-compat-temporary-file-directory))
        res)
     (when (file-readable-p filename)
       (with-temp-buffer
@@ -4890,7 +4854,7 @@ Either user or host may be nil."
          (concat
           "^\\(" tramp-host-regexp "\\)"
           "\\([ \t]+" "\\(" tramp-user-regexp "\\)" "\\)?")))
-     (narrow-to-region (point) (tramp-line-end-position))
+     (narrow-to-region (point) (tramp-compat-line-end-position))
      (when (re-search-forward regexp nil t)
        (setq result (append (list (match-string 3) (match-string 1)))))
      (widen)
@@ -4902,7 +4866,7 @@ Either user or host may be nil."
 User is always nil."
   ;; On Windows, there are problems in completion when
   ;; `default-directory' is remote.
-  (let ((default-directory (tramp-temporary-file-directory))
+  (let ((default-directory (tramp-compat-temporary-file-directory))
        res)
     (when (file-readable-p filename)
       (with-temp-buffer
@@ -4917,7 +4881,7 @@ User is always nil."
 User is always nil."
    (let ((result)
         (regexp (concat "^\\(" tramp-host-regexp "\\)")))
-     (narrow-to-region (point) (tramp-line-end-position))
+     (narrow-to-region (point) (tramp-compat-line-end-position))
      (when (re-search-forward regexp nil t)
        (setq result (list nil (match-string 1))))
      (widen)
@@ -4931,7 +4895,7 @@ User is always nil."
 User is always nil."
   ;; On Windows, there are problems in completion when
   ;; `default-directory' is remote.
-  (let ((default-directory (tramp-temporary-file-directory))
+  (let ((default-directory (tramp-compat-temporary-file-directory))
        res)
     (when (file-readable-p filename)
       (with-temp-buffer
@@ -4946,7 +4910,7 @@ User is always nil."
 User is always nil."
    (let ((result)
         (regexp (concat "^[ \t]*Host[ \t]+" "\\(" tramp-host-regexp "\\)")))
-     (narrow-to-region (point) (tramp-line-end-position))
+     (narrow-to-region (point) (tramp-compat-line-end-position))
      (when (re-search-forward regexp nil t)
        (setq result (list nil (match-string 1))))
      (widen)
@@ -4960,7 +4924,7 @@ User is always nil."
 User is always nil."
   ;; On Windows, there are problems in completion when
   ;; `default-directory' is remote.
-  (let* ((default-directory (tramp-temporary-file-directory))
+  (let* ((default-directory (tramp-compat-temporary-file-directory))
         (regexp (concat "^key_[0-9]+_\\(" tramp-host-regexp "\\)\\.pub$"))
         (files (when (file-directory-p dirname) (directory-files dirname)))
         result)
@@ -4975,7 +4939,7 @@ User is always nil."
 User is always nil."
   ;; On Windows, there are problems in completion when
   ;; `default-directory' is remote.
-  (let* ((default-directory (tramp-temporary-file-directory))
+  (let* ((default-directory (tramp-compat-temporary-file-directory))
         (regexp (concat "^\\(" tramp-host-regexp
                         "\\)\\.ssh-\\(dss\\|rsa\\)\\.pub$"))
         (files (when (file-directory-p dirname) (directory-files dirname)))
@@ -4991,7 +4955,7 @@ User is always nil."
 User is always nil."
   ;; On Windows, there are problems in completion when
   ;; `default-directory' is remote.
-  (let ((default-directory (tramp-temporary-file-directory))
+  (let ((default-directory (tramp-compat-temporary-file-directory))
        res)
     (when (file-readable-p filename)
       (with-temp-buffer
@@ -5006,7 +4970,7 @@ User is always nil."
 User is always nil."
    (let ((result)
         (regexp (concat "^\\(" tramp-host-regexp "\\)")))
-     (narrow-to-region (point) (tramp-line-end-position))
+     (narrow-to-region (point) (tramp-compat-line-end-position))
      (when (re-search-forward regexp nil t)
        (unless (char-equal (or (char-after) ?\n) ?:) ; no IPv6
         (setq result (list nil (match-string 1)))))
@@ -5025,7 +4989,7 @@ User is always nil."
 Host is always \"localhost\"."
   ;; On Windows, there are problems in completion when
   ;; `default-directory' is remote.
-  (let ((default-directory (tramp-temporary-file-directory))
+  (let ((default-directory (tramp-compat-temporary-file-directory))
        res)
     (if (zerop (length tramp-current-user))
        '(("root" nil))
@@ -5042,7 +5006,7 @@ Host is always \"localhost\"."
 Host is always \"localhost\"."
    (let ((result)
         (regexp (concat "^\\(" tramp-user-regexp "\\):")))
-     (narrow-to-region (point) (tramp-line-end-position))
+     (narrow-to-region (point) (tramp-compat-line-end-position))
      (when (re-search-forward regexp nil t)
        (setq result (list (match-string 1) "localhost")))
      (widen)
@@ -5054,7 +5018,7 @@ Host is always \"localhost\"."
 User may be nil."
   ;; On Windows, there are problems in completion when
   ;; `default-directory' is remote.
-  (let ((default-directory (tramp-temporary-file-directory))
+  (let ((default-directory (tramp-compat-temporary-file-directory))
        res)
     (when (file-readable-p filename)
       (with-temp-buffer
@@ -5072,7 +5036,7 @@ User may be nil."
          (concat
           "^[ \t]*machine[ \t]+" "\\(" tramp-host-regexp "\\)"
           "\\([ \t]+login[ \t]+" "\\(" tramp-user-regexp "\\)" "\\)?")))
-     (narrow-to-region (point) (tramp-line-end-position))
+     (narrow-to-region (point) (tramp-compat-line-end-position))
      (when (re-search-forward regexp nil t)
        (setq result (list (match-string 3) (match-string 1))))
      (widen)
@@ -5084,7 +5048,7 @@ User may be nil."
 User is always nil."
   ;; On Windows, there are problems in completion when
   ;; `default-directory' is remote.
-  (let ((default-directory (tramp-temporary-file-directory))
+  (let ((default-directory (tramp-compat-temporary-file-directory))
        res)
     (with-temp-buffer
       (when (zerop (call-process "reg" nil t nil "query" registry))
@@ -5098,7 +5062,7 @@ User is always nil."
 User is always nil."
    (let ((result)
         (regexp (concat (regexp-quote registry) "\\\\\\(.+\\)")))
-     (narrow-to-region (point) (tramp-line-end-position))
+     (narrow-to-region (point) (tramp-compat-line-end-position))
      (when (re-search-forward regexp nil t)
        (setq result (list nil (match-string 1))))
      (widen)
@@ -5225,7 +5189,7 @@ from the default one."
       ;; `outline-mode-hook'.  We must prevent that local processes
       ;; die.  Yes: I've seen `flyspell-mode', which starts "ispell"
       ;; ...
-      (let ((default-directory (tramp-temporary-file-directory)))
+      (let ((default-directory (tramp-compat-temporary-file-directory)))
        (outline-mode))
       (set (make-local-variable 'outline-regexp)
           "[0-9]+:[0-9]+:[0-9]+ [a-z0-9-]+ (\\([0-9]+\\)) #")
@@ -5286,7 +5250,8 @@ This function expects to be in the right *tramp* buffer."
        (when (search-backward "tramp_executable " nil t)
          (skip-chars-forward "^ ")
          (skip-chars-forward " ")
-         (setq result (buffer-substring (point) (tramp-line-end-position)))))
+         (setq result (buffer-substring
+                       (point) (tramp-compat-line-end-position)))))
     result)))
 
 (defun tramp-set-remote-path (vec)
@@ -5947,7 +5912,7 @@ INPUT can also be nil which means `/dev/null'.
 OUTPUT can be a string (which specifies a filename), or t (which
 means standard output and thus the current buffer), or nil (which
 means discard it)."
-  (let ((default-directory (tramp-temporary-file-directory)))
+  (let ((default-directory (tramp-compat-temporary-file-directory)))
     (call-process
      tramp-encoding-shell              ;program
      (when (and input (not (string-match "%s" cmd)))
@@ -6024,7 +5989,7 @@ Gateway hops are already opened."
         'target-alist
         (vector
          (tramp-file-name-method hop) (tramp-file-name-user hop)
-         (funcall (intern "tramp-gw-open-connection") vec gw hop) nil))
+         (funcall (symbol-function 'tramp-gw-open-connection) vec gw hop) nil))
        ;; For the password prompt, we need the correct values.
        ;; Therefore, we must remember the gateway vector.  But we
        ;; cannot do it as connection property, because it shouldn't
@@ -6111,7 +6076,8 @@ connection if a previous connection has died for some reason."
             (process-adaptive-read-buffering nil)
             (coding-system-for-read nil)
             ;; This must be done in order to avoid our file name handler.
-            (p (let ((default-directory (tramp-temporary-file-directory)))
+            (p (let ((default-directory
+                       (tramp-compat-temporary-file-directory)))
                  (start-process
                   (or (tramp-get-connection-property vec "process-name" nil)
                       (tramp-buffer-name vec))
@@ -6296,7 +6262,7 @@ In case there is no valid Lisp expression, it raises an error"
     (condition-case nil
        (prog1 (read (current-buffer))
          ;; Error handling.
-         (when (re-search-forward "\\S-" (tramp-line-end-position) t)
+         (when (re-search-forward "\\S-" (tramp-compat-line-end-position) t)
            (error nil)))
       (error (tramp-error
              vec 'file-error
@@ -6438,7 +6404,8 @@ Return ATTR."
   ;; Convert file size.
   (when (< (nth 7 attr) 0)
     (setcar (nthcdr 7 attr) -1))
-  (when (and (floatp (nth 7 attr)) (<= (nth 7 attr) most-positive-fixnum))
+  (when (and (floatp (nth 7 attr))
+            (<= (nth 7 attr) (tramp-compat-most-positive-fixnum)))
     (setcar (nthcdr 7 attr) (round (nth 7 attr))))
   ;; Convert file mode bits to string.
   (unless (stringp (nth 8 attr))
@@ -6675,10 +6642,10 @@ Example:
 would yield `t'.  On the other hand, the following check results in nil:
 
   (tramp-equal-remote \"/sudo::/etc\" \"/su::/etc\")"
-  (and (stringp (apply 'file-remote-p (list file1)))
-       (stringp (apply 'file-remote-p (list file2)))
-       (string-equal (apply 'file-remote-p (list file1))
-                    (apply 'file-remote-p (list file2)))))
+  (and (stringp (file-remote-p file1))
+       (stringp (file-remote-p file2))
+       (string-equal (file-remote-p file1)
+                    (file-remote-p file2))))
 
 (defun tramp-make-tramp-file-name (method user host localname)
   "Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME."
@@ -6729,7 +6696,7 @@ necessary only.  This function will be used in file name completion."
 
 (defun tramp-get-remote-path (vec)
   (with-connection-property vec "remote-path"
-    (let* ((remote-path (copy-tree tramp-remote-path))
+    (let* ((remote-path (tramp-compat-copy-tree tramp-remote-path))
           (elt (memq 'tramp-default-remote-path remote-path))
           (default-remote-path
             (when elt
@@ -6906,7 +6873,7 @@ necessary only.  This function will be used in file name completion."
   (if (equal id-format 'integer) (user-uid) (user-login-name)))
 
 (defun tramp-get-local-gid (id-format)
-  (nth 3 (tramp-handle-file-attributes "~/" id-format)))
+  (nth 3 (tramp-compat-file-attributes "~/" id-format)))
 
 ;; Some predefined connection properties.
 (defun tramp-get-remote-coding (vec prop)
@@ -7014,25 +6981,6 @@ ALIST is of the form ((FROM . TO) ...)."
 ;; -- Compatibility functions section --
 ;; ------------------------------------------------------------
 
-(defun tramp-temporary-file-directory ()
-  "Return name of directory for temporary files (compat function).
-For Emacs, this is the variable `temporary-file-directory', for XEmacs
-this is the function `temp-directory'."
-  (cond ((boundp 'temporary-file-directory)
-         (symbol-value 'temporary-file-directory))
-        ((fboundp 'temp-directory)
-         (funcall (symbol-function 'temp-directory))) ;pacify byte-compiler
-        ((let ((d (getenv "TEMP"))) (and d (file-directory-p d)))
-         (file-name-as-directory (getenv "TEMP")))
-        ((let ((d (getenv "TMP"))) (and d (file-directory-p d)))
-         (file-name-as-directory (getenv "TMP")))
-        ((let ((d (getenv "TMPDIR"))) (and d (file-directory-p d)))
-         (file-name-as-directory (getenv "TMPDIR")))
-        ((file-exists-p "c:/temp") (file-name-as-directory "c:/temp"))
-        (t (message (concat "Neither `temporary-file-directory' nor "
-                            "`temp-directory' is defined -- using /tmp."))
-           (file-name-as-directory "/tmp"))))
-
 (defun tramp-read-passwd (proc &optional prompt)
   "Read a password from user (compat function).
 Invokes `password-read' if available, `read-passwd' else."
@@ -7045,8 +6993,9 @@ Invokes `password-read' if available, `read-passwd' else."
                (tramp-check-for-regexp proc tramp-password-prompt-regexp)
                (format "%s for %s " (capitalize (match-string 1)) key)))))
     (if (functionp 'password-read)
-       (let ((password (apply #'password-read  (list pw-prompt key))))
-         (apply #'password-cache-add (list key password))
+       (let ((password (funcall (symbol-function 'password-read)
+                                pw-prompt key)))
+         (funcall (symbol-function 'password-cache-add) key password)
          password)
       (read-passwd pw-prompt))))
 
@@ -7055,12 +7004,12 @@ Invokes `password-read' if available, `read-passwd' else."
 If METHOD, USER or HOST is given, take then for computing the key."
   (interactive)
   (when (functionp 'password-cache-remove)
-    (apply #'password-cache-remove
-          (list (tramp-make-tramp-file-name
-                 tramp-current-method
-                 tramp-current-user
-                 tramp-current-host
-                 "")))))
+    (funcall (symbol-function 'password-cache-remove)
+            (tramp-make-tramp-file-name
+             tramp-current-method
+             tramp-current-user
+             tramp-current-host
+             ""))))
 
 ;; Snarfed code from time-date.el and parse-time.el
 
@@ -7117,19 +7066,18 @@ T1 and T2 are time values (as returned by `current-time' for example)."
   "Return a coding system like CODING-SYSTEM but with given EOL-TYPE.
 EOL-TYPE can be one of `dos', `unix', or `mac'."
   (cond ((fboundp 'coding-system-change-eol-conversion)
-         (apply #'coding-system-change-eol-conversion
-                (list coding-system eol-type)))
+         (funcall (symbol-function 'coding-system-change-eol-conversion)
+                 coding-system eol-type))
         ((fboundp 'subsidiary-coding-system)
-         (apply
-          #'subsidiary-coding-system
-          (list coding-system
-                (cond ((eq eol-type 'dos) 'crlf)
-                      ((eq eol-type 'unix) 'lf)
-                      ((eq eol-type 'mac) 'cr)
-                      (t
-                       (error "Unknown EOL-TYPE `%s', must be %s"
-                              eol-type
-                              "`dos', `unix', or `mac'"))))))
+         (funcall (symbol-function 'subsidiary-coding-system)
+                 coding-system
+                 (cond ((eq eol-type 'dos) 'crlf)
+                       ((eq eol-type 'unix) 'lf)
+                       ((eq eol-type 'mac) 'cr)
+                       (t
+                        (error "Unknown EOL-TYPE `%s', must be %s"
+                               eol-type
+                               "`dos', `unix', or `mac'")))))
         (t (error "Can't change EOL conversion -- is MULE missing?"))))
 
 (defun tramp-split-string (string pattern)
@@ -7433,7 +7381,8 @@ Used for non-7bit chars in strings."
        (setq buffer-read-only nil)
        (goto-char (point-min))
        (while (not (eobp))
-         (if (re-search-forward tramp-buf-regexp (tramp-line-end-position) t)
+         (if (re-search-forward
+              tramp-buf-regexp (tramp-compat-line-end-position) t)
              (forward-line 1)
            (forward-line 0)
            (let ((start (point)))
index 6e48c3c7f4735fc49d18fd9ea34ed23f85d30ef5..c8da0add0166c93dafc0b598e336800ff048d348 100644 (file)
@@ -1,5 +1,5 @@
-;;; -*- mode: Emacs-Lisp; coding: utf-8; -*-
 ;;; trampver.el --- Transparent Remote Access, Multiple Protocol
+;;; -*- mode: Emacs-Lisp; coding: utf-8; -*-
 ;;; lisp/trampver.el.  Generated from trampver.el.in by configure.
 
 ;; Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.