[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] master 3431e82: Ignore directory symlinks in directory
Re: [Emacs-diffs] master 3431e82: Ignore directory symlinks in directory-files-recursively
Sun, 21 Dec 2014 22:02:40 -0500
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)
>> It can avoid calling expand-file-name only to call file-name-directory
>> (or file-name-nondirectory) right after.
> It can, but in the use cases I've typically seen, you wouldn't do that,
> I think? You'd say `(directory-name-p file)' and then... something...
I don't understand what you mean here. I'm just pointing out that
calling expand-file-name only to pass the result to the function
parameter means that this work may be wasted.
So passing the two parameters separately is a way to be more lazy.
>> Can we reduce the number of arguments?
> That would be nice, but I'm not sure what to remove. The canonical,
> that most of the callers use (from the other versions of this function
> included in various packages in Emacs) is
> (directory-files-recursively "~/" "~\\'")
> or something. And then there are a couple that want the directories,
> too. And then there's `file-tree-walk', which is the new thing.
Exactly: the use cases are varied, so we need a very generic interface.
I actually find file-tree-walk not too bad in this respect.
> Uhm... we could make MATCH be the predicate if it's not a string?
But we need 2 answers: whether to include the file in the result, and
whether to recurse.
>>> (path (expand-file-name leaf dir)))
>> This is not a "path", it's a file name. Remember: by convention
>> a "path" is a list of directories, as in load-path, $PATH, etc...
> Right. But do we have a word for "string that designates either a file
> or a directory"?
Yes, we say "a file name". A directory is a kind of file.
> That's usually called "a path"...
No, there are people who like to use "path" for other things, but the
GNU convention is to only use it for "a list of directories, as in
load-path, $PATH, etc...".