all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] master 3431e82: Ignore directory symlinks in directory-files-recursively
Date: Sun, 21 Dec 2014 22:02:40 -0500	[thread overview]
Message-ID: <jwvlhm0l7i1.fsf-monnier+emacsdiffs@gnu.org> (raw)
In-Reply-To: <87vbl5z03r.fsf@building.gnus.org> (Lars Ingebrigtsen's message of "Sun, 21 Dec 2014 12:57:44 +0100")

>> 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...".


        Stefan



  reply	other threads:[~2014-12-22  3:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20141212105304.4186.22515@vcs.savannah.gnu.org>
     [not found] ` <E1XzNqL-000168-2E@vcs.savannah.gnu.org>
2014-12-12 14:57   ` [Emacs-diffs] master 3431e82: Ignore directory symlinks in directory-files-recursively Stefan Monnier
2014-12-13 15:01     ` Lars Magne Ingebrigtsen
2014-12-14  4:59       ` Stefan Monnier
2014-12-14  9:33         ` Lars Magne Ingebrigtsen
2014-12-14 14:27           ` Stefan Monnier
2014-12-21 11:57             ` Lars Ingebrigtsen
2014-12-22  3:02               ` Stefan Monnier [this message]
2015-01-16  0:08                 ` Lars Magne Ingebrigtsen

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvlhm0l7i1.fsf-monnier+emacsdiffs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.