From debbugs-submit-bounces@debbugs.gnu.org Sun May 29 18:44:37 2016 Received: (at submit) by debbugs.gnu.org; 29 May 2016 22:44:37 +0000 Received: from localhost ([127.0.0.1]:46695 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b79Rl-0006PQ-5s for submit@debbugs.gnu.org; Sun, 29 May 2016 18:44:37 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41039) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b79Rk-0006PE-4A for submit@debbugs.gnu.org; Sun, 29 May 2016 18:44:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b79Rd-0002JR-UO for submit@debbugs.gnu.org; Sun, 29 May 2016 18:44:30 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:59136) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b79Rd-0002Hu-Qx for submit@debbugs.gnu.org; Sun, 29 May 2016 18:44:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60239) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b79RZ-00028t-8d for bug-gnu-emacs@gnu.org; Sun, 29 May 2016 18:44:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b79RV-0002E3-2h for bug-gnu-emacs@gnu.org; Sun, 29 May 2016 18:44:24 -0400 Received: from mail-lb0-x233.google.com ([2a00:1450:4010:c04::233]:34939) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b79RU-0002Dl-K9 for bug-gnu-emacs@gnu.org; Sun, 29 May 2016 18:44:21 -0400 Received: by mail-lb0-x233.google.com with SMTP id mp7so3220337lbb.2 for ; Sun, 29 May 2016 15:44:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:message-id:date:user-agent:mime-version; bh=H++QgP72YU2hQywSV6iKvmCD8K27Zfc0KxNP6g4yYnw=; b=nBI8rE7iGvQeD/+7NPO5i2BC0Yh9rXzS16imcZWyy7cgvd3htzpnfJtmPvOI+b9kCP wTQCLpuTIii1I1IHsTPqyObXiMQMBFvHIoikueU4PTteoMMNINzCn9OR2en4Pm0Tp7F+ ok6D95ZQ9Ov9OxzHr73VAm/RURlLa3kMrCpYvSzYoEBLSbsaDGpMW7O/Mgf0OK2gs7fN lkC0nA0/9kb2aH0oghGqkdNFgR9Pd4XGriwHA8XW2nKWa1MjpxowxpOttn3QhMg4GE/+ NkwX8WPJ5XIDLZYpSmVhKTjzqBMpGnkBb6iFshNT9CMyODBHb4bag7e1lXj+ucaxjU0e NhhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:message-id:date:user-agent :mime-version; bh=H++QgP72YU2hQywSV6iKvmCD8K27Zfc0KxNP6g4yYnw=; b=TCqAi03IzQajkga9EtB/Y0x02T49nwdAUuH6jJg9ifTlI5YTCGIkp93Me7oh98xE7v WI/aW4wT/e5W9JPOQhibXo+eJUV9O5pe3+SiQZ2ujjg/heFJ5ONfu6yvj/jiXcPLpB/7 23o/nDpA4DviWNY36CkY4WwgjnkQpnG4o4FJyVGeMOwuTx+wzib5v5FRwu6zvb3JgwbY /P2bWUrsaU3bWdc+M1CmiIXs/WuWZmE1TzEmgHKQEKvQGobzOjpqupOGHR/EbiVA216p +9iPXRTVuoyFBMwT4IUmwno+R5XkfEzasZ16oWS/lans20pDDt69XlG+lYO+lLhS/zXB 6TLw== X-Gm-Message-State: ALyK8tKmoP9vHGMWPCz0HN3MM3TXQAK4OoaivrfiyqRu3WN1S0LS784Ryvueban/tVGhVg== X-Received: by 10.112.60.198 with SMTP id j6mr4885520lbr.131.1464561858742; Sun, 29 May 2016 15:44:18 -0700 (PDT) Received: from [192.168.199.2] (broadband-95-84-209-126.nationalcablenetworks.ru. [95.84.209.126]) by smtp.gmail.com with ESMTPSA id 72sm1894918ljj.0.2016.05.29.15.44.17 for (version=TLSv1/SSLv3 cipher=OTHER); Sun, 29 May 2016 15:44:17 -0700 (PDT) From: Nikolay Kudryavtsev X-Google-Original-From: Nikolay Kudryavtsev To: bug-gnu-emacs@gnu.org Subject: Use of locate-file for directories is underdocumented Message-ID: <80ca6c90-0bfa-1cc5-c63f-0dc8a5fee83d@gmail.com> Date: Mon, 30 May 2016 01:44:11 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------8D5EED40AAFED0D425151702" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) This is a multi-part message in MIME format. --------------8D5EED40AAFED0D425151702 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hello. Let's say I have a list of folders A, B, C. I want to find which one of them contains subfolder D. My first idea was using locate-file. While doing so I've found that the Elisp reference for it is incomplete and confusing: 1. According to the docstring it would only return a directory if PREDICATE returns 'dir-ok. This is not mentioned in the Elisp reference. 2. The reference suggests file-directory-p as a useful predicate and this would fail due to 1. 3. It's probably a good idea to mention that there are no bundled predicates that return dir-ok, and suggest to use a lamda like this: (lambda (f) (and (file-directory-p f) 'dir-ok)) as a PREDICATE. Here's a working example, just in case: (locate-file "Git" '("c:/Program Files/") nil (lambda (f) (and (file-directory-p f) 'dir-ok))) -- Best Regards, Nikolay Kudryavtsev --------------8D5EED40AAFED0D425151702 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit

Hello.

Let's say I have a list of folders A, B, C. I want to find which one of them contains subfolder D.

My first idea was using locate-file. While doing so I've found that the Elisp reference for it is incomplete and confusing:

1. According to the docstring it would only return a directory if PREDICATE returns 'dir-ok. This is not mentioned in the Elisp reference.

2. The reference suggests file-directory-p as a useful predicate and this would fail due to 1.

3. It's probably a good idea to mention that there are no bundled predicates that return dir-ok, and suggest to use a lamda like this: (lambda (f) (and (file-directory-p f) 'dir-ok)) as a PREDICATE.


Here's a working example, just in case:

(locate-file "Git" '("c:/Program Files/") nil (lambda (f) (and (file-directory-p f) 'dir-ok)))

-- 
Best Regards,
Nikolay Kudryavtsev
--------------8D5EED40AAFED0D425151702-- From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 30 22:41:10 2018 Received: (at 23650) by debbugs.gnu.org; 31 Jan 2018 03:41:10 +0000 Received: from localhost ([127.0.0.1]:50133 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1egjGn-0003kP-OH for submit@debbugs.gnu.org; Tue, 30 Jan 2018 22:41:09 -0500 Received: from mail-it0-f52.google.com ([209.85.214.52]:36388) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1egjGl-0003k5-Ik; Tue, 30 Jan 2018 22:41:07 -0500 Received: by mail-it0-f52.google.com with SMTP id n206so3326078itg.1; Tue, 30 Jan 2018 19:41:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=WcOrxaC6rt+10lj98sz6O7vL7ZgRku7SBi94hwYPLw0=; b=eb9h0nIST8kmEm2gVwepywVByGt4O77RPS79YRqibwf6S0OSvk/soWxiwfPourVNhO bO8/m2ZYrismcEcLhbkb/+Bwn6GrUh4/UfEKq4P+nv4ZCi6sbWBZKUOHjI6ZBgKWgpRA 31iKfLlJZMRa1+QdMpO7cpwy+mG2lAWfdruE6RVPpoBn3bdq3SWuHgt9VkdzsCts7LEJ mquK/dm3QXK6kg/WvxsgfNXYgMoGMkwr7ZCKS+A2MIpKd3ZgAFfFIFFYfHmMDdP57yKU U7U/DHFX/iAQfWQompnCM4rV1N1EnFoVIbPSo0G4GnDfecfeso43iLBoY1SnI6LGVw1h GAiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=WcOrxaC6rt+10lj98sz6O7vL7ZgRku7SBi94hwYPLw0=; b=UTFiS8TTkQXLufLse+PGAcwPl6mxpmCL1TwhxtapYvygr+OA/nKoyHuzaRjA77AloA HJyGEVGTjUPFSUHMcezzXSF8Qr52cTQQVrMs/mkxvoNbNAl8fnGrnARKWKOSY8Yfeqs2 8GeKKD3rphCdHEIOYVMsjLmypEI2RqFPifuVX2agBhLnWwZ8tOeb8TrapXh/74GRXj2A LKic1KN6xwlVSXITY4PdRnbP9yj66EI7YjwAIFZAIzy5btSOVlcMfWFTOaSvpRjSq7lq QnDuN8h6jhMLsHBUbfBkr5KxgW1IywOLwTxM2VTQW9QD0ixcWp02oVpmXpQnlvcRQDgO x6JQ== X-Gm-Message-State: AKwxytcTMQ2JcxgG0uEba1T7eL+Icz/aQIzxjHkhBttxZdMXInT3b56A cU68YIZTqXQkHPFsT/RXEhqrAA== X-Google-Smtp-Source: AH8x227wLxnAu/oC52SRISNwyxyaIXh9AsOfnCeQqXWyDMfXf9z5j7HdrncLAVtBgxxFfuS2lYVi/A== X-Received: by 10.36.91.203 with SMTP id g194mr24764070itb.118.1517370061923; Tue, 30 Jan 2018 19:41:01 -0800 (PST) Received: from zebian ([45.2.119.34]) by smtp.googlemail.com with ESMTPSA id d1sm6952283iti.18.2018.01.30.19.41.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 30 Jan 2018 19:41:01 -0800 (PST) From: Noam Postavsky To: Nikolay Kudryavtsev Subject: Re: bug#23650: Use of locate-file for directories is underdocumented References: <80ca6c90-0bfa-1cc5-c63f-0dc8a5fee83d@gmail.com> Date: Tue, 30 Jan 2018 22:40:59 -0500 In-Reply-To: <80ca6c90-0bfa-1cc5-c63f-0dc8a5fee83d@gmail.com> (Nikolay Kudryavtsev's message of "Mon, 30 May 2016 01:44:11 +0300") Message-ID: <87y3kehf04.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 23650 Cc: 23650@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) tags 23650 fixed close 23650 26.1 quit Nikolay Kudryavtsev writes: > 1. According to the docstring it would only return a directory if > PREDICATE returns 'dir-ok. This is not mentioned in the Elisp > reference. > > 2. The reference suggests file-directory-p as a useful predicate and > this would fail due to 1. > > 3. It's probably a good idea to mention that there are no bundled > predicates that return dir-ok, and suggest to use a lamda like this: > (lambda (f) (and (file-directory-p f) 'dir-ok)) as a PREDICATE. > > > Here's a working example, just in case: > > (locate-file "Git" '("c:/Program Files/") nil (lambda (f) (and > (file-directory-p f) 'dir-ok))) Added a clarifiction and a similar example (though not one with w32 path) in emacs-26. [1: f706c59093]: 2018-01-30 22:14:02 -0500 Update manual description of locate-file (Bug#23650) https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=f706c59093645a6306dd907833d597884e69c0ac From unknown Mon Jun 23 02:26:41 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 28 Feb 2018 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator