GNU bug report logs - #59674
28.2; icomplete-force-complete Incorrectly Completes Filename Case

Previous Next

Package: emacs;

Reported by: Cameron Norton <cameron.norton <at> gmail.com>

Date: Tue, 29 Nov 2022 09:46:03 UTC

Severity: normal

Found in version 28.2

To reply to this bug, email your comments to 59674 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#59674; Package emacs. (Tue, 29 Nov 2022 09:46:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Cameron Norton <cameron.norton <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 29 Nov 2022 09:46:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Cameron Norton <cameron.norton <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.2; icomplete-force-complete Incorrectly Completes Filename Case
Date: Mon, 28 Nov 2022 19:55:06 -0800
Using icomplete, I often navigate to certain files by using a single
character for each component of the path name before completing with
icomplete-force-complete, which I have bound to <tab> while in the
minibuffer. So a file

./foo/bar/baz/asdf.txt

would be visited via the sequence

C-x C-f f/b/b/a <tab> <return>

Using icomplete-force-complete this way emulates the <tab> behavior in
completion packages like Vertico without the extra dependency.

However, with completion case sensitivity disabled, this sometimes
results in the file's path being completed incorrectly with regards to
capitalization. This is very noticeable when finding files in the usual
subdirectories of $HOME, with ~/doc <tab> completing to ~/documents/
rather than ~/Documents/, for example.

I can consistently reproduce this behavior through these steps. I have
done this on both my usual Emacs 28.2 as well as the git master
(currently 7939184).

 1. Start a clean emacs via emacs -Q.

 2. Evaluate the following:
      (icomplete-mode)
      (setq read-file-name-completion-ignore-case t)

 3. Navigate to some subdirectory of $HOME via M-x cd or equivalent.

 4. Start using C-x C-f to find a file in a different subdirectory of
    $HOME. The target file should be located in a subdirectory that
    starts with a capital letter (e.g. start finding something under
    ~/Documents somewhere).

 5. Enter the file's pathname relative to the home directory (starting
    with ~/) or an abbreviation like above using all lowercase
    letters. Do not use any completion while doing so, and do not clear
    the minibuffer of the current non-home directory beforehand.

 6. Complete the whole filename using icomplete-force-complete, which is
    bound to C-M-i by default.

An example run on my machine has me cd to ~/Downloads

M-x cd <return> ~/Downloads <return>

then try to find the file ~/Documents/Misc/asdf.org by entering

C-x C-f ~/d/m/a C-M-i

This instead completes to ~/documents/Misc/asdf.org, with "Documents"
uncapitalized but the other components completing with proper
capitalization.

(Apologies if this sent twice, I'm having unrelated technical issues.)

Cameron Norton

---

In GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.34, cairo version 1.17.6)
 of 2022-09-12 built on frederik
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Arch Linux

Configured using:
 'configure --with-x-toolkit=gtk3 --with-native-compilation
 --sysconfdir=/etc --prefix=/usr --libexecdir=/usr/lib
 --localstatedir=/var --with-cairo --with-harfbuzz --with-libsystemd
 --with-modules 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt
 -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security
 -fstack-clash-protection -fcf-protection -g
 -ffile-prefix-map=/build/emacs/src=/usr/src/debug -flto=auto'
 'LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -flto=auto''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
X11 XDBE XIM XPM GTK3 ZLIB

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

Major mode: ELisp/d

Minor modes in effect:
  icomplete-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-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
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny rfc822 mml mml-sec epa
derived epg rfc6068 epg-config gnus-util rmail vc-git diff-mode
vc-dispatcher mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail org-element avl-tree generator
ol-rmail ol-mhe ol-irc ol-info rmail-loaddefs auth-source eieio
eieio-core eieio-loaddefs password-cache rfc2047 rfc2045 ietf-drums
text-property-search mail-utils mm-util mail-prsvr wid-edit ol-docview
doc-view jka-compr image-mode exif dired dired-loaddefs ol-bibtex
ol-bbdb ol-w3m ol-doi org-link-doi org ob ob-tangle ob-ref ob-lob
ob-table ob-exp org-macro org-footnote org-src ob-comint org-pcomplete
pcomplete comint ansi-color ring org-list org-faces org-entities
noutline outline easy-mmode org-version ob-emacs-lisp ob-core ob-eval
org-table oc-basic json map bibtex iso8601 time-date ol org-keys oc
org-compat advice org-macs org-loaddefs format-spec find-func cal-menu
calendar cal-loaddefs icomplete comp comp-cstr warnings subr-x rx cl-seq
cl-macs cl-extra help-mode seq byte-opt gv cl-loaddefs cl-lib bytecomp
byte-compile cconv iso-transl tooltip eldoc paren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode 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 lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer 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 emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit x multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 182238 12573)
 (symbols 48 17422 0)
 (strings 32 55330 1555)
 (string-bytes 1 1877711)
 (vectors 16 29245)
 (vector-slots 8 520890 14491)
 (floats 8 109 254)
 (intervals 56 630 0)
 (buffers 992 14))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59674; Package emacs. (Tue, 29 Nov 2022 13:29:01 GMT) Full text and rfc822 format available.

Message #8 received at 59674 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Cameron Norton <cameron.norton <at> gmail.com>
Cc: 59674 <at> debbugs.gnu.org
Subject: Re: bug#59674: 28.2;
 icomplete-force-complete Incorrectly Completes Filename Case
Date: Tue, 29 Nov 2022 15:28:43 +0200
> From: Cameron Norton <cameron.norton <at> gmail.com>
> Date: Mon, 28 Nov 2022 19:55:06 -0800
> 
> 
> Using icomplete, I often navigate to certain files by using a single
> character for each component of the path name before completing with
> icomplete-force-complete, which I have bound to <tab> while in the
> minibuffer. So a file
> 
> ./foo/bar/baz/asdf.txt
> 
> would be visited via the sequence
> 
> C-x C-f f/b/b/a <tab> <return>
> 
> Using icomplete-force-complete this way emulates the <tab> behavior in
> completion packages like Vertico without the extra dependency.
> 
> However, with completion case sensitivity disabled, this sometimes
> results in the file's path being completed incorrectly with regards to
> capitalization. This is very noticeable when finding files in the usual
> subdirectories of $HOME, with ~/doc <tab> completing to ~/documents/
> rather than ~/Documents/, for example.

I cannot reproduce what you describe.  I see a completely different
behavior: as soon as I type ~/d/m M-C-i, ~/Documents disappears from the
completions, and I see only ~/dir/moo ("dir" is another directory I have
under my home directory).

So I'm not sure why you see what you see: perhaps there's some step missing
in the recipe?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59674; Package emacs. (Tue, 29 Nov 2022 14:24:01 GMT) Full text and rfc822 format available.

Message #11 received at 59674 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 59674 <at> debbugs.gnu.org, Cameron Norton <cameron.norton <at> gmail.com>
Subject: Re: bug#59674: 28.2; icomplete-force-complete Incorrectly Completes
 Filename Case
Date: Tue, 29 Nov 2022 14:23:47 +0000
>
> I cannot reproduce what you describe.  I see a completely different 
> behavior: as soon as I type ~/d/m M-C-i, ~/Documents disappears from the 
> completions, and I see only ~/dir/moo ("dir" is another directory I have 
> under my home directory).
>
> So I'm not sure why you see what you see: perhaps there's some step 
> missing in the recipe?
>

The recipe is not incomplete, but it must be followed very carefully (it's 
really a corner case):

mkdir -p ~/Zack/foo/bar ~/zock
echo baz > ~/Zack/foo/bar/baz.txt
emacs -Q
M-x icomplete-mode RET
M-: (setq read-file-name-completion-ignore-case t) RET
M-x cd ~/zock RET
C-x C-f ~/z/f/b/b ;; only type these characters, with only lower case letters
;; at that point you should see this in the minibuffer:
;; Find file: ~/zock/~/z/f/b/b[...ack/foo/bar/baz.txt] [Matched]
C-M-i
;; now you see:
;; Find file: ~/zock/~/zack/foo/bar/baz.txt[...ack/foo/bar/baz.txt] [Matched]
RET
;; the above baz.txt file is not opened, instead a new empty file is created, and you see:
;; Use M-x make-directory RET RET to create the directory and its parent




This bug report was last modified 1 year and 359 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.