[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patch] 21.3 filecache.el - Added Cygwin support

From: Jari Aalto+mail.linux
Subject: Re: [patch] 21.3 filecache.el - Added Cygwin support
Date: Mon, 26 Jan 2004 21:22:42 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/20.7 (windows-nt) (i386-*-nt5.0.2195)

* 2004-01-26 Eli Zaretskii <eliz <AT> elta.co.il> gnu.emacs.bug
* <http://groups.google.com/groups?oi=djq&address@hidden>
| > From: jari.aalto <AT> poboxes.com (Jari Aalto+mail.linux)
| > But --version does not work in SunOS, HP, SGI, IBM, they have
| > their own find and making tests for all of those is beyond my reach.
| You could create a file and see if "find . -name THAT-FILE" finds it
| and prints its name like a Unixy `find' should, for example.

Yes, that would work. Patch below.

| > | What about the Mac?
| You are looking at the docs for the wrong variable: your code, quite
| correctly, works with system-type, not with window-system.
| windows-nt and ms-dos are values of system-type, while the
| corresponding values for window-system are pc and w32 (assuming these
| ports are not run with the -nw switch).
Correct. I was looking at wrong variable. But about that mac, is it covered
by values?

    ms-dos windows-nt

Would it be good to mention mac somewhere in the documentation as well?

          Microsoft MS-DOS "operating system."  Emacs compiled with
          DJGPP for MS-DOS binds `system-type' to `ms-dos' even when
          you run it on MS-Windows.

          Microsoft windows NT.  The same executable supports Windows
          9X, but the value of `system-type' is `windows-nt' in either


2004-01-26 Mon  Jari Aalto  <jari.aalto <AT> poboxes.com>

        (file-cache-find-unix-p): 1.6 Rewrote. Search a file
        by using Unix find(1) syntax. OS independent check.

Index: filecache.el
RCS file: 
retrieving revision 1.5
retrieving revision 1.7
diff -u -IId: -b -w -u -r1.5 -r1.7
--- filecache.el        26 Jan 2004 00:12:13 -0000      1.5
+++ filecache.el        26 Jan 2004 19:16:23 -0000      1.7
@@ -329,26 +329,26 @@
 (defun file-cache-find-unix-p ()
   "Check if `file-cache-find-command' is Unix type program."
-  ;;  First, assume Unix system, which alreat has find(1).
-  ;;  SunOS, HP, IBM have their own versions of find(1).
-  (or (not (memq system-type
-                 '(windows-nt
-                   pc
-                   w32
-                   mac
-                   ms-dos)))
-      ;;  This is PC system, do we expect to find GNU find(1)
-      ;;  like one bundled in Cygwin?
+  ;;  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))))
         (call-process file-cache-find-command
-                      "--version")
+                    dir
+                    "-name"
+                    file
+                    "-maxdepth"
+                    "1")
         (goto-char (point-min))
-        ;; Cygwin
-        (if (re-search-forward "GNU" nil t)
-            (buffer-string)))))
+        (if (search-forward file nil t)
+            t))))
 (defun file-cache-add-directory-using-find (directory)
   "Use the `find' command to add files to the file cache.


Swatch @time   http://www.mir.com.my/iTime/itime.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/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]