From 957b3189e673ad7a9d2018411bbaf196338e145b Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Thu, 5 Jul 2012 08:57:57 +0200 Subject: [PATCH] Sync with Tramp 2.2.6-pre. * net/tramp.el (tramp-drop-volume-letter): Provide an XEmacs compatible declaration. * net/tramp-cmds.el (tramp-append-tramp-buffers): Protect `list-load-path-shadows' call. * net/tramp-compat.el (top): Require packages, which aren't autoloaded anymore for XEmacs. Protect call of `tramp-file-name-handler' by `tramp-compat-funcall', pacifying the compiler. Do not require tramp-util.el and tramp-vc.el anymore, it hurts at least for SXEmacs. (tramp-compat-temporary-file-directory): In XEmacs, there is no standard-value for `temporary-file-directory'. * net/tramp-sh.el (tramp-do-directory-files-and-attributes-with-stat): Redirect stderr to /dev/null. (tramp-sh-handle-write-region): uid and gid can be floats. Reported by Russell Sim . (tramp-sh-handle-vc-registered): Hide errors. (tramp-vc-file-name-handler): Use dummy results for `process-file' and `start-file-process'. (tramp-maybe-open-connection): Check also whether `non-essential' is bound. --- lisp/ChangeLog | 28 ++++++++++++++++++++++++++++ lisp/net/tramp-cmds.el | 5 +++-- lisp/net/tramp-compat.el | 36 +++++++++++++++++++++++++----------- lisp/net/tramp-sh.el | 23 +++++++++++++---------- lisp/net/tramp.el | 3 +++ 5 files changed, 72 insertions(+), 23 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4c9c604f816..adb14d5c75e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,31 @@ +2012-07-05 Michael Albinus + + Sync with Tramp 2.2.6-pre. + + * net/tramp.el (tramp-drop-volume-letter): Provide an XEmacs + compatible declaration. + + * net/tramp-cmds.el (tramp-append-tramp-buffers): Protect + `list-load-path-shadows' call. + + * net/tramp-compat.el (top): Require packages, which aren't + autoloaded anymore for XEmacs. Protect call of + `tramp-file-name-handler' by `tramp-compat-funcall', pacifying the + compiler. Do not require tramp-util.el and tramp-vc.el anymore, + it hurts at least for SXEmacs. + (tramp-compat-temporary-file-directory): In XEmacs, there is no + standard-value for `temporary-file-directory'. + + * net/tramp-sh.el (tramp-do-directory-files-and-attributes-with-stat): + Redirect stderr to /dev/null. + (tramp-sh-handle-write-region): uid and gid can be floats. + Reported by Russell Sim . + (tramp-sh-handle-vc-registered): Hide errors. + (tramp-vc-file-name-handler): Use dummy results for `process-file' + and `start-file-process'. + (tramp-maybe-open-connection): Check also whether `non-essential' + is bound. + 2012-07-04 Chong Yidong * xml.el (xml--parse-buffer): Use xml-syntax-table. diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index 042e51d5c9e..06aae1f6af2 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -295,8 +295,9 @@ buffer in your bug report. ;; Dump load-path shadows. (insert "\nload-path shadows:\n==================\n") (ignore-errors - (mapc (lambda (x) (when (string-match "tramp" x) (insert x "\n"))) - (split-string (list-load-path-shadows t) "\n"))) + (mapc + (lambda (x) (when (string-match "tramp" x) (insert x "\n"))) + (split-string (tramp-compat-funcall 'list-load-path-shadows t) "\n"))) ;; Append buffers only when we are in message mode. (when (and diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 9984195627c..c3552ae023b 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -29,8 +29,6 @@ ;;; Code: -(require 'tramp-loaddefs) - (eval-when-compile ;; Pacify byte-compiler. @@ -38,11 +36,24 @@ (eval-and-compile + ;; Some packages must be required for XEmacs, because we compile + ;; with -no-autoloads. + (when (featurep 'xemacs) + (require 'cus-edit) + (require 'env) + (require 'executable) + (require 'outline) + (require 'passwd) + (require 'pp) + (require 'regexp-opt)) + (require 'advice) (require 'custom) (require 'format-spec) (require 'shell) + (require 'tramp-loaddefs) + ;; As long as password.el is not part of (X)Emacs, it shouldn't be ;; mandatory. (if (featurep 'xemacs) @@ -61,7 +72,8 @@ (require 'timer)) ;; We check whether `start-file-process' is bound. - (unless (fboundp 'start-file-process) + ;; Note: we deactivate this. There are problems, at least in SXEmacs. + (unless t;(fboundp 'start-file-process) ;; tramp-util offers integration into other (X)Emacs packages like ;; compile.el, gud.el etc. Not necessary in Emacs 23. @@ -127,7 +139,8 @@ (defalias 'file-remote-p (lambda (file &optional identification connected) (when (tramp-tramp-file-p file) - (tramp-file-name-handler + (tramp-compat-funcall + 'tramp-file-name-handler 'file-remote-p file identification connected))))) ;; `process-file' does not exist in XEmacs. @@ -153,8 +166,8 @@ (defalias 'set-file-times (lambda (filename &optional time) (when (tramp-tramp-file-p filename) - (tramp-file-name-handler - 'set-file-times filename time))))) + (tramp-compat-funcall + 'tramp-file-name-handler 'set-file-times filename time))))) ;; We currently use "[" and "]" in the filename format for IPv6 ;; hosts of GNU Emacs. This means that Emacs wants to expand @@ -221,11 +234,11 @@ For Emacs, this is the variable `temporary-file-directory', for XEmacs this is the function `temp-directory'." (let (file-name-handler-alist) + ;; We must return a local directory. If it is remote, we could + ;; run into an infloop. (cond - ;; We must return a local directory. If it is remote, we could - ;; run into an infloop. - ((boundp 'temporary-file-directory) - (eval (car (get 'temporary-file-directory 'standard-value)))) + ((and (boundp 'temporary-file-directory) + (eval (car (get 'temporary-file-directory 'standard-value))))) ((fboundp 'temp-directory) (tramp-compat-funcall 'temp-directory)) ((let ((d (getenv "TEMP"))) (and d (file-directory-p d))) (file-name-as-directory (getenv "TEMP"))) @@ -302,7 +315,8 @@ Not actually used. Use `(format \"%o\" i)' instead?" ((or (null id-format) (eq id-format 'integer)) (file-attributes filename)) ((tramp-tramp-file-p filename) - (tramp-file-name-handler 'file-attributes filename id-format)) + (tramp-compat-funcall + 'tramp-file-name-handler 'file-attributes filename id-format)) (t (condition-case nil (tramp-compat-funcall 'file-attributes filename id-format) (wrong-number-of-arguments (file-attributes filename)))))) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 1ef602cf6da..6716ef52148 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -1692,9 +1692,10 @@ and gid of the corresponding user is taken. Both parameters must be integers." ;; "-"; this would confuse xargs. "ls -aQ" might be a solution, ;; but it does not work on all remote systems. Therefore, we ;; quote the filenames via sed. - "cd %s; echo \"(\"; (%s -a | sed -e s/\\$/\\\"/g -e s/^/\\\"/g | xargs " - "%s -c '(\"%%n\" (\"%%N\") %%h %s %s %%Xe0 %%Ye0 %%Ze0 %%se0 \"%%A\" t %%ie0 -1)'); " - "echo \")\"") + "cd %s; echo \"(\"; (%s -a | sed -e s/\\$/\\\"/g -e s/^/\\\"/g | " + "xargs %s -c " + "'(\"%%n\" (\"%%N\") %%h %s %s %%Xe0 %%Ye0 %%Ze0 %%se0 \"%%A\" t %%ie0 -1)'" + " 2>/dev/null); echo \")\"") (tramp-shell-quote-argument localname) (tramp-get-ls-command vec) (tramp-get-remote-stat vec) @@ -3284,14 +3285,14 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." (let (last-coding-system-used (need-chown t)) ;; Set file modification time. (when (or (eq visit t) (stringp visit)) - (let ((file-attr (file-attributes filename))) + (let ((file-attr (tramp-compat-file-attributes filename 'integer))) (set-visited-file-modtime ;; We must pass modtime explicitly, because filename can ;; be different from (buffer-file-name), f.e. if ;; `file-precious-flag' is set. (nth 5 file-attr)) - (when (and (eq (nth 2 file-attr) uid) - (eq (nth 3 file-attr) gid)) + (when (and (= (nth 2 file-attr) uid) + (= (nth 3 file-attr) gid)) (setq need-chown nil)))) ;; Set the ownership. @@ -3332,7 +3333,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." `((,tramp-file-name-regexp . tramp-vc-file-name-handler)))) ;; Here we collect only file names, which need an operation. - (tramp-run-real-handler 'vc-registered (list file)) + (ignore-errors (tramp-run-real-handler 'vc-registered (list file))) (tramp-message v 10 "\n%s" tramp-vc-registered-file-names) ;; Send just one command, in order to fill the cache. @@ -3400,10 +3401,12 @@ Fall back to normal file name handler if no Tramp handler exists." ((and fn (memq operation '(file-exists-p file-readable-p))) (add-to-list 'tramp-vc-registered-file-names localname 'append) nil) + ;; `process-file' and `start-file-process' shall be ignored. + ((and fn (eq operation 'process-file) 0)) + ((and fn (eq operation 'start-file-process) nil)) ;; Tramp file name handlers like `expand-file-name'. They ;; must still work. - (fn - (save-match-data (apply (cdr fn) args))) + (fn (save-match-data (apply (cdr fn) args))) ;; Default file name handlers, we don't care. (t (tramp-run-real-handler operation args))))))) @@ -4294,7 +4297,7 @@ connection if a previous connection has died for some reason." (tramp-get-buffer vec) ;; If `non-essential' is non-nil, don't reopen a new connection. - (when non-essential + (when (and (boundp 'non-essential) (symbol-value 'non-essential)) (throw 'non-essential 'non-essential)) (tramp-with-progress-reporter diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index d0e8b35d6ca..5e70bab24e9 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1531,6 +1531,9 @@ letter into the file name. This function removes it." 'identity)) +(if (featurep 'xemacs) + (defalias 'tramp-drop-volume-letter 'identity)) + (defun tramp-cleanup (vec) "Cleanup connection VEC, but keep the debug buffer." (with-current-buffer (tramp-get-debug-buffer vec) -- 2.39.2