From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#27798: Documentation of locate-dominating-file is wrong Date: Sun, 23 Jul 2017 17:31:51 +0300 Message-ID: <83k22z8bs8.fsf@gnu.org> References: <4e10c630-ed42-8204-815a-384b911bb645@live.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1500820408 27152 195.159.176.226 (23 Jul 2017 14:33:28 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 23 Jul 2017 14:33:28 +0000 (UTC) Cc: 27798@debbugs.gnu.org To: =?UTF-8?Q?Cl=C3=A9ment?= Pit--Claudel Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jul 23 16:33:15 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZHwS-00063m-Sk for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Jul 2017 16:33:08 +0200 Original-Received: from localhost ([::1]:50639 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZHwW-0006Og-Ba for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Jul 2017 10:33:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZHwQ-0006Oa-Vf for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2017 10:33:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZHwM-0000Wj-3H for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2017 10:33:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:50880) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dZHwL-0000Wd-WB for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2017 10:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dZHwL-0005CH-QH for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2017 10:33:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 23 Jul 2017 14:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27798 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 27798-submit@debbugs.gnu.org id=B27798.150082032519910 (code B ref 27798); Sun, 23 Jul 2017 14:33:01 +0000 Original-Received: (at 27798) by debbugs.gnu.org; 23 Jul 2017 14:32:05 +0000 Original-Received: from localhost ([127.0.0.1]:53557 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZHvR-0005B4-C6 for submit@debbugs.gnu.org; Sun, 23 Jul 2017 10:32:05 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:46836) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZHvQ-0005Ab-2f for 27798@debbugs.gnu.org; Sun, 23 Jul 2017 10:32:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZHvF-0008KF-RN for 27798@debbugs.gnu.org; Sun, 23 Jul 2017 10:31:58 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:57722) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZHvF-0008Jv-O7; Sun, 23 Jul 2017 10:31:53 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1845 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dZHvF-0004ck-BG; Sun, 23 Jul 2017 10:31:53 -0400 In-reply-to: <4e10c630-ed42-8204-815a-384b911bb645@live.com> (message from =?UTF-8?Q?Cl=C3=A9ment?= Pit--Claudel on Sun, 23 Jul 2017 11:49:36 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:134884 Archived-At: > From: Clément Pit--Claudel > Date: Sun, 23 Jul 2017 11:49:36 +0200 > > (locate-dominating-file FILE NAME) > > Look up the directory hierarchy from FILE for a directory containing NAME. > Stop at the first parent directory containing a file NAME, > and return the directory. Return nil if not found. > Instead of a string, NAME can also be a predicate taking one argument > (a directory) and returning a non-nil value if that directory is the one for > which we’re looking. > > This part is wrong, because locate-dominating-file also accepts directories: > > Look up the directory hierarchy from FILE Actually, FILE _must_ be a directory, because the function does this: (setq try (if (stringp name) (file-exists-p (expand-file-name name file)) ^^^^^^^^^^^^^^^^^^^^^^^^^^ It's possible that "directory hierarchy from FILE" doesn't convey that clearly enough, in which case we could add FILE should be a directory. > This part is wrong, because the predicate is called with the initial file name, too: > > NAME can also be a predicate taking one argument (a directory) Why you say that this is wrong? The doc string never said anything to the contrary. If we change the first sentence to say this: Starting from FILE, look up directory hierarchy for directory containing NAME. will that address the second issue? Thanks.