Subject: bug#9793: 24.0.90; Unwanted tramp connection on eshell completion.

From: Michael Albinus <[email-masked]>
Date: Sat, 22 Oct 2011 11:39:45 +0200

Stefan Monnier <[email-masked]> writes:

>> Because you didn't load tramp.
>> Connect first to your "trex" or anything else, then close this, and run
>> eshell and retry the above.
>> For me too, if i start emacs -Q and i go strait to eshell, all work fine.
>
> Ah, I see, I can reproduce it now:
>
>    % emacs -Q
>    M-x load-library RET tramp RET
>    M-x eshell RET
>    cd /t TAB
>
> At that point, Tramp tried to connect to `tic' and to `tequila' (the
> hosts mentioned in ~/.ssh/known_hosts that start with `t').

`pcomplete-dirs' uses `file-directory-p' as predicate, which is applied
to all completion candidates. The following patch ought to fix it:

--8<---------------cut here---------------start------------->8---
*** /home/albinus/src/emacs/lisp/pcomplete.el.~106161~	2011-10-22 11:31:11.996458454 +0200
--- /home/albinus/src/emacs/lisp/pcomplete.el	2011-10-22 11:30:20.796204566 +0200
***************
*** 948,954 ****
  
  (defsubst pcomplete-dirs (&optional regexp)
    "Complete amongst a list of directories."
!   (pcomplete-entries regexp 'file-directory-p))
  
  ;; generation of completion lists
  
--- 948,957 ----
  
  (defsubst pcomplete-dirs (&optional regexp)
    "Complete amongst a list of directories."
!   (pcomplete-entries regexp
! 		     (lambda (dir)
! 		       (or (file-remote-p (expand-file-name dir))
! 			   (file-directory-p dir)))))
  
  ;; generation of completion lists
  
--8<---------------cut here---------------end--------------->8---

Comments?

>         Stefan

Best regards, Michael.