From b81a0b569166c9aa39a00d861ab5a154f3dbdea3 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sat, 12 Jun 2010 10:59:37 +0200 Subject: [PATCH] * net/tramp.el (tramp-remote-process-environment): Protect version string by apostroph. (tramp-shell-prompt-pattern): Do not use a shy group in case of XEmacs. (tramp-file-name-for-operation): Add `call-process-region'. (tramp-set-process-query-on-exit-flag): Fix wrong parentheses. * net/tramp-compat.el (top): Do not autoload `tramp-handle-file-remote-p'. Load tramp-util.el and tramp-vc.el only when `start-file-process' is not bound. (tramp-advice-file-expand-wildcards): Do not use `tramp-handle-file-remote-p'. (tramp-compat-make-temp-file): Handle the case, that `make-temp-file' has no third argument EXTENSION. --- lisp/ChangeLog | 19 +++++++++- lisp/net/tramp-compat.el | 78 ++++++++++++++++++++-------------------- lisp/net/tramp.el | 15 ++++---- 3 files changed, 66 insertions(+), 46 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4bccd2c7980..f6c90fc4d68 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,20 @@ +2010-06-12 Michael Albinus + + * net/tramp.el (tramp-remote-process-environment): Protect version + string by apostroph. + (tramp-shell-prompt-pattern): Do not use a shy group in case of + XEmacs. + (tramp-file-name-for-operation): Add `call-process-region'. + (tramp-set-process-query-on-exit-flag): Fix wrong parentheses. + + * net/tramp-compat.el (top): Do not autoload + `tramp-handle-file-remote-p'. Load tramp-util.el and tramp-vc.el + only when `start-file-process' is not bound. + (tramp-advice-file-expand-wildcards): Do not use + `tramp-handle-file-remote-p'. + (tramp-compat-make-temp-file): Handle the case, that + `make-temp-file' has no third argument EXTENSION. + 2010-06-11 Juanma Barranquero * makefile.w32-in (WINS_BASIC): Include new directory vc. @@ -45,7 +62,7 @@ * net/notifications.el (notifications-on-action-signal) (notifications-on-closed-signal): Pass notification id as first - argument to the callback functions. Add docstrings. + argument to the callback functions. Add docstrings. (notifications-notify): Fix docstring. 2010-06-10 Glenn Morris diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index a1ec3c9b89d..484d2be7abe 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -44,33 +44,31 @@ (autoload 'tramp-tramp-file-p "tramp") (autoload 'tramp-file-name-handler "tramp") - (autoload 'tramp-handle-file-remote-p "tramp") - - ;; tramp-util offers integration into other (X)Emacs packages like - ;; compile.el, gud.el etc. Not necessary in Emacs 23. - (eval-after-load "tramp" - ;; We check whether `start-file-process' is an alias. - '(when (or (not (fboundp 'start-file-process)) - (symbolp (symbol-function 'start-file-process))) - (require 'tramp-util) - (add-hook 'tramp-unload-hook - '(lambda () - (when (featurep 'tramp-util) - (unload-feature 'tramp-util 'force)))))) - - ;; Make sure that we get integration with the VC package. When it - ;; is loaded, we need to pull in the integration module. Not - ;; necessary in Emacs 23. - (eval-after-load "vc" + + ;; We check whether `start-file-process' is bound. + (unless (fboundp 'start-file-process) + + ;; tramp-util offers integration into other (X)Emacs packages like + ;; compile.el, gud.el etc. Not necessary in Emacs 23. (eval-after-load "tramp" - ;; We check whether `start-file-process' is an alias. - '(when (or (not (fboundp 'start-file-process)) - (symbolp (symbol-function 'start-file-process))) - (require 'tramp-vc) + '(progn + (require 'tramp-util) (add-hook 'tramp-unload-hook '(lambda () - (when (featurep 'tramp-vc) - (unload-feature 'tramp-vc 'force))))))) + (when (featurep 'tramp-util) + (unload-feature 'tramp-util 'force)))))) + + ;; Make sure that we get integration with the VC package. When it + ;; is loaded, we need to pull in the integration module. Not + ;; necessary in Emacs 23. + (eval-after-load "vc" + (eval-after-load "tramp" + '(progn + (require 'tramp-vc) + (add-hook 'tramp-unload-hook + '(lambda () + (when (featurep 'tramp-vc) + (unload-feature 'tramp-vc 'force)))))))) ;; Avoid byte-compiler warnings if the byte-compiler supports this. ;; Currently, XEmacs supports this. @@ -176,7 +174,8 @@ (if (and (tramp-tramp-file-p name) (not (string-match - "[[*?]" (tramp-handle-file-remote-p name 'localname)))) + "[[*?]" (tramp-compat-funcall + 'file-remote-p name 'localname)))) (setq ad-return-value (list name)) ;; Otherwise, just run the original function. ad-do-it))) @@ -236,22 +235,23 @@ Add the extension of FILENAME, if existing." (tramp-compat-temporary-file-directory))) (extension (file-name-extension filename t)) result) - (if (fboundp 'make-temp-file) + (condition-case nil (setq result (tramp-compat-funcall 'make-temp-file prefix dir-flag extension)) - ;; We use our own implementation, taken from files.el. - (while - (condition-case () - (progn - (setq result (concat (make-temp-name prefix) extension)) - (if dir-flag - (make-directory result) - (write-region "" nil result nil 'silent)) - nil) - (file-already-exists t)) - ;; The file was somehow created by someone else between - ;; `make-temp-name' and `write-region', let's try again. - nil)) + (error + ;; We use our own implementation, taken from files.el. + (while + (condition-case () + (progn + (setq result (concat (make-temp-name prefix) extension)) + (if dir-flag + (make-directory result) + (write-region "" nil result nil 'silent)) + nil) + (file-already-exists t)) + ;; The file was somehow created by someone else between + ;; `make-temp-name' and `write-region', let's try again. + nil))) result)) ;; `most-positive-fixnum' does not exist in XEmacs. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index ecaa8aa1292..8e9ca34f16b 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1065,7 +1065,7 @@ as given in your `~/.profile'." `("HISTFILE=$HOME/.tramp_history" "HISTSIZE=1" "LC_ALL=C" ,(format "TERM=%s" tramp-terminal-type) "EMACS=t" ;; Deprecated. - ,(format "INSIDE_EMACS=%s,tramp:%s" emacs-version tramp-version) + ,(format "INSIDE_EMACS='%s,tramp:%s'" emacs-version tramp-version) "CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH=" "autocorrect=" "correct=") @@ -1091,8 +1091,10 @@ Sometimes the prompt is reported to look like \"login as:\"." (defcustom tramp-shell-prompt-pattern ;; Allow a prompt to start right after a ^M since it indeed would be - ;; displayed at the beginning of the line (and Zsh uses it). - "\\(?:^\\|\r\\)[^#$%>\n]*#?[#$%>] *\\(\e\\[[0-9;]*[a-zA-Z] *\\)*" + ;; displayed at the beginning of the line (and Zsh uses it). This + ;; regexp works only for GNU Emacs. + (concat (if (featurep 'xemacs) "" "\\(?:^\\|\r\\)") + "[^#$%>\n]*#?[#$%>] *\\(\e\\[[0-9;]*[a-zA-Z] *\\)*") "Regexp to match prompts from remote shell. Normally, Tramp expects you to configure `shell-prompt-pattern' correctly, but sometimes it happens that you are connecting to a @@ -5513,7 +5515,8 @@ ARGS are the arguments OPERATION has been called with." ;; XEmacs only. 'dired-print-file 'dired-shell-call-process ;; nowhere yet. - 'executable-find 'start-process 'call-process)) + 'executable-find 'start-process + 'call-process 'call-process-region)) default-directory) ;; Unknown file primitive. (t (error "unknown file I/O primitive: %s" operation)))) @@ -8758,7 +8761,7 @@ If the second argument flag is non-nil, Emacs will query the user before exiting if process is running." (if (fboundp 'set-process-query-on-exit-flag) (tramp-compat-funcall 'set-process-query-on-exit-flag process flag) - (tramp-compat-funcall 'process-kill-without-query) process flag)) + (tramp-compat-funcall 'process-kill-without-query process flag))) ;; ------------------------------------------------------------ @@ -8914,7 +8917,7 @@ Only works for Bourne-like shells." ;; rsync). ;; * Keep a second connection open for out-of-band methods like scp or ;; rsync. -;; * Support ptys in `tramp-handle-start-file-process'. (Bug#4604) +;; * Support ptys in `tramp-handle-start-file-process'. (Bug#4604, Bug#6360) ;; * IMHO, it's a drawback that currently Tramp doesn't support ;; Unicode in Dired file names by default. Is it possible to ;; improve Tramp to set LC_ALL to "C" only for commands where Tramp -- 2.39.2