all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stephen Berman <stephen.berman@gmx.net>
To: 15419@debbugs.gnu.org
Subject: bug#15419: 24.3.50; file name as directory completion problem
Date: Thu, 19 Sep 2013 17:21:33 +0200	[thread overview]
Message-ID: <87pps44z2a.fsf@rosalinde.fritz.box> (raw)

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





             reply	other threads:[~2013-09-19 15:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-19 15:21 Stephen Berman [this message]
     [not found] ` <handler.15419.B.137960413312666.ack@debbugs.gnu.org>
2014-05-07 20:46   ` bug#15419: 24.3.50; file name as directory completion problem 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pps44z2a.fsf@rosalinde.fritz.box \
    --to=stephen.berman@gmx.net \
    --cc=15419@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.