]> git.eshelyaron.com Git - emacs.git/commitdiff
* net/tramp.el (tramp-handle-file-remote-p): Handle optional
authorMichael Albinus <michael.albinus@gmx.de>
Tue, 7 Aug 2007 20:04:27 +0000 (20:04 +0000)
committerMichael Albinus <michael.albinus@gmx.de>
Tue, 7 Aug 2007 20:04:27 +0000 (20:04 +0000)
parameters IDENTIFICATION and CONNECTED.
(tramp-handle-insert-file-contents): VISIT must be handled after
insertion of the local copy.  Reported by Peter Gordon
<peter@pg-consultants.com>.
(tramp-file-name-handler): No special handling for
`expand-file-name'.  But for `file-name-as-directory'.
(tramp-find-shell, tramp-open-connection-telnet)
(tramp-open-connection-rsh, tramp-open-connection-su)
(tramp-open-connection-multi)
(tramp-open-connection-setup-interactive-shell): Guard against
$PROMPT_COMMAND shell var.  Reported by Steve Youngs
<steve@sxemacs.org>.
(tramp-append-tramp-buffers): Replace "sensible" by "sensitive" in
the hint.

* net/trampver.el: Update release number.

lisp/ChangeLog
lisp/net/tramp.el
lisp/net/trampver.el

index 8d25f687b2b9edddd5862c5d72c38c35f938ce32..381092c8e6099d076bb5306593843d3e0af8ad86 100644 (file)
@@ -1,3 +1,23 @@
+2007-08-07  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-handle-file-remote-p): Handle optional
+       parameters IDENTIFICATION and CONNECTED.
+       (tramp-handle-insert-file-contents): VISIT must be handled after
+       insertion of the local copy.  Reported by Peter Gordon
+       <peter@pg-consultants.com>.
+       (tramp-file-name-handler): No special handling for
+       `expand-file-name'.  But for `file-name-as-directory'.
+       (tramp-find-shell, tramp-open-connection-telnet)
+       (tramp-open-connection-rsh, tramp-open-connection-su)
+       (tramp-open-connection-multi)
+       (tramp-open-connection-setup-interactive-shell): Guard against
+       $PROMPT_COMMAND shell var.  Reported by Steve Youngs
+       <steve@sxemacs.org>.
+       (tramp-append-tramp-buffers): Replace "sensible" by "sensitive" in
+       the hint.
+
+       * net/trampver.el: Update release number.
+
 2007-08-07  Tom Tromey  <tromey@redhat.com>
 
        * progmodes/tcl.el (tcl-indent-level, tcl-continued-indent-level):
index 9f665ca470761ac7f0655881eac7c663f59e8a84..09167d674ebbfb235c5fc945cd62f7da0d4cbf06 100644 (file)
@@ -3868,11 +3868,20 @@ This will break if COMMAND prints a newline, followed by the value of
            (t (error "Wrong method specification for `%s'" method)))
       tmpfil)))
 
-(defun tramp-handle-file-remote-p (filename)
-  "Like `file-remote-p' for tramp files."
+(defun tramp-handle-file-remote-p (filename &optional identification connected)
+  "Like `file-remote-p' for Tramp files."
   (when (tramp-tramp-file-p filename)
     (with-parsed-tramp-file-name filename nil
-      (tramp-make-tramp-file-name multi-method method user host ""))))
+      (and (or (not connected)
+              (let ((p (get-buffer-process
+                        (tramp-get-buffer multi-method method user host))))
+                (and p (processp p) (memq (process-status p) '(run open)))))
+          (cond
+           ((eq identification 'method) method)
+           ((eq identification 'user) user)
+           ((eq identification 'host) host)
+           (t (tramp-make-tramp-file-name
+               multi-method method user host "")))))))
 
 (defun tramp-handle-insert-file-contents
   (filename &optional visit beg end replace)
@@ -3899,14 +3908,14 @@ This will break if COMMAND prints a newline, followed by the value of
                      'file-local-copy)))
               (file-local-copy filename)))
            coding-system-used result)
-       (when visit
-         (setq buffer-file-name filename)
-         (set-visited-file-modtime)
-         (set-buffer-modified-p nil))
        (tramp-message-for-buffer
         multi-method method user host
         9 "Inserting local temp file `%s'..." local-copy)
        (setq result (insert-file-contents local-copy nil beg end replace))
+       (when visit
+         (setq buffer-file-name filename)
+         (set-visited-file-modtime)
+         (set-buffer-modified-p nil))
        ;; Now `last-coding-system-used' has right value.  Remember it.
        (when (boundp 'last-coding-system-used)
          (setq coding-system-used (symbol-value 'last-coding-system-used)))
@@ -4354,11 +4363,12 @@ Falls back to normal file name handler if no tramp file name handler exists."
        (cond
         ;; When we are in completion mode, some operations shouldn' be
         ;; handled by backend.
-        ((and completion (memq operation '(expand-file-name)))
-         (tramp-run-real-handler operation args))
         ((and completion (zerop (length localname))
               (memq operation '(file-exists-p file-directory-p)))
          t)
+        ((and completion (zerop (length localname))
+              (memq operation '(file-name-as-directory)))
+         filename)
         ;; Call the backend function.
         (foreign (apply foreign operation args))
         ;; Nothing to do for us.
@@ -5351,7 +5361,7 @@ file exists and nonzero exit status otherwise."
        5 "Starting remote shell `%s' for tilde expansion..." shell)
       (tramp-send-command
        multi-method method user host
-       (concat "PS1='$ ' exec " shell)) ;
+       (concat "PROMPT_COMMAND='' PS1='$ ' exec " shell)) ;
       (tramp-barf-if-no-shell-prompt
        (get-buffer-process (current-buffer))
        60 "Couldn't find remote `%s' prompt" shell)
@@ -5361,11 +5371,12 @@ file exists and nonzero exit status otherwise."
       ;; must use "\n" here, not tramp-rsh-end-of-line.  Kai left the
       ;; last tramp-rsh-end-of-line, Douglas wanted to replace that,
       ;; as well.
-      (process-send-string nil (format "PS1='%s%s%s'; PS2=''; PS3=''%s"
-                                      tramp-rsh-end-of-line
-                                       tramp-end-of-output
-                                      tramp-rsh-end-of-line
-                                       tramp-rsh-end-of-line))
+      (process-send-string
+       nil (format "PROMPT_COMMAND=''; PS1='%s%s%s'; PS2=''; PS3=''%s"
+                  tramp-rsh-end-of-line
+                  tramp-end-of-output
+                  tramp-rsh-end-of-line
+                  tramp-rsh-end-of-line))
       (tramp-wait-for-output)
       (tramp-message
        9 "Setting remote shell prompt...done")
@@ -5690,6 +5701,7 @@ Maybe the different regular expressions need to be tuned.
                   (or user (user-login-name)) host method)
     (let ((process-environment (copy-sequence process-environment)))
       (setenv "TERM" tramp-terminal-type)
+      (setenv "PROMPT_COMMAND")
       (setenv "PS1" "$ ")
       (let* ((default-directory (tramp-temporary-file-directory))
             ;; If we omit the conditional here, then we would use
@@ -5771,6 +5783,7 @@ arguments, and xx will be used as the host name to connect to.
        (setq login-args (cons "-p" (cons (match-string 2 host) login-args)))
        (setq real-host (match-string 1 host)))
       (setenv "TERM" tramp-terminal-type)
+      (setenv "PROMPT_COMMAND")
       (setenv "PS1" "$ ")
       (let* ((default-directory (tramp-temporary-file-directory))
             ;; If we omit the conditional, we would use
@@ -5823,6 +5836,7 @@ prompt than you do, so it is not at all unlikely that the variable
                   (or user "<root>") method)
     (let ((process-environment (copy-sequence process-environment)))
       (setenv "TERM" tramp-terminal-type)
+      (setenv "PROMPT_COMMAND")
       (setenv "PS1" "$ ")
       (let* ((default-directory (tramp-temporary-file-directory))
             ;; If we omit the conditional, we use `undecided-dos' in
@@ -5888,6 +5902,7 @@ log in as u2 to h2."
     (tramp-message 7 "Opening `%s' connection..." multi-method)
     (let ((process-environment (copy-sequence process-environment)))
       (setenv "TERM" tramp-terminal-type)
+      (setenv "PROMPT_COMMAND")
       (setenv "PS1" "$ ")
       (let* ((default-directory (tramp-temporary-file-directory))
             ;; If we omit the conditional, we use `undecided-dos' in
@@ -6127,10 +6142,11 @@ to set up.  METHOD, USER and HOST specify the connection."
   ;; makes it work under `rc', too.  We also unset the variable $ENV
   ;; because that is read by some sh implementations (eg, bash when
   ;; called as sh) on startup; this way, we avoid the startup file
-  ;; clobbering $PS1.
+  ;; clobbering $PS1.  $PROMP_COMMAND is another way to set the prompt
+  ;; in /bin/bash, it must be discarded as well.
   (tramp-send-command-internal
    multi-method method user host
-   (format "exec env 'ENV=' 'PS1=$ ' %s"
+   (format "exec env 'ENV=' 'PROMPT_COMMAND=' 'PS1=$ ' %s"
           (tramp-get-method-parameter
            multi-method method user host 'tramp-remote-sh))
    (format "remote `%s' to come up"
@@ -6227,7 +6243,7 @@ to set up.  METHOD, USER and HOST specify the connection."
   (setq tramp-last-cmd-time (current-time))
   (tramp-send-command
    multi-method method user host
-   (format "PS1='%s%s%s'; PS2=''; PS3=''"
+   (format "PROMPT_COMMAND=''; PS1='%s%s%s'; PS2=''; PS3=''"
           tramp-rsh-end-of-line
            tramp-end-of-output
           tramp-rsh-end-of-line))
@@ -7713,7 +7729,7 @@ Used for non-7bit chars in strings."
              (kill-region start (point)))))
        (insert "
 The buffer(s) above will be appended to this message.  If you don't want
-to append a buffer because it contains sensible data, or because the buffer
+to append a buffer because it contains sensitive data, or because the buffer
 is too large, you should delete the respective buffer.  The buffer(s) will
 contain user and host names.  Passwords will never be included there.")
 
index d265fa5393bb3686b3488fea091a35a85c285ff2..5734b5c9138e4c28f570fb6ced3daabaa64e1dc6 100644 (file)
@@ -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.56"
+(defconst tramp-version "2.0.57-pre"
   "This version of Tramp.")
 
 (defconst tramp-bug-report-address "tramp-devel@gnu.org"