From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.bugs Subject: Re: [patch] 21.3 executable.el - New func executable-command-find-unix-p Date: Tue, 27 Jan 2004 12:35:20 -0700 Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <4016BD78.30101@yahoo.com> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1075232270 6157 80.91.224.253 (27 Jan 2004 19:37:50 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 27 Jan 2004 19:37:50 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jan 27 20:37:43 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AlZ1q-0000Ym-00 for ; Tue, 27 Jan 2004 20:37:42 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AlZ1H-00056w-2J for geb-bug-gnu-emacs@m.gmane.org; Tue, 27 Jan 2004 14:37:07 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AlZ1D-000554-Hs for bug-gnu-emacs@prep.ai.mit.edu; Tue, 27 Jan 2004 14:37:03 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AlZ0g-0004sU-Rb for bug-gnu-emacs@prep.ai.mit.edu; Tue, 27 Jan 2004 14:37:01 -0500 Original-Received: from [193.4.58.12] (helo=horus.isnic.is) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.24) id 1AlZ0f-0004Rl-Ui for bug-gnu-emacs@prep.ai.mit.edu; Tue, 27 Jan 2004 14:36:30 -0500 Original-Received: from mail.fu-berlin.de (root@mail.fu-berlin.de [160.45.11.165]) by horus.isnic.is (8.12.9p2/8.12.9/isnic) with ESMTP id i0RJZOcs081349 for ; Tue, 27 Jan 2004 19:35:24 GMT (envelope-from ihs_4664@yahoo.com) Original-Received: by mail.fu-berlin.de (Smail3.2.0.98) from Curry.ZEDAT.FU-Berlin.DE (160.45.10.36) with esmtp id ; Tue, 27 Jan 2004 20:35:23 +0100 (MET) Original-Received: by Curry.ZEDAT.FU-Berlin.DE (Smail3.2.0.98) from news.fu-berlin.de with bsmtp id ; Tue, 27 Jan 2004 20:35:23 +0100 (MET) Original-To: gnu-emacs-bug@moderators.isc.org Original-Path: 170.207.51.80!not-for-mail Original-Newsgroups: gnu.emacs.bug Original-Lines: 64 X-Orig-NNTP-Posting-Host: 170.207.51.80 X-Orig-X-Trace: news.uni-berlin.de 1075232123 26300436 170.207.51.80 ([82742]) User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 X-Accept-Language: en-us X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list 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 Xref: main.gmane.org gmane.emacs.bugs:6791 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:6791 Jari Aalto+mail.linux wrote: > I intend to fix grep-find, so we need common function to test > find(1) in compile.el and filecache.el. This would also benefit > igrep.el and other packages that depend on find(1). -maxdepth is a non-POSIX, GNU extension. On Solaris 8 (SunOS 5.8), both /usr/bin/find and /usr/xpg4/bin/find report find: bad option -maxdepth > 2004-01-27 Tue Jari Aalto poboxes.com> > > * progmodes/executable.el (executable-command-find-unix-p): > New. Check if find(1) is Unix type command. > > > Index: executable.el > =================================================================== > RCS file: /cygdrive/h/data/version-control/cvsroot/emacs/gnu-emacs/lisp213/progmodes/executable.el,v > retrieving revision 1.1 > retrieving revision 1.2 > diff -u -IId: -b -w -u -r1.1 -r1.2 > --- executable.el 26 Jun 2003 18:06:37 -0000 1.1 > +++ executable.el 27 Jan 2004 12:58:49 -0000 1.2 > @@ -144,6 +144,31 @@ > '(""))) > > ;;;###autoload > +(defun executable-command-find-unix-p (&optional program) > + "Check if command 'find' is Unix type program. > +The patch to command can be assing in PROGRAM." > + ;; Pick file to search from location we know > + (let* ((dir (car load-path)) > + (file (find-if > + (lambda (x) > + ;; Filter directories . and .. > + (not (string-match "^\\.\\.?$" x))) > + (directory-files dir)))) > + (with-temp-buffer > + (call-process (or program "find") > + nil > + (current-buffer) > + nil > + dir > + "-name" > + file > + "-maxdepth" > + "1") > + (goto-char (point-min)) > + (if (search-forward file nil t) > + t)))) > + > +;;;###autoload > (defun executable-find (command) > "Search for COMMAND in exec-path and return the absolute file name. > Return nil if COMMAND is not found anywhere in `exec-path'." -- Kevin Rodgers