[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#36490: 26.1; directory-files-recursively breaks when it encounters a
From: |
Lars Ingebrigtsen |
Subject: |
bug#36490: 26.1; directory-files-recursively breaks when it encounters a directory named "~" |
Date: |
Tue, 09 Jul 2019 19:00:13 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Eli Zaretskii <eliz@gnu.org> writes:
> Sorry, that's not what I meant to say. I meant to say how would a
> Lisp program know whether (expand-file-name "~/") means the home
> directory or a directory whose name is literally "~"?
Well, we have documented that in expand-file-name "~/" means the home
directory, and I have no problems with that.
"~/" isn't something you'll ever get from functions like
directory-files, so it's not something you'd feed to expand-file-name in
these situations...
> Btw, stuff like (expand-file-name "foo/~/") already does what you
> want, so the problem is only with the leading '~', and can be avoided
> if we avoid that situation. IOW, why should this example:
>
> (expand-file-name "~" "/tmp/")
> => "/home/larsi"
>
> determine how directory-files-recursively behaves?
expand-file-name's use case is to (basically) concatenate a directory
name and a file name, but it's used instead of concat because nobody
wants to care about whether the directory name has a trailing slash or
not.
(concat "/tmp/" "foo")
=> "/tmp/foo" ; Good
(concat "/tmp" "foo")
=> "/tmpfoo" ; Bad.
(expand-file-name "foo" "/tmp")
=> "/tmp/foo" ; Yay
That's basically the use case for expand-file-name, and using it has
avoided a lot of basic concatenation problems over the years (because
Emacs allows sloppy handling of directory file names in most
situations).
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
- bug#36490: 26.1; directory-files-recursively breaks when it encounters a directory named "~", (continued)
- bug#36490: 26.1; directory-files-recursively breaks when it encounters a directory named "~", Erik Hahn, 2019/07/08
- bug#36490: 26.1; directory-files-recursively breaks when it encounters a directory named "~", Eli Zaretskii, 2019/07/09
- bug#36490: 26.1; directory-files-recursively breaks when it encounters a directory named "~", Lars Ingebrigtsen, 2019/07/09
- bug#36490: 26.1; directory-files-recursively breaks when it encounters a directory named "~", Eli Zaretskii, 2019/07/09
- bug#36490: 26.1; directory-files-recursively breaks when it encounters a directory named "~", Lars Ingebrigtsen, 2019/07/09
- bug#36490: 26.1; directory-files-recursively breaks when it encounters a directory named "~", Eli Zaretskii, 2019/07/09
- bug#36490: 26.1; directory-files-recursively breaks when it encounters a directory named "~", Lars Ingebrigtsen, 2019/07/09
- bug#36490: 26.1; directory-files-recursively breaks when it encounters a directory named "~", Eli Zaretskii, 2019/07/09
- bug#36490: 26.1; directory-files-recursively breaks when it encounters a directory named "~",
Lars Ingebrigtsen <=
- bug#36490: 26.1; directory-files-recursively breaks when it encounters a directory named "~", Eli Zaretskii, 2019/07/09
- bug#36490: 26.1; directory-files-recursively breaks when it encounters a directory named "~", Michael Albinus, 2019/07/09
- bug#36490: 26.1; directory-files-recursively breaks when it encounters a directory named "~", Lars Ingebrigtsen, 2019/07/10
- bug#36490: 26.1; directory-files-recursively breaks when it encounters a directory named "~", Eli Zaretskii, 2019/07/10
- bug#36490: 26.1; directory-files-recursively breaks when it encounters a directory named "~", Lars Ingebrigtsen, 2019/07/11
- bug#36490: 26.1; directory-files-recursively breaks when it encounters a directory named "~", Basil L. Contovounesios, 2019/07/09
- bug#36490: 26.1; directory-files-recursively breaks when it encounters a directory named "~", Eli Zaretskii, 2019/07/09
- bug#36490: 26.1; directory-files-recursively breaks when it encounters a directory named "~", Andreas Schwab, 2019/07/09
bug#36490: 26.1; directory-files-recursively breaks when it encounters a directory named "~", Lars Ingebrigtsen, 2019/07/10