From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Engster Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master e820f16: Added file-tree-walk to files.el. Date: Wed, 03 Dec 2014 20:32:35 +0100 Message-ID: <87wq687cmk.fsf@engster.org> References: <20141203142859.24393.98673@vcs.savannah.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1417635196 5706 80.91.229.3 (3 Dec 2014 19:33:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 3 Dec 2014 19:33:16 +0000 (UTC) Cc: "Eric S. Raymond" , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 03 20:33:12 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 1XwFfh-0002pz-NF for ged-emacs-devel@m.gmane.org; Wed, 03 Dec 2014 20:33:09 +0100 Original-Received: from localhost ([::1]:43055 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwFfh-0006Wt-Bi for ged-emacs-devel@m.gmane.org; Wed, 03 Dec 2014 14:33:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46611) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwFfQ-0006Wl-Kr for emacs-devel@gnu.org; Wed, 03 Dec 2014 14:32:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XwFfK-0008UG-I8 for emacs-devel@gnu.org; Wed, 03 Dec 2014 14:32:52 -0500 Original-Received: from randomsample.de ([5.45.97.173]:32953) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwFfK-0008Tc-9f for emacs-devel@gnu.org; Wed, 03 Dec 2014 14:32:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=randomsample.de; s=a; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From; bh=AwMzyRI/9sxKf8Fwxp1SmaEKKUH0WKgXc3N/A/C5V0Q=; b=fbXLJvvOM8QRVFBVuAWjMp4yqFdn28ub23UqeM4gM9z3jarA/KCFFMvNqIRNoVaxxorEsIf64WtOgnPDN6+rPYqR7VzTN+D9Vuc2/BNMiKTcbsEwxW+IsXVL8pKhmT1b; Original-Received: from ip4d154d80.dynamic.kabel-deutschland.de ([77.21.77.128] helo=spaten) by randomsample.de with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1XwFfB-00050y-Ma; Wed, 03 Dec 2014 20:32:37 +0100 In-Reply-To: (Stefan Monnier's message of "Wed, 03 Dec 2014 10:31:00 -0500") User-Agent: Gnus/5.13001 (Ma Gnus v0.10) Emacs/24.3.91 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 5.45.97.173 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:178760 Archived-At: Stefan Monnier writes: >> +before descending into it, and if nil is returned at that point >> +the descent will be prevented. Directory entries are sorted with >> +string-lessp" > ^^^ > Don't forget to punctuate your docstrings. And string-lessp should be quoted, but it doesn't matter since AFAICS that sentence isn't true anyway. >> + (cond ((file-directory-p dir) >> + (or (char-equal ?/ (aref dir (1- (length dir)))) >> + (setq dir (file-name-as-directory dir))) >> + (let ((lst (directory-files dir nil nil t)) > > Experience taught me that file-name-all-completions followed by testing > the presence of a trailing "/" is *much* faster because calling > file-directory-p on each entry ends up costly. > > I got this trick from Eshell's code for ** globbing, where the speed > difference was a factor 10 when I tested it. Apart from that, I find this function confusing. Why not simply call ACTION with the full filename instead of splitting in into DIR and the filename sans the directory part (where the latter might actually be a subdirectory)? -David