Subject: 26.0.91; shell mode completion sometimes fails to complete

From: Mike Kupfer <[email-masked]>
Date: Sat, 27 Jan 2018 11:22:09 -0800

Assume $HOME/Desktop exists and has some files in it.

>From emacs -Q:

  M-x shell<RET>
  ls Desk<TAB>

This completes to give me

  ls Desktop/

Fine so far.  I press RET and start a new command.

  gzip Desk<TAB>

I expect this to complete as well.  It does not.  Instead I get an error
message "No match".

I suspect that the completion code is trying to be clever, figuring that
directories are not compressable, so "gzip Desktop" would not make
sense.  But this just gets in the way if what I want to compress is a
file in Desktop.

Ideally, Emacs would work as I expect out of the box.  I'd settle for a
configuration option, but I've been unable to find anything relevant.

- "C-h k" in the shell buffer tells me that TAB is bound to
  completion-at-point, and that I should look at
  completion-at-point-functions.  "M-: completion-at-point-functions"
  gives me "(comint-completion-at-point t)".  "C-h f
  comint-completion-at-point" gives me "Not documented".

- The "Shell Options" Info page describes a few variables to control
  completion, but none of them seem relevant here.

I get the same behavior with Emacs 25.3, so this is not a regression.

In GNU Emacs 26.0.91 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw scroll bars)
 of 2018-01-27 built on alto
Windowing system distributor 'The X.Org Foundation', version 11.0.11902000
System Description:	Debian GNU/Linux 9.3 (stretch)

Recent messages:
Creating customization items...
Creating group...
Creating group entries...done
Creating customization items ...done
Resetting customization items...done
Creating customization setup...done
You can run the command ‘customize-group’ with M-x cu-g RET
Creating customization setup...done
Type "q" in help window to delete it
Mark saved where search started

Configured features:
XPM JPEG TIFF GIF PNG SOUND NOTIFY GNUTLS LIBXML2 FREETYPE LIBOTF XFT
ZLIB TOOLKIT_SCROLL_BARS LUCID X11

Important settings:
  value of $LC_TIME: C
  value of $LANG: en_US.utf8
  locale-coding-system: utf-8-unix

Major mode: Info

Minor modes in effect:
  shell-dirtrack-mode: t
  delete-selection-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow mh-mime mh-identity mh-tool-bar mh-letter mh-show goto-addr
gnus-cite gnus-art mm-uu mml2015 mh-xface mh-utils mh-comp mh-scan
mh-gnus mm-view mml-smime smime dig mailcap mh-e mh-compat mh-buffers
mh-loaddefs emacsbug pp cus-edit cus-start cus-load apropos eieio-opt
speedbar sb-image ezimage dframe cl-extra cl-print thingatpt help-fns
radix-tree help-mode misearch multi-isearch info pcmpl-unix pcmpl-gnu
org-rmail org-mhe org-irc org-info org-gnus nnir gnus-sum gnus-group
gnus-undo gnus-start gnus-cloud nnimap nnmail mail-source tls gnutls
utf7 netrc nnoo parse-time gnus-spec gnus-int gnus-range gnus-win gnus
nnheader wid-edit mdk-mail smtpmail auth-source eieio eieio-core cl-macs
eieio-loaddefs sendmail message rmc puny seq byte-opt gv bytecomp
byte-compile cconv rfc822 mml mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr
mailabbrev mail-utils gmm-utils mailheader org-docview doc-view
jka-compr image-mode dired dired-loaddefs org-bibtex bibtex org-bbdb
org-w3m org-element cl-seq avl-tree generator org org-macro org-footnote
org-pcomplete org-list org-faces org-entities org-version ob-emacs-lisp
ob ob-tangle org-src ob-ref ob-lob ob-table ob-keys ob-exp ob-comint
ob-core ob-eval org-compat org-macs org-loaddefs format-spec find-func
cal-menu calendar cal-loaddefs elec-pair server noutline outline
easy-mmode cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align
cc-engine cc-vars cc-defs shell pcomplete comint ansi-color ring xcscope
easymenu advice delsel vc cl-loaddefs cl-lib vc-dispatcher timeclock
mdk-hacks time-date mule-util tooltip eldoc electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core term/tty-colors frame cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote inotify dynamic-setting
font-render-setting x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 325256 25534)
 (symbols 48 39819 3)
 (miscs 40 392 502)
 (strings 32 97268 2583)
 (string-bytes 1 2999025)
 (vectors 16 38275)
 (vector-slots 8 770204 19326)
 (floats 8 311 82)
 (intervals 56 9403 0)
 (buffers 992 22))