[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master e315544: ; * src/fileio.c (Fdirectory_append): Doc fix.
From: |
Michael Albinus |
Subject: |
Re: master e315544: ; * src/fileio.c (Fdirectory_append): Doc fix. |
Date: |
Sun, 25 Jul 2021 09:59:44 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Lars Ingebrigtsen <larsi@gnus.org> writes:
>>>> I would expect "foo/bar", meaning that all leading slashes in COMPONENTS
>>>> are removed.
>>>
>>> Well, I think that's over into DWIM-land again (which is what
>>> expand-file-name does, and this function deliberately doesn't do).
>>
>> expand-file-name and file-name-as-directory are functions which call a
>> handler, for example Tramp. directory-append is much cheaper, and if it
>> could do this string handling, I could avoid those functions. It would
>> be more performant.
>
> The reason `directory-append' is useful as a function at all (instead of
> just using `concat') is that we're very vague about the difference
> between a directory name and a file name in Emacs. That is, we treat
> "/tmp/" and "/tmp" as equivalent in more than 99% of cases when dealing
> with directories. This has naturally led to people setting
> `foo-directory' variables etc to something ending with a slash or not
> arbitrarily, which again means that you can't just use `concat' to
> construct file names.
>
> But "/bar.txt" does not happen naturally as a leaf file name, so I think
> it'd be counter-productive to have `directory-append' do anything
> particular about the start of file name components.
So (file-name-concat x y) is roughly equivalent to
(let (file-name-handler-alist)
(concat (file-name-as-directory x) y))
Perhaps this could be mentioned somewhere in the manual? This would also
precise, that leading slashes in COMPONENTS are kept.
Best regards, Michael.
- Re: master e315544: ; * src/fileio.c (Fdirectory_append): Doc fix., (continued)
- Re: master e315544: ; * src/fileio.c (Fdirectory_append): Doc fix., Lars Ingebrigtsen, 2021/07/25
- Re: master e315544: ; * src/fileio.c (Fdirectory_append): Doc fix., Stefan Monnier, 2021/07/25
- Re: master e315544: ; * src/fileio.c (Fdirectory_append): Doc fix., Lars Ingebrigtsen, 2021/07/25
- Re: master e315544: ; * src/fileio.c (Fdirectory_append): Doc fix., Kévin Le Gouguec, 2021/07/25
- Re: master e315544: ; * src/fileio.c (Fdirectory_append): Doc fix., Lars Ingebrigtsen, 2021/07/25
- Re: master e315544: ; * src/fileio.c (Fdirectory_append): Doc fix., Andreas Schwab, 2021/07/25
- Re: master e315544: ; * src/fileio.c (Fdirectory_append): Doc fix., Kévin Le Gouguec, 2021/07/25
- Re: master e315544: ; * src/fileio.c (Fdirectory_append): Doc fix., Lars Ingebrigtsen, 2021/07/28
- Re: master e315544: ; * src/fileio.c (Fdirectory_append): Doc fix., Michael Albinus, 2021/07/28
- Re: master e315544: ; * src/fileio.c (Fdirectory_append): Doc fix., Lars Ingebrigtsen, 2021/07/30
- Re: master e315544: ; * src/fileio.c (Fdirectory_append): Doc fix.,
Michael Albinus <=
- Re: master e315544: ; * src/fileio.c (Fdirectory_append): Doc fix., Lars Ingebrigtsen, 2021/07/28
- Re: master e315544: ; * src/fileio.c (Fdirectory_append): Doc fix., Michael Albinus, 2021/07/28