bug-gnu-emacs
[Top][All Lists]
Advanced

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

[patch] 21.3 compile.el -- grep-find fix


From: Jari Aalto+mail.linux
Subject: [patch] 21.3 compile.el -- grep-find fix
Date: Tue, 27 Jan 2004 15:24:14 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/20.7 (windows-nt) (i386-*-nt5.0.2195)

This patch assumes that executable.el has been patched.

2004-01-27 Tue  Jari Aalto  <jari.aalto <AT> poboxes.com>

        * progmodes/compile.el
        (top level): Added atuload for `executable-command-find-unix-p'
        (grep-compute-defaults):
        Check if `grep-find-command' is Unix type find(1), if
        not, print message and set grep-find-command to nil.
        (grep-find): Check `grep-find-command'.


Index: compile.el
===================================================================
RCS file: 
/cygdrive/h/data/version-control/cvsroot/emacs/gnu-emacs/lisp213/progmodes/compile.el,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -IId: -b -w -u -r1.2 -r1.3
--- compile.el  14 Aug 2003 20:37:05 -0000      1.2
+++ compile.el  27 Jan 2004 13:21:55 -0000      1.3
@@ -31,6 +31,8 @@
 
 ;;; Code:
 
+(autoload 'executable-command-find-unix-p "executable")
+
 (defgroup compilation nil
   "Run compiler as inferior of Emacs, parse error messages."
   :group 'tools
@@ -88,7 +90,13 @@
               'gnu)))
   (unless grep-find-command
     (setq grep-find-command
-          (cond ((eq grep-find-use-xargs 'gnu)
+          (cond
+           ((not (executable-command-find-unix-p "find"))
+            (message
+             (concat "compile.el: Unix type find(1) not found. "
+                     "Please set `grep-find-command'."))
+            nil)
+           ((eq grep-find-use-xargs 'gnu)
                  (format "%s . -type f -print0 | xargs -0 -e %s"
                          find-program grep-command))
                 (grep-find-use-xargs
@@ -698,11 +706,17 @@
    (progn
      (unless grep-find-command
        (grep-compute-defaults))
+     (if grep-find-command
      (list (read-from-minibuffer "Run find (like this): "
                                  grep-find-command nil nil
-                                 'grep-find-history))))
+                                     'grep-find-history))
+       ;; No default was set
+       (read-string
+        "compile.el: No `grep-find-command' command available. Press RET.")
+       (list nil))))
+  (when (and grep-find-command command-args)
   (let ((null-device nil))              ; see grep
-    (grep command-args)))
+      (grep command-args))))
 
 (defcustom compilation-scroll-output nil
   "*Non-nil to scroll the *compilation* buffer window as output appears.



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




reply via email to

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