Subject: bug#58364: [PATCH] Add new function 'file-name-parent-p'

From: Philip Kaludercic <[email-masked]>
Date: Sat, 08 Oct 2022 10:29:23 +0000

Eli Zaretskii <[email-masked]> writes:

>> From: Philip Kaludercic <[email-masked]>
>> Cc: [email-masked]
>> Date: Sat, 08 Oct 2022 09:23:40 +0000
>> 
>> > But perhaps our take from this is that file-in-directory-p is not
>> > discoverable enough?  Can you describe how and where you looked for
>> > this functionality?  Maybe if we know that, we could make some changes
>> > to have this function pop up in similar searches.
>> 
>> I used M-x apropos-command "file parent" tried to find something in
>> (elisp) File Names.  I now see that the function is documented under
>> (elisp) Truenames, which appears unintuitive to me.  My guess is that
>> had I seen the function name mentioned somewhere, I would have read over
>> it since it sounds like a function that checks for "direct entries" in a
>> directory.
>
> I think a better place is in "Contents of Directories", since
> locate-dominating-file is already there.  

I agree, sounds good.

>                                           More importantly, what index
> entries should we have for this function to make its discovery easier?
> Something like "@cindex parent directory of file", perhaps?

Drew brought up the word "ancestor", which might also be a word that
people would use to find such a function.

> For apropos, how about changing the doc string to say this instead:
>
>   Return non-nil if DIR is a parent directory of FILE.
>
>   Value is non-nil if FILE is inside DIR or inside a subdirectory of
>   DIR.  A directory is considered to be a "parent" of itself.
>
>   Dir must be an existing directory, otherwise the function returns
    ^
    shouldn't this be "DIR"?
    
>   nil.

Sounds good otherwise.