From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master 11cf3e9: Implement a new function directory-files-recursively Date: Tue, 09 Dec 2014 19:42:58 -0500 Message-ID: References: <20141209062121.9440.90058@vcs.savannah.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1418172218 557 80.91.229.3 (10 Dec 2014 00:43:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 10 Dec 2014 00:43:38 +0000 (UTC) Cc: Lars Magne Ingebrigtsen To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 10 01:43:31 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XyVNK-0006h9-Pg for ged-emacs-devel@m.gmane.org; Wed, 10 Dec 2014 01:43:30 +0100 Original-Received: from localhost ([::1]:42982 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyVNK-000454-E0 for ged-emacs-devel@m.gmane.org; Tue, 09 Dec 2014 19:43:30 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42238) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyVMx-0003xV-OB for emacs-devel@gnu.org; Tue, 09 Dec 2014 19:43:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XyVMq-00036d-86 for emacs-devel@gnu.org; Tue, 09 Dec 2014 19:43:07 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:4142) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyVMq-00036Z-4y for emacs-devel@gnu.org; Tue, 09 Dec 2014 19:43:00 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjsPAOwQflQXW5Ml/2dsb2JhbABbgweDYIVaxR0EAgKBJBcBAQEBAQF8hAMBAQRWIxALNBIUGA2Id9ZZAQEBAQYBAQEBHpBvBxaEMgWLAYxUhV2Pc4QCgjeBYiGCdwEBAQ X-IPAS-Result: AjsPAOwQflQXW5Ml/2dsb2JhbABbgweDYIVaxR0EAgKBJBcBAQEBAQF8hAMBAQRWIxALNBIUGA2Id9ZZAQEBAQYBAQEBHpBvBxaEMgWLAYxUhV2Pc4QCgjeBYiGCdwEBAQ X-IronPort-AV: E=Sophos;i="5.07,502,1413259200"; d="scan'208";a="100023870" Original-Received: from 23-91-147-37.cpe.pppoe.ca (HELO pastel.home) ([23.91.147.37]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 09 Dec 2014 19:42:59 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 3F94D72BD; Tue, 9 Dec 2014 19:42:58 -0500 (EST) In-Reply-To: (Lars Ingebrigtsen's message of "Tue, 09 Dec 2014 06:21:21 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:179611 Archived-At: 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