]> code.delx.au - gnu-emacs/blobdiff - lisp/net/tramp.el
Merge from emacs-24; up to 2012-12-06T01:39:03Z!monnier@iro.umontreal.ca
[gnu-emacs] / lisp / net / tramp.el
index c29879691d742aa3e4e6e541c2cd5b1b94d18d6d..7c393622ffc576d2fb36e96934eba36fc6169e71 100644 (file)
@@ -1455,6 +1455,11 @@ an input event arrives.  The other arguments are passed to `tramp-error'."
           (or (and (bufferp buffer) buffer)
               (and (processp vec-or-proc) (process-buffer vec-or-proc))
               (tramp-get-connection-buffer vec-or-proc)))
+         (when (string-equal fmt-string "Process died")
+           (message
+            "%s\n    %s"
+            "Tramp failed to connect.  If this happens repeatedly, try"
+            "`M-x tramp-cleanup-this-connection'"))
          (sit-for 30))))))
 
 (defmacro with-parsed-tramp-file-name (filename var &rest body)
@@ -1748,20 +1753,28 @@ value of `default-file-modes', without execute permissions."
   (or (file-modes filename)
       (logand (default-file-modes) (tramp-compat-octal-to-decimal "0666"))))
 
-(defun tramp-replace-environment-variables (filename)
-  "Replace environment variables in FILENAME.
+(defalias 'tramp-replace-environment-variables
+  (if (ignore-errors
+        (equal "${ tramp?}"
+              (tramp-compat-funcall
+               'substitute-env-vars "${ tramp?}" 'only-defined)))
+      (lambda (filename)
+        "Like `substitute-env-vars' with `only-defined' non-nil."
+        (tramp-compat-funcall 'substitute-env-vars filename 'only-defined))
+    (lambda (filename)
+      "Replace environment variables in FILENAME.
 Return the string with the replaced variables."
-  (save-match-data
-    (let ((idx (string-match "$\\(\\w+\\)" filename)))
-      ;; `$' is coded as `$$'.
-      (when (and idx
-                (or (zerop idx) (not (eq ?$ (aref filename (1- idx)))))
-                (getenv (match-string 1 filename)))
-       (setq filename
-             (replace-match
-              (substitute-in-file-name (match-string 0 filename))
-              t nil filename)))
-      filename)))
+      (save-match-data
+        (let ((idx (string-match "$\\(\\w+\\)" filename)))
+          ;; `$' is coded as `$$'.
+          (when (and idx
+                     (or (zerop idx) (not (eq ?$ (aref filename (1- idx)))))
+                     (getenv (match-string 1 filename)))
+            (setq filename
+                  (replace-match
+                   (substitute-in-file-name (match-string 0 filename))
+                   t nil filename)))
+          filename)))))
 
 ;; In XEmacs, electricity is implemented via a key map for ?/ and ?~,
 ;; which calls corresponding functions (see minibuf.el).
@@ -1871,7 +1884,8 @@ ARGS are the arguments OPERATION has been called with."
                  ;; Emacs 22+ only.
                  'set-file-times
                  ;; Emacs 24+ only.
-                 'file-selinux-context 'set-file-selinux-context
+                 'file-acl 'file-selinux-context
+                 'set-file-acl 'set-file-selinux-context
                  ;; XEmacs only.
                  'abbreviate-file-name 'create-file-buffer
                  'dired-file-modtime 'dired-make-compressed-filename
@@ -1922,10 +1936,7 @@ ARGS are the arguments OPERATION has been called with."
                   ;; Emacs 23+ only.
                   'start-file-process
                  ;; XEmacs only.
-                 'dired-print-file 'dired-shell-call-process
-                 ;; nowhere yet.
-                 'executable-find 'start-process
-                 'call-process 'call-process-region))
+                 'dired-print-file 'dired-shell-call-process))
     default-directory)
    ;; Unknown file primitive.
    (t (error "unknown file I/O primitive: %s" operation))))
@@ -2746,6 +2757,11 @@ User is always nil."
       (if (or dir-p (file-directory-p dir)) dir (file-name-directory dir)) nil
     (tramp-flush-directory-property v localname)))
 
+(defun tramp-handle-file-accessible-directory-p (filename)
+  "Like `file-accessible-directory-p' for Tramp files."
+  (and (file-directory-p filename)
+       (file-executable-p filename)))
+
 (defun tramp-handle-file-exists-p (filename)
   "Like `file-exists-p' for Tramp files."
   (not (null (file-attributes filename))))