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 11:49:36 +0200 Message-ID: <4e10c630-ed42-8204-815a-384b911bb645@live.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="mje8kISee7M6tpIhAp3JGu6UGdFxUNKK3" X-Trace: blaine.gmane.org 1500803412 12606 195.159.176.226 (23 Jul 2017 09:50:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 23 Jul 2017 09:50:12 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 To: 27798@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jul 23 11:50:08 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 1dZDWZ-0002z6-0S for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Jul 2017 11:50:07 +0200 Original-Received: from localhost ([::1]:49793 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZDWe-0007ih-EA for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Jul 2017 05:50:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33457) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZDWX-0007hb-21 for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2017 05:50:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZDWT-0005m2-T2 for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2017 05:50:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:50204) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dZDWT-0005lq-Pf for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2017 05:50:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dZDWT-00056k-J6 for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2017 05:50:01 -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 09:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 27798 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.150080339319611 (code B ref -1); Sun, 23 Jul 2017 09:50:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 23 Jul 2017 09:49:53 +0000 Original-Received: from localhost ([127.0.0.1]:52881 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZDWK-00056F-Ux for submit@debbugs.gnu.org; Sun, 23 Jul 2017 05:49:53 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42461) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZDWI-00055z-O4 for submit@debbugs.gnu.org; Sun, 23 Jul 2017 05:49:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZDWC-0005f6-N5 for submit@debbugs.gnu.org; Sun, 23 Jul 2017 05:49:45 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:38226) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dZDWC-0005ez-JA for submit@debbugs.gnu.org; Sun, 23 Jul 2017 05:49:44 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33432) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZDWB-0007fq-EW for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2017 05:49:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZDW8-0005e0-BR for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2017 05:49:43 -0400 Original-Received: from mout.kundenserver.de ([212.227.17.24]:51761) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dZDW8-0005dN-01 for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2017 05:49:40 -0400 Original-Received: from [192.168.1.82] ([109.24.225.43]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.184]) with ESMTPSA (Nemesis) id 0Lto5V-1dhEJA1po5-011AJI for ; Sun, 23 Jul 2017 11:49:37 +0200 X-Provags-ID: V03:K0:Su21jBzuNVYO0VaqGjSDNHV3K0BPYLh4xSYk6BYlDSN1wl9MACD dHSxMkv+Z62/thdFmC5815RAzoyIZeeauB98xE63w72+eL8S538qqzRzMrbqqKYyfXz7Nt2 +Kl6fVPUWyAylsZGmZ4MaCQcGjVoOD7Jxh1zqnR78ooEJG82CRqY3saf/eudsFIghPTNpRM bNKI5oucAbsoZJ1y/sncw== X-UI-Out-Filterresults: notjunk:1;V01:K0:ycLGvcc6Al4=:c+vXn7kxdD2GdS3tjgVYOH kiqhZO1zs7IfRBTBefkB7E+nZljZT7d/x/5fl5JVAKAaDVzdnMU0dmfQUvSwqLd6/+xXJOaDA 7aZXWGGiw7Zy9vvvCDHpA9oUL5Snng++gAKvvSEkjpID+t/SL16mqF26AaHfCvX1q6ieEnE61 5+svgo4bWvzjVj8Rf/ePVCIM9K0KZfr6VQY01Q+E4k6+j8mlgNkz6Mbs9RQbkBBGlSLFWSsQt DzZqdK3iqm2UhcOGy3B3eF1p4gZlcrQhjccZy+VVsjnkOpcr/IutNTUGLIg/pBNvzNPIY+9a9 3pM32SA8smboFgMtX/NReH1M9cKXGJuNe1KP/kVIo6sbtx1dfsHwWT6PORPKobWn2X0vVm3Mr bdG7qLEyL4GRfeYV73pDrtXxLgdkjD8VEX+aPC5QkRYL85KXmuIkWx6Lj/GwIAYHykqIrNoo1 Zke3NMf0U4975fQar5hx64Oq3wOSqAQNks5ti36smwKKa0Bi+XObc3cy0yVSLDLYPf9z0zoPc EWzg3Dobt8DrMtyZr9BPCjmPGbu+t14MoaNXLjX+wn0E0gkmJlbD25LP+cthlQ70si7V8PbTE skg0jWKMjN3ao3J0DfEdSza0kkT+AQfFIrAwfyPCbewoNHS8bvmZnNlHV8EQ9W6ylgPll+abP QXbOHtqyNjac/0LsZUuz/OVg2dh+zrcYKNBPUvqnNPPuE8hJt/50lrRPHUHqe4TH879D1yASN 6AfkSGma90ogcusm89NlPFzsRInUHUC8UAiMCA== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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:134877 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --mje8kISee7M6tpIhAp3JGu6UGdFxUNKK3 Content-Type: multipart/mixed; boundary="0C17Vg8RnW5NHdA7e4fudTwto8k8Rwwdd"; protected-headers="v1" From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= To: bug-gnu-emacs@gnu.org Message-ID: <4e10c630-ed42-8204-815a-384b911bb645@live.com> Subject: Documentation of locate-dominating-file is wrong --0C17Vg8RnW5NHdA7e4fudTwto8k8Rwwdd Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: quoted-printable The docs of locate-dominating-file say this: (locate-dominating-file FILE NAME) Look up the directory hierarchy from FILE for a directory containing NA= ME. 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 on= e for which we=E2=80=99re looking. This part is wrong, because locate-dominating-file also accepts directori= es: Look up the directory hierarchy from FILE 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) Indeed, the following form: (locate-dominating-file "/usr/local/bin/emacs" (lambda (x) (ignore (mes= sage "%s" x)))) prints this: /usr/local/bin/emacs /usr/local/bin/ /usr/local/ /usr/ / (not the file name passed into the first call. I think the fix is to update the docs in both places, as there might be c= allers relying on the existing behavior. It's important to also document= that passing a directory name is OK, though, because that's the only way= to use locate-dominating-file reliably with a directory-only predicate =E2= =80=94 otherwise, the predicate needs to handle both files and folders. Cheers, Cl=C3=A9ment. --0C17Vg8RnW5NHdA7e4fudTwto8k8Rwwdd-- --mje8kISee7M6tpIhAp3JGu6UGdFxUNKK3 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 iQIcBAEBCAAGBQJZdHEwAAoJEPqg+cTm90wjOWUQAIQTXm3EbS3Y6bYOY1NWkSfx i3QMDYYG0j5H+8EybyX3YZKnHtYDsJOFZWKxgv+eettv66VnyFkb2LcmZOAtrKdo XqRmSjURqpSHDtyBLmq/xdVhqmhyRtsW6A8P8iOwl1jRCME+KZ88dQAg5p6TkggZ XmzhD0mL1n1sqMe1VPAzPb/f7HYVN42X4wjzmQ0bcXyfFBQtdDknmkBqyYneqxJq 7oKMCSGGSa5IA+AxoJKi8HqC3LDMVwH/tsZ0/v9h6nquLrgcNGL+kxT6PEuQhG5Z 7Pkyz5ovCCvXywuZhIJGJ/HmAKAYgkSFEO5sScE0nd432liCEpa2ETzq0e0PTMOD n/ylNO0SN/3u7OMBoz/OlaW6hudKEbXYL0SRnsbDWgl6veeSyU7cRuKAUAEmWZGA 1VBnlSPZjeTOJ2EGcKytE7TjJoWm+raU06yf7GAlqm4RkGMjjcwLwspKIxinKENn 0/OiDwujKXEI0VfI9Mb4G9z+tajmd755NNRRQ/AGNbjRsZz55O1o7aSyCcz3ig2L nW/RiPiCrvRmOv0zpedUEePqDjJqVpD8zVrdgSDlCkOPyjcTKvyeAsUKPwk24996 HXdi3vdGpBltTfgmXSKUFh3r267i0wzPR7Dl0Eb6F0MPoDKkKzx9OLubBC513MgR tbAjdrmiT9HsKURgAaYs =/lV0 -----END PGP SIGNATURE----- --mje8kISee7M6tpIhAp3JGu6UGdFxUNKK3--