[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [patch] 21.3 executable.el - New func executable-command-find-unix-p
From: |
Jari Aalto+mail.linux |
Subject: |
Re: [patch] 21.3 executable.el - New func executable-command-find-unix-p |
Date: |
Wed, 28 Jan 2004 23:00:30 +0200 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/20.7 (windows-nt) (i386-*-nt5.0.2195) |
* Tue 2004-01-27 Kevin Rodgers <ihs_4664 <AT> yahoo.com> gnu.emacs.bug
*
<http://groups.google.com/groups?oi=djq&as_umsgid=%3Cmailman.1466.1075232226.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
Right. The message is a good indication of Unix find(1) as well. Here
fix for the previous code. Also added couple of options more like -print.
2004-01-28 Jari Aalto <jaalto@w2kpicasso>
* progmodes/executable.el (executable-command-find-unix-p):
Check basic find which does not support -maxdepth.
Return find(1) type: 'gnu, t or nil.
Index: executable.el
===================================================================
RCS file:
/cygdrive/h/data/version-control/cvsroot/emacs/gnu-emacs/lisp213/progmodes/executable.el,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -IId: -b -w -u -r1.2 -r1.3
--- executable.el 27 Jan 2004 12:58:49 -0000 1.2
+++ executable.el 28 Jan 2004 20:56:16 -0000 1.3
@@ -52,6 +52,8 @@
;;; Code:
+(autoload 'find-if "cl-seq")
+
(defgroup executable nil
"Base functionality for executable interpreter scripts"
:group 'processes)
@@ -146,27 +148,43 @@
;;;###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."
+The path to command can be assing in PROGRAM.
+
+Return:
+ 'gnu for GNU find(1)
+ t for other unix compatible find(1)"
;; 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)))
+ (and (not (string-match "^\\.\\.?$" x))
+ ;; load-path may contain stale directories.
+ (file-directory-p x)))
(directory-files dir))))
(with-temp-buffer
- (call-process (or program "find")
+ (call-process
+ (or program "find")
nil
(current-buffer)
nil
dir
"-name"
file
+ "-mount"
+ "-print"
+ ;; GNU find(1) understands this
+ ;; Solaris 8 (SunOS 5.8), both
+ ;; /usr/bin/find and /usr/xpg4/bin/find report
+ ;; reports "find: bad option -maxdepth"
"-maxdepth"
"1")
(goto-char (point-min))
- (if (search-forward file nil t)
- t))))
+ (cond
+ ((search-forward file nil t)
+ 'gnu)
+ ((search-forward "find: bad option -maxdepth")
+ t)))))
;;;###autoload
(defun executable-find (command)
--
http://tiny-tools.sourceforge.net/
Swatch @time http://www.mir.com.my/iTime/itime.htm
http://www.ryanthiessen.com/swatch/resources.htm
Use Licenses! http://www.linuxjournal.com/article.php?sid=6225
Which Licence? http://www.linuxjournal.com/article.php?sid=4825
OSI Licences http://www.opensource.org/licenses/