From 6efb972c00a9ea8ffa84118199aa59c2d3a3b50e Mon Sep 17 00:00:00 2001
From: Michael Albinus <michael.albinus@gmx.de>
Date: Sat, 12 Mar 2011 14:26:19 +0100
Subject: [PATCH] * net/tramp.el (tramp-progress-reporter-update): Use
 `tramp-compat-funcall'. (tramp-handle-start-file-process): Use
 `tramp-compat-process-get'. (tramp-handle-insert-file-contents): Make
 `file-remote-p' call compatible.
 (tramp-open-connection-setup-interactive-shell): Use
 `tramp-compat-process-put'.

* net/tramp-compat.el (tramp-compat-process-get)
(tramp-compat-process-put): New defuns.

* net/trampver.el: Update release number.

Please do not merge with the trunk.
---
 lisp/ChangeLog           | 15 +++++++++++++++
 lisp/net/tramp-compat.el | 12 ++++++++++++
 lisp/net/tramp.el        | 11 +++++++----
 lisp/net/trampver.el     |  8 ++++----
 4 files changed, 38 insertions(+), 8 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index bf3775b3852..b232ea61ee8 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,18 @@
+2011-03-12  Michael Albinus  <michael.albinus@gmx.de>
+
+	* net/tramp.el (tramp-progress-reporter-update): Use
+	`tramp-compat-funcall'.
+	(tramp-handle-start-file-process): Use `tramp-compat-process-get'.
+	(tramp-handle-insert-file-contents): Make `file-remote-p' call
+	compatible.
+	(tramp-open-connection-setup-interactive-shell): Use
+	`tramp-compat-process-put'.
+
+	* net/tramp-compat.el (tramp-compat-process-get)
+	(tramp-compat-process-put): New defuns.
+
+	* net/trampver.el: Update release number.
+
 2011-03-12  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* ebuff-menu.el (electric-buffer-menu-mode-map): Move initialization
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index 3170e5aba06..beb380d5e6f 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -438,6 +438,18 @@ element is not omitted."
 	  (setenv "UNIX95" unix95)
 	  result)))))
 
+;; The following functions do not exist in XEmacs.  We ignore this;
+;; they are used for checking a remote tty.
+(defun tramp-compat-process-get (process propname)
+  "Return the value of PROCESS' PROPNAME property.
+This is the last value stored with `(process-put PROCESS PROPNAME VALUE)'."
+  (ignore-errors (tramp-compat-funcall 'process-get process propname)))
+
+(defun tramp-compat-process-put (process propname value)
+  "Change PROCESS' PROPNAME property to VALUE.
+It can be retrieved with `(process-get PROCESS PROPNAME)'."
+  (ignore-errors (tramp-compat-funcall 'process-put process propname value)))
+
 (provide 'tramp-compat)
 
 ;;; TODO:
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index c40d65ca913..c80420eb17c 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2313,7 +2313,7 @@ FILE must be a local file name on a connection identified via VEC."
   (let* ((parameters (cdr reporter))
 	 (message (aref parameters 3)))
     (when (string-match message (or (current-message) ""))
-      (funcall 'progress-reporter-update reporter value))))
+      (tramp-compat-funcall 'progress-reporter-update reporter value))))
 
 (defmacro with-progress-reporter (vec level message &rest body)
   "Executes BODY, spinning a progress reporter with MESSAGE.
@@ -4570,7 +4570,7 @@ beginning of local filename are not substituted."
 		      (tramp-send-command v command nil t) ; nooutput
 		    ;; Check, whether a pty is associated.
 		    (tramp-maybe-open-connection v)
-		    (unless (process-get
+		    (unless (tramp-compat-process-get
 			     (tramp-get-connection-process v) 'remote-tty)
 		      (tramp-error
 		       v 'file-error
@@ -5025,7 +5025,9 @@ coding system might not be determined.  This function repairs it."
 	    (set-visited-file-modtime)
 	    (set-buffer-modified-p nil)
 	    ;; For root, preserve owner and group when editing files.
-	    (when (string-equal (file-remote-p filename 'user) "root")
+	    (when (string-equal
+		   (tramp-file-name-handler 'file-remote-p filename 'user)
+		   "root")
 	      (set (make-local-variable 'backup-by-copying-when-mismatch) t)))
 	  (when (and (stringp local-copy)
 		     (or remote-copy (null tramp-temp-buffer-file-name)))
@@ -7111,7 +7113,8 @@ process to set up.  VEC specifies the connection."
   ;; Set `remote-tty' process property.
   (ignore-errors
     (let ((tty (tramp-send-command-and-read vec "echo \\\"`tty`\\\"")))
-      (unless (zerop (length tty)) (process-put proc 'remote-tty tty))))
+      (unless (zerop (length tty))
+	(tramp-compat-process-put proc 'remote-tty tty))))
 
   ;; Dump stty settings in the traces.
   (when (>= tramp-verbose 9)
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index 80e06121f83..0fc0cd3657b 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -1,8 +1,8 @@
 ;;; trampver.el --- Transparent Remote Access, Multiple Protocol
 ;;; lisp/trampver.el.  Generated from trampver.el.in by configure.
 
-;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009,
-;;   2010, 2011 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+;;   2011 Free Software Foundation, Inc.
 
 ;; Author: Kai Großjohann <kai.grossjohann@gmx.net>
 ;; Keywords: comm, processes
@@ -30,14 +30,14 @@
 ;; version check is defined in macro AC_EMACS_INFO of aclocal.m4;
 ;; should be changed only there.
 
-(defconst tramp-version "2.1.20"
+(defconst tramp-version "2.1.21-pre"
   "This version of Tramp.")
 
 (defconst tramp-bug-report-address "tramp-devel@gnu.org"
   "Email address to send bug reports to.")
 
 ;; Check for (X)Emacs version.
-(let ((x (if (or (>= emacs-major-version 22)	(and (featurep 'xemacs)	     (= emacs-major-version 21)	     (>= emacs-minor-version 4)))    "ok"    (format "Tramp 2.1.20 is not fit for %s"	    (when (string-match "^.*$" (emacs-version))	      (match-string 0 (emacs-version)))))))
+(let ((x (if (or (>= emacs-major-version 22)	(and (featurep 'xemacs)	     (= emacs-major-version 21)	     (>= emacs-minor-version 4)))    "ok"    (format "Tramp 2.1.21-pre is not fit for %s"	    (when (string-match "^.*$" (emacs-version))	      (match-string 0 (emacs-version)))))))
   (unless (string-match "\\`ok\\'" x) (error "%s" x)))
 
 (provide 'trampver)
-- 
2.39.5