unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: jari.aalto@poboxes.com (Jari Aalto+mail.emacs)
Subject: [patch] 21.3 filecache.el - Added Cygwin support
Date: Sat, 24 Jan 2004 11:25:08 +0200	[thread overview]
Message-ID: <brothf63.fsf@blue.sea.net> (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)))

             reply	other threads:[~2004-01-24  9:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-24  9:25 Jari Aalto+mail.emacs [this message]
2004-01-24 10:46 ` [patch] 21.3 filecache.el - Added Cygwin support 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

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