Subject: bug#32215: 27.0.50; Minibuffer completion fails with /~<partial-name>

From: Stephen Berman <[email-masked]>
Date: Thu, 19 Jul 2018 19:55:18 +0200

0. emacs -Q
1. C-x d / ~ TAB
   This pops up a *Completions* buffer showing directory names of all
   members of (system-users), e.g. steve/
2. Continuing from step 1, when I type any of 's TAB', 'st TAB', 'ste
   TAB' or 'stev TAB', Emacs responds with [No match], but 'steve TAB'
   completes to steve/

The failure only happens with '/~<partial-name>', typing e.g. '~/Downl
TAB' here completes to ~/Downloads/

I tried debugging but only got as far as completion--some; when stepping
through that after '/~stev TAB' *Messages* shows this:

  Result: (closure ((metadata metadata (category . file) (completion--unquote-requote . t)) (point . 6) (pred . file-exists-p) (table . completion-file-name-table) (string . "/~stev") (n . 1) t) (style) (funcall (nth n (assq style completion-styles-alist)) string table pred point))
   [2 times]
  Result: (substring basic partial-completion emacs22)
  
  Result: (substring basic partial-completion emacs22)
  
  Result: substring
  
  Result: nil

In contrast, with '/~steve TAB':

  Result: (closure ((metadata metadata (category . file) (completion--unquote-requote . t)) (point . 6) (pred . file-exists-p) (table . completion-file-name-table) (string . "~steve") (n . 1) t) (style) (funcall (nth n (assq style completion-styles-alist)) string table pred point))
   [2 times]
  Result: (substring basic partial-completion emacs22)
  
  Result: (substring basic partial-completion emacs22)
  
  Result: substring
  
  Result: ("~steve/" . 7)

In GNU Emacs 27.0.50 (build 6, x86_64-pc-linux-gnu, GTK+ Version 3.22.28)
 of 2018-07-18 built on rosalinde
Repository revision: 04a32fa60bead4359bc9353af67f26958c795593
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Linux From Scratch

Recent messages:
scroll-up-command: End of buffer
Contacting host: debbugs.gnu.org:443
Opening nndoc server on /tmp/gnus-temp-group-vnhsiy-ephemeral...done
Contacting host: debbugs.gnu.org:443
Opening nndoc server on /tmp/gnus-temp-group-L5CVOB-ephemeral...done
scroll-up-command: End of buffer
Contacting host: debbugs.gnu.org:443
Opening nndoc server on /tmp/gnus-temp-group-GXyYYJ-ephemeral...done
Contacting host: debbugs.gnu.org:443
Opening nndoc server on /tmp/gnus-temp-group-x4tMir-ephemeral...done

Configured using:
 'configure 'CFLAGS=-Og -g3''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GSETTINGS NOTIFY ACL
GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS
GTK3 X11 THREADS LCMS2

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