From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Magne Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master 3431e82: Ignore directory symlinks in directory-files-recursively Date: Fri, 16 Jan 2015 01:08:00 +0100 Message-ID: References: <20141212105304.4186.22515@vcs.savannah.gnu.org> <87vbl5z03r.fsf@building.gnus.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1421366912 17659 80.91.229.3 (16 Jan 2015 00:08:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 16 Jan 2015 00:08:32 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 16 01:08:31 2015 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 1YBuSk-000776-WA for ged-emacs-devel@m.gmane.org; Fri, 16 Jan 2015 01:08:31 +0100 Original-Received: from localhost ([::1]:53384 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBuSk-0006UD-4W for ged-emacs-devel@m.gmane.org; Thu, 15 Jan 2015 19:08:30 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33703) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBuSd-0006U7-Tk for emacs-devel@gnu.org; Thu, 15 Jan 2015 19:08:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YBuSa-0008DT-LI for emacs-devel@gnu.org; Thu, 15 Jan 2015 19:08:23 -0500 Original-Received: from hermes.netfonds.no ([80.91.224.195]:42853) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBuSa-0008DN-A9 for emacs-devel@gnu.org; Thu, 15 Jan 2015 19:08:20 -0500 Original-Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58] helo=stories) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1YBuSG-0004Wh-Md; Fri, 16 Jan 2015 01:08:00 +0100 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAHlBMVEUSAUr+7w6/pnmKb1wR AEhLMVQRAEn+/Qf+9gzz3U0INV/6AAACU0lEQVQ4jWXTvY/aMBQA8NcLjsRWCyEYT44ydEt4tVA3 EIY5F8fHdUtVLjvqYNaoQ7J2qvrf9tlO+GgtnUDv957fs80B7y2tvuXDWrbIjEEJAaxtPfV9b2e5 lsYQDNL3lN531s7zSOo9wTKAvbR8SXE7f2EVOuAhfOFtqJitUSPC8uIr5vKPybUu8GtU5FLjG1W4 cltkmYw0ZFKzKUaV2QLnAWSGDKMMjaZVmB0MM5n56xdmgFwj0xmN240gtQFm5MeITbU2EsZh7VkC wIK+8O684PwK54zisB7T7AjnrHZw/BdCPsB0jHeh+bkIcWA3cBU/CogHWdy26uyM8uM6wPoG/cwF hjh8uAJ38bhp6rBZdIU53EM83oQddmho1Q9NBqDUof3xEbSMTxv3xXx6AFaKcJQ4SkbweU9CJHpC n6/vk8U9lEKIdFL7IXz3dhFAuwp6jycCd0SOa1CuBRVoaoNF06gd/YCQHsqDdCTkc6OU2rQz/HVG D2BcE4HPdAOnQ075mAfwcQI4KdUcFz8x7wKsAkhJex2+zzCnce8qZJTEzaFh+NuOEImEimQpMtqq 9kcMU/mhRFaK1DVZ+zdXG3eFK5G461qJiWpOW4I+QPKUCEyApKLudMQLd8BWCRMoUibjvQNqcqGt FIEwdFuFSWM6uTrEa99DbQikWUkw6cSBat5sH0CIz7JQ9G9x8nD41vVjRaUFIhYqrPdluwR3nzRl uXJPNYDi7toJykTR44qxQKk8gIpSFT3AdgBWqb0o02tc7QbY0F+yydR/W7mlq4c4/wtsxBkgIT6+ 5gAAAABJRU5ErkJggg== X-Now-Playing: Tom Robinson's _North by Northwest_: "Love Comes" X-Hashcash: 1:23:150116:monnier@iro.umontreal.ca::xBg/ajX1AgBnoZrS:0000000000000000000000000000000000000M1Km X-Hashcash: 1:23:150116:emacs-devel@gnu.org::mFGxGWQoNbihM2dR:000000000000000000000000000000000000000000aQAl In-Reply-To: (Stefan Monnier's message of "Sun, 21 Dec 2014 22:02:40 -0500") User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) X-MailScanner-ID: 1YBuSG-0004Wh-Md MailScanner-NULL-Check: 1421971681.72714@RFTgS6hMkJuPmSc/oH3ejQ X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.224.195 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:181312 Archived-At: Stefan Monnier writes: >>> 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. The typical usage (in the callers that call versions of this function other places in the Emacs tree) seems to be "give me a list of files matching this regexp". Making the callers take a separate directory and leaf name makes the caller do the work of joining those two things up before anything can be done, so it's more lazy to have the `directory-files-recursively' do this work. If there are callers that also want directories, they will have to do more work, but that extra work is just calling `directory-name-p', which is a very cheap function. So I don't really see any advantage to having two parameters in the callback function. >>> 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. Er, huhm, yes, I don't know what I was thinking. Then I don't really see any practical way to reduce the number of parameters below four. We could drop INCLUDE-DIRECTORIES, but then the somewhat handy `(directory-files-recursively "/tmp/foo" "." t)' (to do `rm r') wouldn't be as handy any more. >> 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. Ok; I'll rename away. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no