[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Add a predicate for canonical file name
From: |
Eli Zaretskii |
Subject: |
Re: Add a predicate for canonical file name |
Date: |
Mon, 12 Sep 2016 20:13:27 +0300 |
> From: Tino Calancha <address@hidden>
> Date: Mon, 12 Sep 2016 17:23:03 +0900 (JST)
> Cc: address@hidden
>
> i dont see in Emacs a predicate for a file name being canonical.
Keeping in mind that just running a file name through expand-file-name
will guarantee an absolute (and "canonical") file name as result, what
problem would such a predicate solve that invoking expand-file-name
doesn't? Especially given that your implementation calls
expand-file-name anyway?
> We have a predicate for absolute file names, `file-name-absolute-p'.
I personally never had a problem with the notion of "absolute file
name". Yes, file names like "~/foo/bar" and "~user/foo" cause
file-name-absolute-p to return non-nil, but this is so obscure and
marginal feature that I doubt many Lisp programmers even remember
that.
> (defsubst myfile-name-canonical-p (filename)
> "Return non-nil if FILENAME specifies an absolute canonical file name."
> (string= filename (expand-file-name filename)))
Using string= here will cause false negatives, e.g. with Windows file
names that use backslashes vs forward slashes, or due to letter-case
differences on case-insensitive file systems. Did you really mean
that?
But anyway, the need for this is not clear to me.
Thanks.