From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: jari.aalto@poboxes.com (Jari Aalto+mail.linux) Newsgroups: gmane.emacs.bugs Subject: Re: [patch] 21.3 filecache.el - Added Cygwin support Date: Mon, 26 Jan 2004 21:22:42 +0200 Organization: Private Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <65eybjlp.fsf@blue.sea.net> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1075144806 25752 80.91.224.253 (26 Jan 2004 19:20:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 26 Jan 2004 19:20:06 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jan 26 20:19:58 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AlCH7-0003e9-00 for ; Mon, 26 Jan 2004 20:19:58 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AlCGq-0006v0-SC for geb-bug-gnu-emacs@m.gmane.org; Mon, 26 Jan 2004 14:19:40 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AlCFf-0006SS-Ij for bug-gnu-emacs@prep.ai.mit.edu; Mon, 26 Jan 2004 14:18:27 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AlCF6-0006H0-Lx for bug-gnu-emacs@prep.ai.mit.edu; Mon, 26 Jan 2004 14:18:23 -0500 Original-Received: from [132.239.1.53] (helo=mailbox1.ucsd.edu) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.24) id 1AlC9I-00056J-L6 for bug-gnu-emacs@prep.ai.mit.edu; Mon, 26 Jan 2004 14:11:55 -0500 Original-Received: from smtp33.kolumbus.fi (smtp33.kolumbus.fi [193.229.0.33]) by mailbox1.ucsd.edu (8.12.10/8.12.9) with ESMTP id i0QJBd1X044657 for ; Mon, 26 Jan 2004 11:11:40 -0800 (PST) Original-Received: from news.kolumbus.fi (news.kolumbus.fi [193.229.0.31]) by smtp33.kolumbus.fi (8.12.10/8.12.4) with ESMTP id i0QJBYWT023561 for ; Mon, 26 Jan 2004 21:11:34 +0200 (EET) Original-Received: (from news@localhost) by news.kolumbus.fi (8.11.6+Sun/8.11.6) id i0QJBXh15768 for gnu-emacs-bug@moderators.isc.org; Mon, 26 Jan 2004 21:11:33 +0200 (EET) Original-To: gnu-emacs-bug@moderators.isc.org Original-Path: not-for-mail Original-Newsgroups: gnu.emacs.bug Original-Lines: 105 Original-NNTP-Posting-Host: a110t7.elisa.omakaista.fi Original-X-Trace: phys-news1.kolumbus.fi 1075144293 13048 81.197.3.110 (26 Jan 2004 19:11:33 GMT) Original-X-Complaints-To: abuse@kolumbus.fi Original-NNTP-Posting-Date: Mon, 26 Jan 2004 19:11:33 +0000 (UTC) User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/20.7 (windows-nt) (i386-*-nt5.0.2195) Cancel-Lock: sha1:QHAvTrl4t11b/fu/5j0UjrP52Xk= X-Spamscanner: mailbox1.ucsd.edu (v1.4 Oct 30 2003 22:20:52, 0.0/5.0 2.60) X-MailScanner: PASSED (v1.2.8 12025 i0QJBd1X044657 mailbox1.ucsd.edu) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:6768 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:6768 * 2004-01-26 Eli Zaretskii elta.co.il> gnu.emacs.bug * | > From: jari.aalto 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 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/