emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r99982: Fix Bug#5840.


From: Michael Albinus
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r99982: Fix Bug#5840.
Date: Wed, 21 Apr 2010 21:48:42 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 99982
committer: Michael Albinus <address@hidden>
branch nick: trunk
timestamp: Wed 2010-04-21 21:48:42 +0200
message:
  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.
modified:
  lisp/ChangeLog
  lisp/icomplete.el
  lisp/net/tramp.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-04-21 17:53:03 +0000
+++ b/lisp/ChangeLog    2010-04-21 19:48:42 +0000
@@ -1,3 +1,14 @@
+2010-04-21  Michael Albinus  <address@hidden>
+
+       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  <address@hidden>
 
        * emacs-lisp/lisp.el (lisp-completion-at-point): Try and handle errors.

=== modified file 'lisp/icomplete.el'
--- a/lisp/icomplete.el 2010-01-13 08:35:10 +0000
+++ b/lisp/icomplete.el 2010-04-21 19:48:42 +0000
@@ -283,7 +283,8 @@
 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 "(" "["))

=== modified file 'lisp/net/tramp.el'
--- a/lisp/net/tramp.el 2010-04-21 03:02:58 +0000
+++ b/lisp/net/tramp.el 2010-04-21 19:48:42 +0000
@@ -4225,7 +4225,7 @@
   (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 @@
                   (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 @@
     (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 @@
   (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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]