bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#57102: 29.0.50; Peculiar file-name-split edge case


From: Lars Ingebrigtsen
Subject: bug#57102: 29.0.50; Peculiar file-name-split edge case
Date: Mon, 15 Aug 2022 07:54:34 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Philip Kaludercic <philipk@posteo.net> writes:

> Grepping through emacs.git to see where file-name-split is used, it
> seems that all it would change in most cases you'd just require an
> additional (cdr ...).  At the same time, there is already an instance in
> gnus-search.el that deals with the issue I brought up with the empty
> strings.

Stepping back a bit, the use case for file-name-split is basically "give
me the components of this file name", but it's trying to return
something that can unambiguously be put back together again to get to
the original string.  Perhaps that's misguided, and the interpretation
of the result be left up to the caller.

That is, perhaps what we want is

(file-name-split "a/b")
=> '("a" "b")

(file-name-split "a/b/")
=> '("a" "b")

(file-name-split "/a/b")
=> '("a" "b")

(file-name-split "//a////b////")
=> '("a" "b")

I'm not sure what

(file-name-split "c:/a/b")

on Windows should return in that case, though.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]