unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* [patch] 21.3 filecache.el - Added Cygwin support
@ 2004-01-24  9:25 Jari Aalto+mail.emacs
  2004-01-24 10:46 ` Eli Zaretskii
       [not found] ` <mailman.1267.1074941456.928.bug-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 10+ messages in thread
From: Jari Aalto+mail.emacs @ 2004-01-24  9:25 UTC (permalink / raw)



2004-01-24 Sat  Jari Aalto  <jari.aalto@poboxes.com>

        * filecache.el
        (file-cache-find-unix-p): New function. Detect Cygwin.
        (file-cache-add-directory-using-find): Added Cygwin support
        (file-cache-find-command-unix-flag): New user variable.


Index: filecache.el
===================================================================
RCS file: /cygdrive/h/data/version-control/cvsroot/emacs/gnu-emacs/lisp213/filecache.el,v
retrieving revision 1.2
diff -u -IId: -b -w -u -r1.2 filecache.el
--- filecache.el	24 Jan 2004 08:32:49 -0000	1.2
+++ filecache.el	24 Jan 2004 09:18:06 -0000
@@ -165,6 +165,17 @@
   :type 'string
   :group 'file-cache)
 
+(defcustom file-cache-find-command-unix-flag 'not-defined
+  "*Set to t, if `file-cache-find-command' us Unix type find.
+This variable is automatically set to nil or non-nil if the initial value
+is 'not-defined by first call to function
+`file-cache-add-directory-using-find'.
+
+Under Windows operating system where Cygwin is available, this value
+should be set to t."
+  :type  'boolean
+  :group 'file-cache)
+
 (defcustom file-cache-locate-command "locate"
   "*External program used by `file-cache-add-directory-using-locate'."
   :type 'string
@@ -316,17 +327,39 @@
                     file-cache-alist)))
       )))
 
+(defun file-cache-find-unix-p ()
+  "Check if `file-cache-find-command' is Unix type program."
+  (or (not (eq system-type 'windows-nt))  ;; Assume Unix system
+      (with-temp-buffer                   ;; Cygwin?
+        (call-process file-cache-find-command
+                      nil
+                      (current-buffer)
+                      nil
+                      "--version")
+        (goto-char (point-min))
+        ;; Cygwin
+        (if (re-search-forward "GNU" nil t)
+            (buffer-string)))))
+
 (defun file-cache-add-directory-using-find (directory)
   "Use the `find' command to add files to the file cache.
 Find is run in DIRECTORY."
   (interactive "DAdd files under directory: ")
   (let ((dir (expand-file-name directory)))
+    (if (eq file-cache-find-command-unix-flag 'not-defined)
+        (setq file-cache-find-command-unix-flag (file-cache-find-unix-p)))
     (set-buffer (get-buffer-create file-cache-buffer))
     (erase-buffer)
     (call-process file-cache-find-command nil
                   (get-buffer file-cache-buffer) nil
                   dir "-name"
-                  (if (eq system-type 'windows-nt) "'*'" "*")
+                  (cond
+                   (file-cache-find-command-unix-flag
+                    "\\*")
+                   ((eq system-type 'windows-nt)
+                    "'*'")
+                   (t
+                    "*"))
                   "-print")
     (file-cache-add-from-file-cache-buffer)))

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-01-27  8:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2004-01-27  8:10             ` Eli Zaretskii
2004-01-26 18:51       ` Kevin Rodgers
2004-01-27  8:20         ` Eli Zaretskii

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).