Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/tramp/ChangeLog,v
retrieving revision 1.42
diff -u -u -r1.42 ChangeLog
--- ChangeLog	2004/12/24 13:00:48	1.42
+++ ChangeLog	2005/01/16 13:42:13
@@ -1,3 +1,7 @@
+2005-01-16  Michael Albinus  <michael.albinus@gmx.de>
+
+	* Makefile (AUTHOR_VERSION): Bump to 2.0.47.
+
 2004-12-24  Norbert Koch  <viteno@xemacs.org>
 
 	* Makefile (VERSION): XEmacs package 1.21 released.
Index: ChangeLog.upstream
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/tramp/ChangeLog.upstream,v
retrieving revision 1.6
diff -u -u -r1.6 ChangeLog.upstream
--- ChangeLog.upstream	2004/12/24 00:03:33	1.6
+++ ChangeLog.upstream	2005/01/16 13:42:13
@@ -1,3 +1,20 @@
+2005-01-16  Michael Albinus  <michael.albinus@gmx.de>
+
+	Version 2.0.47 released.
+
+	* configure.ac: Bump version.
+
+2004-12-30  Michael Albinus  <michael.albinus@gmx.de>
+
+	* aclocal.m4, configure.ac: grep(1) on OpenBSD 3.6 does not
+	understand the '-' option.  Small change.  From Ryan Yeske
+	<rcyeske@gmail.com>.
+
+2004-12-22  Michael Albinus  <michael.albinus@gmx.de>
+
+	* configure.ac: Bump version (to 2.0.47-pre).  Update merge
+	version to 2.0.46.
+
 2004-12-16  Michael Albinus  <michael.albinus@gmx.de>
 
 	Version 2.0.46 released.
Index: Makefile
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/tramp/Makefile,v
retrieving revision 1.42
diff -u -u -r1.42 Makefile
--- Makefile	2004/12/24 13:00:48	1.42
+++ Makefile	2005/01/16 13:42:13
@@ -18,7 +18,7 @@
 # Boston, MA 02111-1307, USA.
 
 VERSION = 1.21
-AUTHOR_VERSION = 2.0.46
+AUTHOR_VERSION = 2.0.47
 MAINTAINER = Kai Großjohann <kai.grossjohann@gmx.net>
 PACKAGE = tramp
 PKG_TYPE = regular
Index: lisp/ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/tramp/lisp/ChangeLog,v
retrieving revision 1.22
diff -u -u -r1.22 ChangeLog
--- lisp/ChangeLog	2004/12/24 00:03:38	1.22
+++ lisp/ChangeLog	2005/01/16 13:42:16
@@ -1,3 +1,60 @@
+2005-01-16  Michael Albinus  <michael.albinus@gmx.de>
+
+	Version 2.0.47 released.
+
+2005-01-15  Michael Albinus  <michael.albinus@gmx.de>
+
+	* tramp.el (tramp-operation-not-permitted-regexp) New defcustom,
+	catching keep-date problems in cp/scp operations.
+	(tramp-handle-copy-file): Don't call `set-file-modes'
+	unconditionally.  Specialized functions should know better what is
+	necessary.  This improves performance a little bit, and the
+	functions could catch errors with `cp -p' and `scp -p'.
+	(tramp-do-copy-or-rename-file-via-buffer)
+	(tramp-do-copy-or-rename-file-out-of-band): Call `set-file-modes'
+	when appropriate.
+	(tramp-do-copy-or-rename-file-directly): Mask `cp -p' error.  Call
+	`set-file-modes' when appropriate.
+	(tramp-action-out-of-band): Mask `scp -p' error.
+	Reported by Isak Johnsson <isak@hypergene.com>
+
+2005-01-09  Michael Albinus  <michael.albinus@gmx.de>
+
+	* tramp-util.el (tramp-remap-command): New defun.
+	(top): Remove `define-key' calls.  They are replaced by respective
+	`tramp-remap-command' and `add-menu-button' calls.  Add
+	`tramp-minor-mode' to `dired-mode-hook'.
+	(tramp-compile, tramp-recompile): Call the commands
+	asynchronously.  Add `compilation-mode' to *Compilation* buffer.
+
+2005-01-05  Michael Albinus  <michael.albinus@gmx.de>
+
+	* tramp-util.el: Fix copyright years.  Adapt author address.
+	(tramp-minor-mode): Mode must toggle.
+	
+2005-01-04  Michael Albinus  <michael.albinus@gmx.de>
+
+	* tramp-util.el (tramp-compile, tramp-recompile): Enable
+	`tramp-minor-mode' in buffer "*Compilation*".
+	
+2004-12-29  Michael Albinus  <michael.albinus@gmx.de>
+
+	* tramp-util.el (tramp-minor-mode): New minor mode.  Add it to
+	`find-file-hooks'.
+	(tramp-minor-mode-map): Respective map.  Add remapping for
+	`compile' and `recompile'.
+	(tramp-recompile): New defun.
+
+2004-12-19    <kgrossjo@eu.uu.net>
+
+	* tramp.el (tramp-wait-for-output): Fix typo in echo processing.
+
+2004-12-25  Michael Albinus  <michael.albinus@gmx.de>
+
+	* tramp.el (tramp-get-buffer, tramp-get-debug-buffer): Discard the
+	undo list of both Tramp buffer and debug buffer.  Reported by
+	Joakim Verona <joakim@verona.se>
+
 2004-12-23  Michael Albinus  <michael.albinus@gmx.de>
 
 	* tramp.el (tramp-file-name-for-operation): Mark `shell-command'
Index: lisp/tramp-util.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/tramp/lisp/tramp-util.el,v
retrieving revision 1.5
diff -u -u -r1.5 tramp-util.el
--- lisp/tramp-util.el	2004/09/22 19:09:52	1.5
+++ lisp/tramp-util.el	2005/01/16 13:42:16
@@ -1,9 +1,9 @@
 ;;; -*- coding: iso-2022-7bit; -*-
 ;;; tramp-util.el --- Misc utility functions to use with Tramp
 
-;; Copyright (C) 2001  Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
-;; Author: Kai Gro,A_(Bjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+;; Author: kai.grossjohann@gmx.net
 ;; Keywords: comm, extensions, processes
 
 ;; This file is free software; you can redistribute it and/or modify
@@ -32,6 +32,60 @@
 (require 'compile)
 (require 'tramp)
 
+;; Define a Tramp minor mode. It's intention is to redefine some keys for Tramp
+;; specific functions, like compilation.
+;; The key remapping works since Emacs 21.4 only. Unknown for XEmacs.
+
+(when (fboundp 'define-minor-mode)
+
+  (defvar tramp-minor-mode-map (make-sparse-keymap)
+    "Keymap for Tramp minor mode.")
+
+  (define-minor-mode tramp-minor-mode "Tramp minor mode for utility functions."
+:group 'tramp
+:global nil
+:init-value nil
+:lighter " Tramp"
+:keymap tramp-minor-mode-map
+    (setq tramp-minor-mode
+	  (and tramp-minor-mode (tramp-tramp-file-p default-directory))))
+
+  (add-hook 'find-file-hooks 'tramp-minor-mode t)
+  (add-hook 'dired-mode-hook 'tramp-minor-mode t)
+
+  (defun tramp-remap-command (old-command new-command)
+    "Replaces bindings of OLD-COMMAND by NEW-COMMAND.
+If remapping functionality for keymaps is defined, this happens for all
+bindings.  Otherwise, only bindings active during invocation are taken
+into account.  XEmacs menubar bindings are not changed by this."
+    (if (functionp 'command-remapping)
+	;; Emacs 21.4
+	(eval
+	 `(define-key tramp-minor-mode-map [remap ,old-command] new-command))
+      ;; previous Emacs 21 versions.
+      (mapcar
+       '(lambda (x)
+	  (define-key tramp-minor-mode-map x new-command))
+       (where-is-internal old-command))))
+
+  (tramp-remap-command 'compile 'tramp-compile)
+  (tramp-remap-command 'recompile 'tramp-recompile)
+
+  ;; XEmacs has an own mimic for menu entries
+  (when (fboundp 'add-menu-button)
+    (funcall 'add-menu-button
+     '("Tools" "Compile")
+     ["Compile..."
+      (command-execute (if tramp-minor-mode 'tramp-compile 'compile))
+:active (fboundp 'compile)])
+    (funcall 'add-menu-button
+     '("Tools" "Compile")
+     ["Repeat Compilation"
+      (command-execute (if tramp-minor-mode 'tramp-recompile 'recompile))
+:active (fboundp 'compile)])))
+
+;; Utility functions.
+
 (defun tramp-compile (command)
   "Compile on remote host."
   (interactive
@@ -49,6 +103,16 @@
       (setq default-directory d)))
   (tramp-handle-shell-command command (get-buffer "*Compilation*"))
   (pop-to-buffer (get-buffer "*Compilation*"))
+  (tramp-minor-mode 1)
+  (compilation-minor-mode 1))
+
+(defun tramp-recompile ()
+  "Re-compile on remote host."
+  (interactive)
+  (save-some-buffers (not compilation-ask-about-save) nil)
+  (tramp-handle-shell-command compile-command (get-buffer "*Compilation*"))
+  (pop-to-buffer (get-buffer "*Compilation*"))
+  (tramp-minor-mode 1)
   (compilation-minor-mode 1))
 
 (provide 'tramp-util)
Index: lisp/tramp.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/tramp/lisp/tramp.el,v
retrieving revision 1.22
diff -u -u -r1.22 tramp.el
--- lisp/tramp.el	2004/12/24 00:03:39	1.22
+++ lisp/tramp.el	2005/01/16 13:42:21
@@ -1,7 +1,7 @@
 ;;; -*- mode: Emacs-Lisp; coding: iso-2022-7bit; -*-
 ;;; tramp.el --- Transparent Remote Access, Multiple Protocol
 
-;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
 ;; Author: kai.grossjohann@gmx.net
 ;; Keywords: comm, processes
@@ -912,6 +912,15 @@
   :group 'tramp
   :type 'regexp)
 
+(defcustom tramp-operation-not-permitted-regexp
+  (concat "\\(" "preserving times.*" "\\|" "set mode" "\\)" ":\\s-*"
+	  (regexp-opt '("Operation not permitted") t))
+  "Regular expression matching keep-date problems in (s)cp operations.
+Copying has been performed successfully already, so this message can
+be ignored safely."
+:group 'tramp
+:type 'regexp)
+
 (defcustom tramp-process-alive-regexp
   ""
   "Regular expression indicating a process has finished.
@@ -2822,10 +2831,8 @@
   ;; At least one file a tramp file?
   (if (or (tramp-tramp-file-p filename)
           (tramp-tramp-file-p newname))
-      (let ((modes (file-modes filename)))
-	(tramp-do-copy-or-rename-file
-	 'copy filename newname ok-if-already-exists keep-date)
-	(set-file-modes newname modes))
+      (tramp-do-copy-or-rename-file
+       'copy filename newname ok-if-already-exists keep-date)
     (tramp-run-real-handler
      'copy-file
      (list filename newname ok-if-already-exists keep-date))))
@@ -2973,8 +2980,9 @@
       (when keep-date
 	(when (and (not (null modtime))
 		   (not (equal modtime '(0 0))))
-	  (tramp-touch newname modtime))
-	(set-file-modes newname (file-modes filename))))
+	  (tramp-touch newname modtime)))
+      ;; Set the mode.
+      (set-file-modes newname (file-modes filename)))
     ;; If the operation was `rename', delete the original file.
     (unless (eq op 'copy)
       (delete-file filename))))
@@ -2994,15 +3002,34 @@
                        "Unknown operation `%s', must be `copy' or `rename'"
                        op)))))
     (save-excursion
-      (tramp-barf-unless-okay
+      (tramp-send-command
        multi-method method user host
        (format "%s %s %s"
                cmd
                (tramp-shell-quote-argument localname1)
-               (tramp-shell-quote-argument localname2))
-       nil 'file-error
-       "Copying directly failed, see buffer `%s' for details."
-       (buffer-name)))))
+               (tramp-shell-quote-argument localname2)))
+      (tramp-wait-for-output)
+      (goto-char (point-min))
+      (unless
+	  (or
+	   (and (eq op 'copy) keep-date
+		;; Mask cp -f error.
+		(re-search-forward tramp-operation-not-permitted-regexp nil t))
+	   (zerop (tramp-send-command-and-check
+		   multi-method method user host nil nil)))
+	(pop-to-buffer (current-buffer))
+	(signal 'file-error
+		(format "Copying directly failed, see buffer `%s' for details."
+			(buffer-name)))))
+    ;; Set the mode.
+    ;; CCC: Maybe `chmod --reference=localname1 localname2' could be used
+    ;;      where available?
+    (unless (or (eq op 'rename) keep-date)
+      (set-file-modes
+       (tramp-make-tramp-file-name multi-method method user host localname2)
+       (file-modes
+	(tramp-make-tramp-file-name
+	 multi-method method user host localname1))))))
 
 (defun tramp-do-copy-or-rename-file-out-of-band (op filename newname keep-date)
   "Invoke rcp program to copy.
@@ -3122,7 +3149,11 @@
 			       tramp-actions-copy-out-of-band))
       (kill-buffer trampbuf)
       (tramp-message
-       5 "Transferring %s to file %s...done" filename newname))
+       5 "Transferring %s to file %s...done" filename newname)
+
+      ;; Set the mode.
+      (unless keep-date
+	(set-file-modes newname (file-modes filename))))
 
     ;; If the operation was `rename', delete the original file.
     (unless (eq op 'copy)
@@ -4910,7 +4941,10 @@
 
 (defun tramp-get-buffer (multi-method method user host)
   "Get the connection buffer to be used for USER at HOST using METHOD."
-  (get-buffer-create (tramp-buffer-name multi-method method user host)))
+  (with-current-buffer
+      (get-buffer-create (tramp-buffer-name multi-method method user host))
+    (setq buffer-undo-list t)
+    (current-buffer)))
 
 (defun tramp-debug-buffer-name (multi-method method user host)
   "A name for the debug buffer for USER at HOST using METHOD."
@@ -4924,7 +4958,11 @@
 
 (defun tramp-get-debug-buffer (multi-method method user host)
   "Get the debug buffer for USER at HOST using METHOD."
-  (get-buffer-create (tramp-debug-buffer-name multi-method method user host)))
+  (with-current-buffer
+      (get-buffer-create
+       (tramp-debug-buffer-name multi-method method user host))
+    (setq buffer-undo-list t)
+    (current-buffer)))
 
 (defun tramp-find-executable (multi-method method user host
                                          progname dirlist ignore-tilde)
@@ -5216,8 +5254,16 @@
 	((or (and (memq (process-status p) '(stop exit))
 		  (not (zerop (process-exit-status p))))
 	     (memq (process-status p) '(signal)))
-	 (tramp-message 9 "Process has died.")
-	 (throw 'tramp-action 'process-died))
+	 ;; `scp' could have copied correctly, but set modes could have failed.
+	 ;; This can be ignored.
+	 (goto-char (point-min))
+	 (if (re-search-forward tramp-operation-not-permitted-regexp nil t)
+	     (progn
+	       (tramp-message 10 "'set mode' error ignored.")
+	       (tramp-message 9 "Process has finished.")
+	       (throw 'tramp-action 'ok))
+	   (tramp-message 9 "Process has died.")
+	   (throw 'tramp-action 'process-died)))
 	(t nil)))
 
 ;; The following functions are specifically for multi connections.
Index: lisp/trampver.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/tramp/lisp/trampver.el,v
retrieving revision 1.6
diff -u -u -r1.6 trampver.el
--- lisp/trampver.el	2004/12/24 00:03:39	1.6
+++ lisp/trampver.el	2005/01/16 13:42:21
@@ -30,7 +30,7 @@
 ;; are auto-frobbed from configure.ac, so you should edit that file and run
 ;; "autoconf && ./configure" to change them.
 
-(defconst tramp-version "2.0.46"
+(defconst tramp-version "2.0.47"
   "This version of Tramp.")
 
 (defconst tramp-bug-report-address "tramp-devel@mail.freesoftware.fsf.org"
Index: texi/ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/tramp/texi/ChangeLog,v
retrieving revision 1.23
diff -u -u -r1.23 ChangeLog
--- texi/ChangeLog	2004/12/24 00:03:43	1.23
+++ texi/ChangeLog	2005/01/16 13:42:21
@@ -1,3 +1,27 @@
+2005-01-16  Michael Albinus  <michael.albinus@gmx.de>
+
+	Version 2.0.47 released.
+
+2005-01-09  Michael Albinus  <michael.albinus@gmx.de>
+
+	* tramp.texi: (Compilation): Make reference to (X)Emacs manual
+	flavor specific.  Remove mentioned restrictions for Emacs < 21.4
+	and for XEmacs.
+
+2005-01-05  Michael Albinus  <michael.albinus@gmx.de>
+
+	* tramp.texi: Fix copyright years.
+
+2005-01-04  Michael Albinus  <michael.albinus@gmx.de>
+
+	* tramp.texi (Compilation): Give a note that remote compilation is
+	performed synchronously only, for the time being.
+
+2004-12-29  Michael Albinus  <michael.albinus@gmx.de>
+
+	* tramp.texi (Compilation): New section, describing compilation of
+	remote files.
+
 2004-12-16  Michael Albinus  <michael.albinus@gmx.de>
 
 	Version 2.0.46 released.
Index: texi/tramp.texi
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/tramp/texi/tramp.texi,v
retrieving revision 1.18
diff -u -u -r1.18 tramp.texi
--- texi/tramp.texi	2004/10/17 17:56:01	1.18
+++ texi/tramp.texi	2005/01/16 13:42:23
@@ -25,8 +25,8 @@
 @end macro
 
 @copying
-Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004 Free Software
-Foundation, Inc.
+Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free
+Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -192,6 +192,7 @@
 * Multi-hop filename syntax::   Multi-hop filename conventions.
 * Filename completion::         Filename completion.
 * Dired::                       Dired.
+* Compilation::                 Compile remote files.
 
 The inner workings of remote version control
 
@@ -1690,6 +1691,7 @@
 * Multi-hop filename syntax::   Multi-hop filename conventions.
 * Filename completion::         Filename completion.
 * Dired::                       Dired.
+* Compilation::                 Compile remote files.
 @end menu
 
 
@@ -1883,6 +1885,32 @@
 If you need to browse a directory tree, Dired is a better choice, at
 present, than filename completion.  Dired has its own cache mechanism
 and will only fetch the directory listing once.
+
+
+@node Compilation
+@section Compile remote files
+@cindex compile
+@cindex recompile
+
+@value{tramp} provides commands for compilation of files on remote
+machines.  In order to get them loaded, you need to require
+@file{tramp-util.el}:
+
+@lisp
+(require 'tramp-util)
+@end lisp
+
+Afterwards, you can use the commands @code{tramp-compile} and
+@code{tramp-recompile} instead of @code{compile} and @code{recompile},
+respectively; @inforef{Compilation, ,@value{emacsdir}}.  This does not
+work for the @option{ftp} and @option{smb} methods.
+
+The corresponding key bindings and menu entries calling these commands
+are redefined automatically for buffers associated with remote files.
+
+After finishing the compilation, you can use the usual commands like
+@code{previous-error}, @code{next-error} and @code{first-error} for
+navigation in the @file{*Compilation*} buffer.
 
 
 @node Bug Reports
Index: texi/trampver.texi
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/tramp/texi/trampver.texi,v
retrieving revision 1.6
diff -u -u -r1.6 trampver.texi
--- texi/trampver.texi	2004/12/24 00:03:43	1.6
+++ texi/trampver.texi	2005/01/16 13:42:23
@@ -4,7 +4,7 @@
 @c In the Tramp CVS, the version number is auto-frobbed from
 @c configure.ac, so you should edit that file and run
 @c "autoconf && ./configure" to change the version number.
-@set trampver 2.0.46
+@set trampver 2.0.47
 
 @c Other flags from configuration
 @set prefix /usr/local
