unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 15130@debbugs.gnu.org
Subject: bug#15130: 24.3.50; emacs-24.3.1 on Windows; possible `file-directory-p' bug.
Date: Tue, 20 Aug 2013 08:35:13 +0200	[thread overview]
Message-ID: <87mwoczx7i.fsf@gmail.com> (raw)
In-Reply-To: <83haellm8y.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 19 Aug 2013 18:43:25 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
>> Date: Mon, 19 Aug 2013 10:47:24 +0200
>> 
>> On windows `file-directory-p' returns t on a path with a space added at
>> end.
>> 
>> ;; windows-nt
>> (file-directory-p "c:/Program Files/emacs-24.3-bin-i386/emacs-24.3/site-lisp/")
>> t
>> (file-directory-p "c:/Program Files/emacs-24.3-bin-i386/emacs-24.3/site-lisp/ ")
>> t
>> ;; gnu/linux
>> (file-directory-p "~/.emacs.d/")
>> t
>> (file-directory-p "~/.emacs.d/ ")
>> nil
>> 
>> Is it wanted?
>
> It's wanted only if you really have a directory named " " under 
> 'c:/Program Files/emacs-24.3-bin-i386/emacs-24.3/site-lisp/' ;-)
>
> Seriously, though: this is not Emacs's fault.  There's no code in
> Emacs that removes that space from the name; we simply hand the
> (expanded) file name to the Windows API that returns file attributes,
> and if the returned attributes say it's a directory, we return t.
>
> More generally, all Win32 APIs ignore trailing whitespace in file
> names.  OTOH, it _is_ possible to create file names such as "/foo/ "
> on Windows (by using a file-name syntax that bypasses the Win32
> file-name normalization layer), so rejecting file names such as the
> one you show is not an option.  On the third hand, converting every
> file name to that syntax internally, so that we bypass the
> normalization, is a large job, whose risks are unknown, at least to
> me, and whose gains are quite small, since use cases where you trip
> upon such problems are very rare

Of course, fixing that on the emacs side is not an option.

> (can you tell what was your use case, btw?).

If I enter in minibuffer e.g "~/.emacs.d" helm detect that ".emacs.d" is
a directory, append a "/" and give completion on this directory.
When I enter in minibuffer "~/.emacs.d/ " it wait for multi regexp
completion, e.g I can enter then "~/.emacs.d/ i ni el" or 
"~/.emacs.d/ el$" to complete "init.el" or all *.el files in this directory.
On Windows, as soon I enter the trailing space, the directory (which
doesn't exists) "~/.emacs.d/ " is detected and the end slash is added to
complete against "~/.emacs.d/ /" which is unwanted.
Though hitting C-<backspace> disable this feature and allow entering a
space without instant completion.

> So I think we will have to continue living with this idiosyncrasy of
> Windows filesystems.

Yes. Thanks for explanations, probably you can close this bug.

-- 
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 





  reply	other threads:[~2013-08-20  6:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-19  8:47 bug#15130: 24.3.50; emacs-24.3.1 on Windows; possible `file-directory-p' bug Thierry Volpiatto
2013-08-19 15:43 ` Eli Zaretskii
2013-08-20  6:35   ` Thierry Volpiatto [this message]
2013-08-20  6:37   ` Thierry Volpiatto
2013-08-20 14:50     ` Eli Zaretskii
2013-08-20 11:47   ` Thierry Volpiatto
2013-08-20 14:29     ` Eli Zaretskii
2013-08-20 14:37       ` Thierry Volpiatto

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87mwoczx7i.fsf@gmail.com \
    --to=thierry.volpiatto@gmail.com \
    --cc=15130@debbugs.gnu.org \
    --cc=eliz@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 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).