bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#15419: 24.3.50; file name as directory completion problem


From: Stephen Berman
Subject: bug#15419: 24.3.50; file name as directory completion problem
Date: Thu, 19 Sep 2013 17:21:33 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

By default, file name completion adds `/' only if needed, e.g. given the
file name "~/test/bla/abc", if I type `C-x C-f ~/test/bla/abc' and in
the minibuffer delete either "a" or "a/" after "bl", in both case TAB
correctly completes to "~/test/bla/abc" -- unless you do the following:

1. emacs -Q
2. M-c customize-option RET completion-category-overrides RET, press INS
   to add a new category, choose "file" from the Value Menu. check
   Completion Styles, press INS and choose "substring" from the Value
   Menu, press State and choose "Set for Current Session".
3. Now if I type `C-x C-f ~/test/bla/abc' and in the minibuffer delete
   "a/" after "bl", TAB again correctly completes to "~/test/bla/abc",
   but if I delete just "a" after "bl", TAB incorrectly completes to
   "~/test/bla//abc".

I think what is happening is that when completion-category-overrides is
set as above, this makes completion-file-name-table call
file-name-all-completions, which calls file_name_completion (dired.c),
which, if the file is a directory, calls Ffile_name_as_directory
(fileio.c), which unconditionally adds `/' to the file name.  (Without
the file override, completion-file-name-table does not call
file-name-all-completions in the above test case, but completes when (eq
action 'lambda).)  It looks like this could be fixed by adding a
condition to the following code from file_name_completion to the effect
that in the absolute file name containing `name', the next character
after the last character in `name' is not `/'; but I don't know how to
do this in Emacs C.

      if (directoryp)
        /* This completion is a directory; make it end with '/'.  */
        name = Ffile_name_as_directory (name);


In GNU Emacs 24.3.50.4 (x86_64-suse-linux-gnu, GTK+ Version 3.4.4)
 of 2013-09-12 on rosalinde
Bzr revision: 114244 address@hidden
Windowing system distributor `The X.Org Foundation', version 11.0.11203000
System Description:     openSUSE 12.2 (x86_64)

Configured using:
 `configure --without-toolkit-scroll-bars 'CFLAGS=-g3 -O0''

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=local
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t





reply via email to

[Prev in Thread] Current Thread [Next in Thread]