* bug#43375: 26.1: file-directory-p returns t for empty string
@ 2020-09-13 12:47 Boruch Baum
2020-09-13 13:06 ` Andreas Schwab
0 siblings, 1 reply; 9+ messages in thread
From: Boruch Baum @ 2020-09-13 12:47 UTC (permalink / raw)
To: 43375
I was expecting the follow to return nil, but it returns t
(file-directory-p "")
--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#43375: 26.1: file-directory-p returns t for empty string
2020-09-13 12:47 bug#43375: 26.1: file-directory-p returns t for empty string Boruch Baum
@ 2020-09-13 13:06 ` Andreas Schwab
2020-09-13 13:34 ` Lars Ingebrigtsen
2020-09-13 14:39 ` Boruch Baum
0 siblings, 2 replies; 9+ messages in thread
From: Andreas Schwab @ 2020-09-13 13:06 UTC (permalink / raw)
To: Boruch Baum; +Cc: 43375
On Sep 13 2020, Boruch Baum wrote:
> I was expecting the follow to return nil, but it returns t
>
> (file-directory-p "")
This is not a bug, as Emacs always works with expanded and canonicalized
file names (the result of applying expand-file-name).
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#43375: 26.1: file-directory-p returns t for empty string
2020-09-13 13:06 ` Andreas Schwab
@ 2020-09-13 13:34 ` Lars Ingebrigtsen
2020-09-13 14:40 ` Boruch Baum
2020-09-13 14:39 ` Boruch Baum
1 sibling, 1 reply; 9+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-13 13:34 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Boruch Baum, 43375
Andreas Schwab <schwab@linux-m68k.org> writes:
>> I was expecting the follow to return nil, but it returns t
>>
>> (file-directory-p "")
>
> This is not a bug, as Emacs always works with expanded and canonicalized
> file names (the result of applying expand-file-name).
Yup. It should be documented, though, so I've now mentioned this quirk
in the doc string in Emacs 28.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#43375: 26.1: file-directory-p returns t for empty string
2020-09-13 13:34 ` Lars Ingebrigtsen
@ 2020-09-13 14:40 ` Boruch Baum
0 siblings, 0 replies; 9+ messages in thread
From: Boruch Baum @ 2020-09-13 14:40 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: Andreas Schwab, 43375
Thanks
On 2020-09-13 15:34, Lars Ingebrigtsen wrote:
> Andreas Schwab <schwab@linux-m68k.org> writes:
>
> > This is not a bug, as Emacs always works with expanded and canonicalized
> > file names (the result of applying expand-file-name).
>
> Yup. It should be documented, though, so I've now mentioned this quirk
> in the doc string in Emacs 28.
>
--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#43375: 26.1: file-directory-p returns t for empty string
2020-09-13 13:06 ` Andreas Schwab
2020-09-13 13:34 ` Lars Ingebrigtsen
@ 2020-09-13 14:39 ` Boruch Baum
2020-09-13 15:01 ` Eli Zaretskii
2020-09-13 15:56 ` Andreas Schwab
1 sibling, 2 replies; 9+ messages in thread
From: Boruch Baum @ 2020-09-13 14:39 UTC (permalink / raw)
To: Andreas Schwab; +Cc: 43375
On 2020-09-13 15:06, Andreas Schwab wrote:
> On Sep 13 2020, Boruch Baum wrote:
>
> > I was expecting the follow to return nil, but it returns t
> >
> > (file-directory-p "")
>
> This is not a bug, as Emacs always works with expanded and canonicalized
> file names (the result of applying expand-file-name).
Then the docstring could be clearer and say "Return t if the expansion
of FILENAME names an existing directory" instead of simply the current
"Return t if FILENAME names an existing directory". Would that be an
acceptable change?
--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#43375: 26.1: file-directory-p returns t for empty string
2020-09-13 14:39 ` Boruch Baum
@ 2020-09-13 15:01 ` Eli Zaretskii
2020-09-13 16:29 ` Boruch Baum
2020-09-13 15:56 ` Andreas Schwab
1 sibling, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2020-09-13 15:01 UTC (permalink / raw)
To: Boruch Baum; +Cc: schwab, 43375
> Date: Sun, 13 Sep 2020 10:39:43 -0400
> From: Boruch Baum <boruch_baum@gmx.com>
> Cc: 43375@debbugs.gnu.org
>
> > > (file-directory-p "")
> >
> > This is not a bug, as Emacs always works with expanded and canonicalized
> > file names (the result of applying expand-file-name).
>
> Then the docstring could be clearer and say "Return t if the expansion
> of FILENAME names an existing directory"
That's not a useful doc string, because "expansion of FILENAME" is not
well defined, and is not easy to describe.
I'm okay with making the doc string more clear, but let's please think
about a more useful amendment. A doc string should help the user
understand what will/did happen, it shouldn't present puzzles.
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#43375: 26.1: file-directory-p returns t for empty string
2020-09-13 15:01 ` Eli Zaretskii
@ 2020-09-13 16:29 ` Boruch Baum
2020-09-13 16:47 ` Eli Zaretskii
0 siblings, 1 reply; 9+ messages in thread
From: Boruch Baum @ 2020-09-13 16:29 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: schwab, 43375
On 2020-09-13 18:01, Eli Zaretskii wrote:
> > Date: Sun, 13 Sep 2020 10:39:43 -0400
> > From: Boruch Baum <boruch_baum@gmx.com>
> > Cc: 43375@debbugs.gnu.org
> >
> > > > (file-directory-p "")
> > >
> > > This is not a bug, as Emacs always works with expanded and canonicalized
> > > file names (the result of applying expand-file-name).
> >
> > Then the docstring could be clearer and say "Return t if the expansion
> > of FILENAME names an existing directory"
>
> That's not a useful doc string, because "expansion of FILENAME" is not
> well defined, and is not easy to describe.
>
> I'm okay with making the doc string more clear, but let's please think
> about a more useful amendment. A doc string should help the user
> understand what will/did happen, it shouldn't present puzzles.
How about:
Return t if evaluating `expand-file-name' on FILENAME names an existing
directory.
--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#43375: 26.1: file-directory-p returns t for empty string
2020-09-13 16:29 ` Boruch Baum
@ 2020-09-13 16:47 ` Eli Zaretskii
0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2020-09-13 16:47 UTC (permalink / raw)
To: Boruch Baum; +Cc: schwab, 43375
> Date: Sun, 13 Sep 2020 12:29:00 -0400
> From: Boruch Baum <boruch_baum@gmx.com>
> Cc: schwab@linux-m68k.org, 43375@debbugs.gnu.org
>
> > I'm okay with making the doc string more clear, but let's please think
> > about a more useful amendment. A doc string should help the user
> > understand what will/did happen, it shouldn't present puzzles.
>
> How about:
>
> Return t if evaluating `expand-file-name' on FILENAME names an existing
> directory.
How does that help the reader predict what will happen in each and
every case without actually trying?
Anyway, I think this is a moot point, since Lars already fixed the doc
string to mention this special case, and the current text is clear
enough to my palate.
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#43375: 26.1: file-directory-p returns t for empty string
2020-09-13 14:39 ` Boruch Baum
2020-09-13 15:01 ` Eli Zaretskii
@ 2020-09-13 15:56 ` Andreas Schwab
1 sibling, 0 replies; 9+ messages in thread
From: Andreas Schwab @ 2020-09-13 15:56 UTC (permalink / raw)
To: Boruch Baum; +Cc: 43375
On Sep 13 2020, Boruch Baum wrote:
> Then the docstring could be clearer and say "Return t if the expansion
> of FILENAME names an existing directory" instead of simply the current
> "Return t if FILENAME names an existing directory". Would that be an
> acceptable change?
This is already documented in the Elisp manual:
Many of the file functions take one or more arguments that are file
names. A file name is a string. Most of these functions expand file
name arguments using the function ‘expand-file-name’, so that ‘~’ is
handled correctly, as are relative file names (including ‘../’ and the
empty string). *Note File Name Expansion::.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2020-09-13 16:47 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-13 12:47 bug#43375: 26.1: file-directory-p returns t for empty string Boruch Baum
2020-09-13 13:06 ` Andreas Schwab
2020-09-13 13:34 ` Lars Ingebrigtsen
2020-09-13 14:40 ` Boruch Baum
2020-09-13 14:39 ` Boruch Baum
2020-09-13 15:01 ` Eli Zaretskii
2020-09-13 16:29 ` Boruch Baum
2020-09-13 16:47 ` Eli Zaretskii
2020-09-13 15:56 ` Andreas Schwab
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).