From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: locate-dominating-file calls `stat' too eagerly Date: Mon, 29 Sep 2008 22:05:04 +0300 Message-ID: References: Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1222715181 19219 80.91.229.12 (29 Sep 2008 19:06:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 29 Sep 2008 19:06:21 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 29 21:07:20 2008 connect(): Connection refused Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KkO5D-0006Ak-DR for ged-emacs-devel@m.gmane.org; Mon, 29 Sep 2008 21:06:59 +0200 Original-Received: from localhost ([127.0.0.1]:48877 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KkO4A-0003FM-GI for ged-emacs-devel@m.gmane.org; Mon, 29 Sep 2008 15:05:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KkO45-0003Bv-5I for emacs-devel@gnu.org; Mon, 29 Sep 2008 15:05:49 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KkO44-00039w-2S for emacs-devel@gnu.org; Mon, 29 Sep 2008 15:05:48 -0400 Original-Received: from [199.232.76.173] (port=59005 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KkO43-00039X-SG for emacs-devel@gnu.org; Mon, 29 Sep 2008 15:05:47 -0400 Original-Received: from mtaout5.012.net.il ([84.95.2.13]:56762) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KkO43-00018y-9i for emacs-devel@gnu.org; Mon, 29 Sep 2008 15:05:47 -0400 Original-Received: from HOME-C4E4A596F7 ([77.127.170.116]) by i_mtaout5.012.net.il (HyperSendmail v2004.12) with ESMTPA id <0K7Z0021O129CT90@i_mtaout5.012.net.il> for emacs-devel@gnu.org; Mon, 29 Sep 2008 22:06:19 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by monty-python.gnu.org: Solaris 9.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:104229 Archived-At: > From: Stefan Monnier > Cc: emacs-devel@gnu.org > Date: Mon, 29 Sep 2008 12:19:15 -0400 > > > (defun locate-dominating-file (file regexp) > > "Look up the directory hierarchy from FILE for a file matching REGEXP." > > ;; If FILE does not exist, find its parent directory that does. > > (or (file-exists-p file) > > (while (and file (not (file-directory-p file))) > > (setq file (file-name-directory (directory-file-name file))))) > > In some corner cases, this can infloop. What are those cases? I think we need to describe them in a comment there. > > And btw, won't the user test cover the case of crossing ~/ as well? > > In 99% of the cases, yes. What are the remaining 1%? Again, I think they should be mentioned in comments.