unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: jari.aalto@poboxes.com (Jari Aalto+mail.linux)
Subject: Re: [patch] 21.3 filecache.el - Added Cygwin support
Date: Mon, 26 Jan 2004 21:22:42 +0200	[thread overview]
Message-ID: <65eybjlp.fsf@blue.sea.net> (raw)
In-Reply-To: mailman.1345.1075100321.928.bug-gnu-emacs@gnu.org

* 2004-01-26 Eli Zaretskii <eliz <AT> elta.co.il> gnu.emacs.bug
* <http://groups.google.com/groups?oi=djq&as_umsgid=%3Cmailman.1345.1075100321.928.bug-gnu-emacs@gnu.org>
| > 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?

    `ms-dos'
          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.

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

Jari


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: /cygdrive/h/data/version-control/cvsroot/emacs/gnu-emacs/lisp213/filecache.el,v
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))))
       (with-temp-buffer
         (call-process file-cache-find-command
                       nil
                       (current-buffer)
                       nil
-                      "--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.

 

-- 
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/

  parent reply	other threads:[~2004-01-26 19:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-24  9:25 [patch] 21.3 filecache.el - Added Cygwin support Jari Aalto+mail.emacs
2004-01-24 10:46 ` Eli Zaretskii
     [not found] ` <mailman.1267.1074941456.928.bug-gnu-emacs@gnu.org>
2004-01-25 11:52   ` Jari Aalto+mail.linux
2004-01-25 14:09     ` Eli Zaretskii
     [not found]     ` <mailman.1309.1075039727.928.bug-gnu-emacs@gnu.org>
2004-01-26  0:25       ` Jari Aalto+mail.linux
2004-01-26  6:59         ` Eli Zaretskii
     [not found]         ` <mailman.1345.1075100321.928.bug-gnu-emacs@gnu.org>
2004-01-26 19:22           ` Jari Aalto+mail.linux [this message]
2004-01-27  8:10             ` Eli Zaretskii
2004-01-26 18:51       ` Kevin Rodgers
2004-01-27  8:20         ` Eli Zaretskii

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=65eybjlp.fsf@blue.sea.net \
    --to=jari.aalto@poboxes.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).