unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: [patch] 21.3 executable.el - New func executable-command-find-unix-p
Date: Tue, 27 Jan 2004 12:35:20 -0700	[thread overview]
Message-ID: <4016BD78.30101@yahoo.com> (raw)
In-Reply-To: mailman.1449.1075209556.928.bug-gnu-emacs@gnu.org

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  <jari.aalto <AT> 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

       reply	other threads:[~2004-01-27 19:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1449.1075209556.928.bug-gnu-emacs@gnu.org>
2004-01-27 19:35 ` Kevin Rodgers [this message]
     [not found] ` <mailman.1466.1075232226.928.bug-gnu-emacs@gnu.org>
2004-01-28 21:00   ` [patch] 21.3 executable.el - New func executable-command-find-unix-p Jari Aalto+mail.linux
     [not found]   ` <mailman.1524.1075323038.928.bug-gnu-emacs@gnu.org>
2004-02-03 16:38     ` Jari Aalto+mail.linux
2004-01-27 13:02 Jari Aalto+mail.linux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4016BD78.30101@yahoo.com \
    --to=ihs_4664@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).