From: Eli Zaretskii <eliz@gnu.org>
To: Eric Abrahamsen <eric@ericabrahamsen.net>
Cc: emacs-devel@gnu.org
Subject: Re: expand-file-name, DOS/Windows, and directory separator
Date: Tue, 15 Feb 2022 21:57:35 +0200 [thread overview]
Message-ID: <83o8373ntc.fsf@gnu.org> (raw)
In-Reply-To: <87wnhvdim4.fsf@ericabrahamsen.net> (message from Eric Abrahamsen on Tue, 15 Feb 2022 11:39:47 -0800)
> From: Eric Abrahamsen <eric@ericabrahamsen.net>
> Date: Tue, 15 Feb 2022 11:39:47 -0800
>
> >> Can I rely on that behavior?
> >
> > I'd rather you didn't. Why do you need such an assumption? Emacs on
> > Windows can cope with file names that use any style of slashes.
>
> This is code dealing with search results in Gnus, and the absolute file
> names need to be broken up so we can work on their segments. Right now
> that's done with regexps, which is ugly and fragile, and I'm just
> looking for the confidence that:
>
> (file-name-split (expand-file-name <file> "/"))
file-name-split is one of the functions that support both styles of
slashes, so you don't need to call expand-file-name at all. (And "/"
is not really an absolute file name on Windows anyway).
> Is going to return exactly the segments, no more no less, regardless of
> the system or separator type or whether there are multiple separators in
> a row, etc etc. No leftover slashes, no empty strings, all that.
>
> (Okay empty strings are fine, I guess `file-name-split' always returns
> one for absolute file names.)
It would be a bug for file-name-split (or any other file-name-*
function, really) to fail to recognize the parts of a file name
depending on the style of slashes. So if you find a case where the
results depend on the slashes, even without running the file name
through expand-file-name, please report that as a bug.
next prev parent reply other threads:[~2022-02-15 19:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-15 17:59 expand-file-name, DOS/Windows, and directory separator Eric Abrahamsen
2022-02-15 18:38 ` Stefan Monnier
2022-02-15 19:39 ` Eric Abrahamsen
2022-02-15 19:57 ` Eli Zaretskii [this message]
2022-02-15 20:15 ` Eric Abrahamsen
2022-02-15 20:24 ` Eli Zaretskii
2022-02-15 20:46 ` Eric Abrahamsen
2022-02-15 21:51 ` Stefan Monnier
2022-02-15 23:03 ` Eric Abrahamsen
2022-02-15 19:15 ` Eli Zaretskii
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=83o8373ntc.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=eric@ericabrahamsen.net \
/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.