From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Eli Zaretskii" Newsgroups: gmane.emacs.devel Subject: Re: locate-file in Emacs Date: Wed, 17 Apr 2002 08:47:53 +0300 Sender: emacs-devel-admin@gnu.org Message-ID: <379-Wed17Apr2002084752+0300-eliz@is.elta.co.il> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: localhost.gmane.org X-Trace: main.gmane.org 1019023029 12673 127.0.0.1 (17 Apr 2002 05:57:09 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 17 Apr 2002 05:57:09 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 16xiRJ-0003II-00 for ; Wed, 17 Apr 2002 07:57:09 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 16xijr-0000ti-00 for ; Wed, 17 Apr 2002 08:16:19 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16xiRG-0000Js-00; Wed, 17 Apr 2002 01:57:06 -0400 Original-Received: from heimdall.inter.net.il ([192.114.186.17]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16xiOt-0000FE-00 for ; Wed, 17 Apr 2002 01:54:39 -0400 Original-Received: from zaretsky (diup-217-34.inter.net.il [213.8.217.34]) by heimdall.inter.net.il (Mirapoint Messaging Server MOS 2.9.3.2) with ESMTP id BHY26397; Wed, 17 Apr 2002 08:54:28 +0300 (IDT) Original-To: hniksic@arsdigita.com X-Mailer: emacs 21.2.50 (via feedmail 8 I) and Blat ver 1.8.9 In-Reply-To: (message from Hrvoje Niksic on Wed, 17 Apr 2002 07:05:26 +0200) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:2687 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:2687 > From: Hrvoje Niksic > Date: Wed, 17 Apr 2002 07:05:26 +0200 > > For example, to find an elisp file in load-path, one would use this: > > (locate-file "simple" load-path '(".elc" ".el")) > => "/usr/local/lib/xemacs-21.4.6/lisp/simple.elc" > > Or, to locate a Unix executable: > > (locate-file "ls" (split-string (getenv "PATH") path-separator) > nil 'executable) > => "/bin/ls" > > To make the same code work under Windows: > > (locate-file "links" (split-string (getenv "PATH") path-separator) > '("" ".exe") 'executable) > => "/usr/bin/links" > > I find that there are many uses for this kind of lookup across a list > of directories, and I would like to be able to use this function in > portable elisp programs. The XEmacs version is written in C with > (probably) unclear copyright status, but Richard agreed to include a > Lisp version of the function. I came back to that yesterday and wrote > one. > > The code follows below. Please let me know what you think. I'm not saying that we already have this functionality (I didn't check that), but I thought I'd mention similar functionality: - executable-find in executable.el - find-lisp.el - the openp function (implemented in C) which can be used as a base for either a C primitive or a Lisp function (it is currently used by `load'). I do agree that the feature you suggest is a useful one.