unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: philipk@posteo.net, 57102@debbugs.gnu.org
Subject: bug#57102: 29.0.50; Peculiar file-name-split edge case
Date: Wed, 17 Aug 2022 12:55:11 +0200	[thread overview]
Message-ID: <87o7wjjg1c.fsf@gnus.org> (raw)
In-Reply-To: <83ilmtivsv.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 15 Aug 2022 14:35:28 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>> (file-name-split "/a/b")
>> => '("a" "b")
>
> This should return '("/" "a" "b"), or '("/a" "b")  I think.
>
>> (file-name-split "//a////b////")
>> => '("a" "b")
>
> And this should return '("/" "a" "b" "/"), or '("/a" "b/").
>
>> I'm not sure what
>> 
>> (file-name-split "c:/a/b")
>> 
>> on Windows should return in that case, though.
>
> If you agree with the above, then '("c:/" "a" "b").
>
> If you don't care about the root directory, then '("a" "b")
> (a.k.a. "leave the interpretation to the caller").

I'm not at all sure, and perhaps we should have two different functions
here for the two different use cases that I think this function has.

The use cases, as I see it, are

1) "I just want to know which bits are in the path".  This is used by
dabbrev, which wants to add "a" and "b" here to the abbrevs.  In that
case, "c:/" is not what it wants.

2) "I need to perform some operation on each segment and then put the
file name back together again".  This is what browse-url does -- it
wants to %-encode each segment, but not the "/"s, so it wants to
preserve the absolute/relative distinction.  (But it needs to know that
the "c:/" part is not something to be encoded anyway.)  In that case, I
think we want '("/" "a" "b") and '("c:/" "a" "b").

So perhaps file-name-split should keep the current semantics (but the
bugs identified should be fixed) for 2), but we could add a new function
(or optional parameter) for 1) which would leave "/"/"c:/" off.





  reply	other threads:[~2022-08-17 10:55 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-10  8:24 bug#57102: 29.0.50; Peculiar file-name-split edge case Philip Kaludercic
2022-08-12 15:35 ` Lars Ingebrigtsen
2022-08-12 15:56   ` Philip Kaludercic
2022-08-12 15:59     ` Lars Ingebrigtsen
2022-08-12 16:29       ` Philip Kaludercic
2022-08-13 11:44         ` Lars Ingebrigtsen
2022-08-13 13:24           ` Philip Kaludercic
2022-08-15  5:54             ` Lars Ingebrigtsen
2022-08-15 11:28               ` Lars Ingebrigtsen
2022-08-15 15:57                 ` Philip Kaludercic
2022-08-15 11:35               ` Eli Zaretskii
2022-08-17 10:55                 ` Lars Ingebrigtsen [this message]
2022-08-13 18:06           ` Augusto Stoffel
2022-08-14  6:24             ` Philip Kaludercic
2022-08-13 17:08 ` Mattias Engdegård
2022-09-25 12:06   ` Stefan Kangas
2022-09-26 10:41     ` Lars Ingebrigtsen
2022-09-26 11:14       ` Stefan Kangas
2022-09-26 11:59         ` Lars Ingebrigtsen
2022-09-26 12:07         ` Mattias Engdegård
2022-09-26 12:27           ` Gregory Heytings
2022-09-29  3:02             ` Richard Stallman
2022-09-29  6:20               ` 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

  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=87o7wjjg1c.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=57102@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=philipk@posteo.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 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).