all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Cc: Lars Magne Ingebrigtsen <larsi@gnus.org>
Subject: Re: [Emacs-diffs] master 11cf3e9: Implement a new function directory-files-recursively
Date: Tue, 09 Dec 2014 19:42:58 -0500	[thread overview]
Message-ID: <jwv388ol4p4.fsf-monnier+emacsdiffs@gnu.org> (raw)
In-Reply-To: <E1XyEAj-0002Ss-EK@vcs.savannah.gnu.org> (Lars Ingebrigtsen's message of "Tue, 09 Dec 2014 06:21:21 +0000")

Hello people?

Maybe Eric is not following Emacs development very closely, but he's not
a complete idiot either.  So if you think he got his function wrong,
I think it's a bit presumptuous to think you can be sure your version
will be "the right one" without even discussing it on emacs-devel.

> +(defun directory-files-recursively (dir match &optional include-directories)
> +  "Return all files under DIR that have file names matching MATCH (a regexp).
> +This function works recursively.  Files are returned in \"depth first\"
> +and alphabetical order.
> +If INCLUDE-DIRECTORIES, also include directories that have matching names."

Eric's version allows precise control those subdirectories in which we
want to recurse and those in which we don't.  This is a very
important functionality.

> +  (let ((result nil)
> +	(files nil))
> +    (dolist (file (directory-files dir t))
> +      (let ((leaf (file-name-nondirectory file)))
> +	(unless (member leaf '("." ".."))
> +	  (if (file-directory-p file)

And here you make the same mistake that I already pointed out to Eric:
using directory-files followed by file-directory-p on each file is about
10 times slower than using file-name-all-completions and checking the
presence of a final / instead.


        Stefan



       reply	other threads:[~2014-12-10  0:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20141209062121.9440.90058@vcs.savannah.gnu.org>
     [not found] ` <E1XyEAj-0002Ss-EK@vcs.savannah.gnu.org>
2014-12-10  0:42   ` Stefan Monnier [this message]
2014-12-10  4:39     ` [Emacs-diffs] master 11cf3e9: Implement a new function directory-files-recursively Lars Magne Ingebrigtsen
2014-12-10  5:09       ` Lars Magne Ingebrigtsen
2014-12-10  5:35         ` Lars Magne Ingebrigtsen
2014-12-10 14:56           ` Stefan Monnier
2014-12-10 17:34             ` Thierry Volpiatto
2014-12-11 14:40               ` Lars Magne Ingebrigtsen
2014-12-11 17:23                 ` Stefan Monnier
2014-12-13  7:35                   ` Thierry Volpiatto
2014-12-13 14:12                     ` Lars Magne Ingebrigtsen
2014-12-13 21:18                       ` Thierry Volpiatto
2014-12-14  8:48                       ` Thierry Volpiatto
2014-12-13 14:42                     ` Lars Magne Ingebrigtsen
2014-12-13 14:46                     ` Lars Magne Ingebrigtsen
2014-12-13 15:10             ` Lars Magne Ingebrigtsen
2014-12-14  5:02               ` Stefan Monnier
2014-12-10  7:58         ` Leo Liu
2014-12-10  8:48         ` Andreas Schwab

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=jwv388ol4p4.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.