]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix Bug#5840.
authorMichael Albinus <albinus@detlef>
Wed, 21 Apr 2010 19:48:42 +0000 (21:48 +0200)
committerMichael Albinus <albinus@detlef>
Wed, 21 Apr 2010 19:48:42 +0000 (21:48 +0200)
* icomplete.el (icomplete-completions): Use `non-essential'.

* net/tramp.el (tramp-connectable-p): New defun.
(tramp-handle-expand-file-name)
(tramp-completion-handle-file-name-all-completions)
(tramp-completion-handle-file-name-completion): Use it.

lisp/ChangeLog
lisp/icomplete.el
lisp/net/tramp.el

index 451498175cabfb82aeac9e58236a1503d191401f..ad8f74c748944019c8716f9f713e0b600e6d9971 100644 (file)
@@ -1,3 +1,14 @@
+2010-04-21  Michael Albinus  <michael.albinus@gmx.de>
+
+       Fix Bug#5840.
+
+       * icomplete.el (icomplete-completions): Use `non-essential'.
+
+       * net/tramp.el (tramp-connectable-p): New defun.
+       (tramp-handle-expand-file-name)
+       (tramp-completion-handle-file-name-all-completions)
+       (tramp-completion-handle-file-name-completion): Use it.
+
 2010-04-21  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * emacs-lisp/lisp.el (lisp-completion-at-point): Try and handle errors.
index 94822a60a63c07fb115e0f050b32fb8005cb40b5..645981539d4ff0b5afee8e83329445e4a78ca15d 100644 (file)
@@ -283,7 +283,8 @@ The displays for unambiguous matches have ` [Matched]' appended
 matches exist.  \(Keybindings for uniquely matched commands
 are exhibited within the square braces.)"
 
-  (let* ((comps (completion-all-sorted-completions))
+  (let* ((non-essential t)
+        (comps (completion-all-sorted-completions))
          (last (if (consp comps) (last comps)))
          (base-size (cdr last))
          (open-bracket (if require-match "(" "["))
index 07759e84376c6800a5606cd10b465780a9f511c0..5ba1b184bc55cd2b7268959ca0d06dbb3d9b2706 100644 (file)
@@ -4225,7 +4225,7 @@ the result will be a local, non-Tramp, filename."
   (unless (file-name-absolute-p name)
     (setq name (concat (file-name-as-directory dir) name)))
   ;; If NAME is not a Tramp file, run the real handler.
-  (if (not (tramp-tramp-file-p name))
+  (if (not (tramp-connectable-p name))
       (tramp-run-real-handler 'expand-file-name (list name nil))
     ;; Dissect NAME.
     (with-parsed-tramp-file-name name nil
@@ -5647,6 +5647,15 @@ should never be set globally, the intention is to let-bind it.")
                   (funcall (symbol-function 'event-to-character)
                            last-input-event) ?\ )))))))
 
+(defun tramp-connectable-p (filename)
+  "Check, whether it is possible to connect the remote host w/o side-effects.
+This is true, if either the remote host is already connected, or if we are
+not in completion mode."
+  (and (tramp-tramp-file-p filename)
+       (with-parsed-tramp-file-name filename nil
+        (or (get-buffer (tramp-buffer-name v))
+            (not (tramp-completion-mode-p))))))
+
 ;; Method, host name and user name completion.
 ;; `tramp-completion-dissect-file-name' returns a list of
 ;; tramp-file-name structures. For all of them we return possible completions.
@@ -5710,8 +5719,9 @@ should never be set globally, the intention is to let-bind it.")
     (append
      result1
      (condition-case nil
-        (tramp-completion-run-real-handler
-         'file-name-all-completions (list filename directory))
+        (when (tramp-connectable-p fullname)
+          (tramp-completion-run-real-handler
+           'file-name-all-completions (list filename directory)))
        (error nil)))))
 
 ;; Method, host name and user name completion for a file.
@@ -5722,7 +5732,8 @@ should never be set globally, the intention is to let-bind it.")
   (try-completion
    filename
    (mapcar 'list (file-name-all-completions filename directory))
-   (when predicate
+   (when (and predicate
+             (tramp-connectable-p (expand-file-name filename directory)))
      (lambda (x) (funcall predicate (expand-file-name (car x) directory))))))
 
 ;; I misuse a little bit the tramp-file-name structure in order to handle