Subject: 24.0.92; eshell - use pcomplete/ssh from pcmpl-unix.el
From: Mike Lamb <[email-masked]>
To: [email-masked]
Date: Wed, 18 Jan 2012 16:18:49 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

When ssh completion is used in eshell for the first time in an emacs
session, it only uses pcomplete/ssh from eshell/em-unix.el. All
subsequent ssh completions in eshell only use pcomplete/ssh defined
in pcmpl-unix.el.

pcomplete/ssh in eshell/em-unix.el is an alias to pcomplete/rsh. When
pcomplete/rsh executes it only returns the hosts contained in
/etc/hosts. When pcomplete/ssh from pcmpl-unix.el executes it returns
hosts from ~/.ssh/known_hosts (and other ssh config files).

My system only contains a few entries in /etc/hosts to configure the
loopback interface so I removed the pcomplete/ssh alias from
eshell/em-unix.el and rely only on pcomplete/ssh defined in
pcmpl-unix.el.

My workaround patch:

*** old/lisp/em-unix.el	2012-01-18 16:01:18.000000000 -0500
--- new/lisp/em-unix.el	2012-01-18 16:01:29.000000000 -0500
***************
*** 792,799 ****
    (funcall (or (pcomplete-find-completion-function (pcomplete-arg 1))
  	       pcomplete-default-completion-function)))
  
- (defalias 'pcomplete/ssh 'pcomplete/rsh)
- 
  (defvar block-size)
  (defvar by-bytes)
  (defvar dereference-links)
--- 792,797 ----

This happens to be the behavior that I expect.

In GNU Emacs 24.0.92.1 (x86_64-apple-darwin11.2.0, NS apple-appkit-1138.23)
 of 2012-01-18 on anvil.home
Windowing system distributor `Apple', version 10.3.1138
configured using `configure  '--with-ns' '--without-x''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: en_US.UTF-8
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: EShell

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x e s h <tab> <return> s s h SPC <tab> u @ <tab> 
<tab> <tab> <tab> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> M-x 
r e p o r t <tab> <return>

Recent messages:
Loading em-cmpl...done
Loading em-dirs...done
Loading em-glob...done
Loading em-hist...done
Loading em-ls...done
Loading em-prompt...done
Loading em-script...done
Loading em-term...done
Loading em-unix...done
Hit space to flush

Load-path shadows:
None found.

Features:
(shadow sort mail-extr message format-spec rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
emacsbug help-mode view pcmpl-unix ansi-color em-unix pcomplete comint
em-term term disp-table ehelp electric em-script em-prompt em-ls em-hist
em-pred em-glob em-dirs em-cmpl em-basic esh-opt em-banner em-alias ring
esh-var esh-io esh-cmd esh-ext esh-proc esh-arg eldoc help-fns
esh-groups eshell esh-module esh-mode esh-util server smtpmail
auth-source eieio byte-opt bytecomp byte-compile cconv macroexp assoc
gnus-util password-cache sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils dired-x easymenu dired regexp-opt edmacro kmacro
time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel ns-win
tool-bar dnd fontset image fringe lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind ns multi-tty emacs)