unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#15419: 24.3.50; file name as directory completion problem
@ 2013-09-19 15:21 Stephen Berman
       [not found] ` <handler.15419.B.137960413312666.ack@debbugs.gnu.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen Berman @ 2013-09-19 15:21 UTC (permalink / raw)
  To: 15419

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 xfq.free@gmail.com-20130912122217-i1l0xo8mslcti8bu
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





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-05-14 20:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-19 15:21 bug#15419: 24.3.50; file name as directory completion problem Stephen Berman
     [not found] ` <handler.15419.B.137960413312666.ack@debbugs.gnu.org>
2014-05-07 20:46   ` Stephen Berman
2014-05-08  0:53     ` Stefan Monnier
2014-05-08 14:51       ` Stephen Berman
2014-05-10 21:24         ` Stephen Berman
     [not found]           ` <877g5r5tab.fsf@rosalinde.fritz.box>
     [not found]             ` <jwva9akwh03.fsf-monnier+emacsbugs@gnu.org>
     [not found]               ` <87a9akxheh.fsf@rosalinde.fritz.box>
2014-05-14 20:40                 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).