From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Cl=C3=A9ment?= Pit--Claudel Newsgroups: gmane.emacs.bugs Subject: bug#27798: Documentation of locate-dominating-file is wrong Date: Sun, 23 Jul 2017 16:52:51 +0200 Message-ID: <904757d6-ff93-a543-aa0d-770ddf6a5f22@live.com> References: <4e10c630-ed42-8204-815a-384b911bb645@live.com> <83k22z8bs8.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hWKDLj7H6C486dTsASH6J6WMFA5H2xX8O" X-Trace: blaine.gmane.org 1500821661 10751 195.159.176.226 (23 Jul 2017 14:54:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 23 Jul 2017 14:54:21 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 Cc: 27798@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jul 23 16:54:16 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 1dZIGo-00023B-KO for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Jul 2017 16:54:10 +0200 Original-Received: from localhost ([::1]:50681 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZIGp-0002rS-4j for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Jul 2017 10:54:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40593) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZIGj-0002rJ-PD for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2017 10:54:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZIGg-0006v5-Ni for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2017 10:54:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:50890) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dZIGg-0006up-KM for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2017 10:54:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dZIGg-0005fJ-B8 for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2017 10:54:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Cl=C3=A9ment?= Pit--Claudel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 23 Jul 2017 14:54:02 +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.150082158221705 (code B ref 27798); Sun, 23 Jul 2017 14:54:02 +0000 Original-Received: (at 27798) by debbugs.gnu.org; 23 Jul 2017 14:53:02 +0000 Original-Received: from localhost ([127.0.0.1]:53567 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZIFi-0005e1-HI for submit@debbugs.gnu.org; Sun, 23 Jul 2017 10:53:02 -0400 Original-Received: from mout.kundenserver.de ([217.72.192.73]:56612) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZIFf-0005dS-UM for 27798@debbugs.gnu.org; Sun, 23 Jul 2017 10:53:00 -0400 Original-Received: from [192.168.1.82] ([109.24.225.43]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.184]) with ESMTPSA (Nemesis) id 0MUW15-1d9l1b3JsR-00RL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jbIEkUQfwMZz 6t+qw6yE+LO/6NWVAUJXc3A1o1akmxrWiPaUwQ== 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:134886 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --hWKDLj7H6C486dTsASH6J6WMFA5H2xX8O Content-Type: multipart/mixed; boundary="jwMtxfWcINKgL9v3dv0ha5HN6pBuRolIo"; protected-headers="v1" From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= To: Eli Zaretskii Cc: 27798@debbugs.gnu.org Message-ID: <904757d6-ff93-a543-aa0d-770ddf6a5f22@live.com> Subject: Re: bug#27798: Documentation of locate-dominating-file is wrong References: <4e10c630-ed42-8204-815a-384b911bb645@live.com> <83k22z8bs8.fsf@gnu.org> In-Reply-To: <83k22z8bs8.fsf@gnu.org> --jwMtxfWcINKgL9v3dv0ha5HN6pBuRolIo Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: quoted-printable On 2017-07-23 16:31, Eli Zaretskii wrote:>> This part is wrong, because l= ocate-dominating-file also accepts directories: >> >> Look up the directory hierarchy from FILE >=20 > Actually, FILE _must_ be a directory, because the function does this: >=20 > (setq try (if (stringp name) > (file-exists-p (expand-file-name name file)) > ^^^^^^^^^^^^^^^^^^^^^^^^^^ Ouch. This is a problem, because I'm not the only one who assumed that t= his had to be a file and not a directory. There are instances of locate-= dominating-file being called with file-name in vc, trampver, yasnippet, c= ompany, flycheck, proof-general, etc. Github finds 35k matches for (loca= te-dominating-file buffer-file-name) (https://github.com/search?q=3D%28lo= cate-dominating-file+buffer-file-name&type=3DCode&utf8=3D%E2%9C%93). > It's possible that "directory hierarchy from FILE" doesn't convey that > clearly enough, in which case we could add >=20 > FILE should be a directory. Yes, this would be great. In fact, I think we should rename the argument= to DIRECTORY, if it's a directory. But I'm not sure what we should do about all the existing callers=E2=80=A6= >> This part is wrong, because the predicate is called with the initial f= ile name, too: >> >> NAME can also be a predicate taking one argument (a directory) >=20 > Why you say that this is wrong? The doc string never said anything to > the contrary. The docstring says "one argument (a directory)", but locate-dominating-fi= le (when called with a file name, not a directory name) passes that file = name to NAME (thus calling it with one argument that's not a directory). I understand now that this isn't a valid use of locate-dominating-file, h= owever, so that point is moot. I was under the impression from the docst= ring that locate-dominating-file had to be called with a file name, not a= directory name. Thanks for the explanations! Cl=C3=A9ment. --jwMtxfWcINKgL9v3dv0ha5HN6pBuRolIo-- --hWKDLj7H6C486dTsASH6J6WMFA5H2xX8O Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJZdLhDAAoJEPqg+cTm90wjqCYP/RLRM5YYaYdv/Y2tsna7LhqM vAC6ml4vPhNDou2FrKmjG0+tPAVr9ohgYtCXmZrs1skhWNoI9azpoUdlFpn2Nrj6 fXM2kea6NsdMJe1hYJZfDuuvTw+CV09iTtrUaH7BxlD8wJW05ybZgd4zQqzH4ktz kPeb76CjC84g9nZFUANsOOtjWPKK79UfTaUvIlu6fgfvDoPZqUdeCj7vnQ6foJxO a4XbeGkeDwkOSP3iKuwy2d+z2KQHUpUL7Qm5Ole8ZXRRM1/WRq1KtBp2w+Egh7Ar 5RUHC+mmk5EOMKtT7931kDf+NPZjpTAmgX20mjGS7CwJTuURiYIIXXrrVjEiPWHi lzgX/Fy+d0ZIG8ltsR40+XytZ4prp7OxcGNt0xBxzR03HQ/Uh5mD9AyM3h60sGN8 dm9dOFhLEVvXm9Q/C7k7ait1DIp+zG0PPFdj48Y1XJacnTadMmLBnuNono2nR/Ux 90Btm5q+G/BxHvOoKVlSjBeA4e5qLTS1kBPZk4yFzpKmrAM3y0sZv72RDNvrzZSM DzUt35VunCkRhNKRAJMxzQybcg8QQFM2S2HXT8NstuAAL2MRBJL3Bg6c2lNog+1g U5d8ss71HuNjSKoJiO7yvZ60Yn+99ICEx0KzJp1wY1KELzq4Vo9zhXOTWULEBTua 08ji/XUzIT/OlG9bMS8v =21aB -----END PGP SIGNATURE----- --hWKDLj7H6C486dTsASH6J6WMFA5H2xX8O--