diff lisp/packages/igrep.el @ 173:8eaf7971accc r20-3b13

Import from CVS: tag r20-3b13
author cvs
date Mon, 13 Aug 2007 09:49:09 +0200
parents 1856695b1fa9
children 78f53ef88e17
line wrap: on
line diff
--- a/lisp/packages/igrep.el	Mon Aug 13 09:47:55 2007 +0200
+++ b/lisp/packages/igrep.el	Mon Aug 13 09:49:09 2007 +0200
@@ -160,17 +160,18 @@
 (require 'compile)			; compile-internal and grep-regexp-
 					; alist
 
+(eval-when-compile
+  (require 'dired))
+
 (defconst igrep-version "2.56"
   "Version of igrep.el")
 
 
 ;;; User options:
 
-(progn
-  (defgroup igrep nil
-    "An improved interface to `grep'."
-    :group 'processes)
-  )
+(defgroup igrep nil
+  "An improved interface to `grep'."
+  :group 'processes)
 
 (defcustom igrep-options nil
   "*The options passed by \\[igrep] to `igrep-program', or nil.
@@ -310,17 +311,25 @@
 
 ;;; Commands:
 
-;; ;;;###autoload Not ready to replace compile.el's grep yet.  -sb 
-(defadvice grep (around igrep-interface first (&rest grep-args) activate)
-  "If called interactively, use the \\[igrep] interface instead,
+;; This used to be evaluated at top level.  We consider it evil, so it
+;; goes into a user-callable function.    --hniksic
+;;;###autoload
+(defun igrep-insinuate ()
+  "Replace the `grep' functions with `igrep'."
+  (defadvice grep (around igrep-interface first (&rest grep-args) activate)
+    "If called interactively, use the \\[igrep] interface instead,
 where GREP-ARGS is (PROGRAM EXPRESSION FILES OPTIONS);
 if called programmatically, GREP-ARGS is still (COMMAND)."
-  (interactive (igrep-read-args))
-  (if (interactive-p)
-      (apply (function igrep) grep-args)
-    ad-do-it))
+    (interactive (igrep-read-args))
+    (if (interactive-p)
+	(apply (function igrep) grep-args)
+      ad-do-it))
+  (defalias 'grep-find 'igrep-find)
+  (defalias 'dired-do-grep 'dired-do-igrep)
+  (defalias 'dired-do-grep-find 'dired-do-igrep-find))
 
-(defalias 'grep-find 'igrep-find)
+
+(defvar win32-quote-process-args)	; XEmacs
 
 ;;;###autoload
 (defun igrep (program expression files &optional options)
@@ -519,7 +528,6 @@
 	 options))
 
 ;;;###autoload
-(defalias 'dired-do-grep 'dired-do-igrep)
 
 ;; Dired recursive (`find`) commands:
 
@@ -538,9 +546,6 @@
   (let ((igrep-find t))
     (dired-do-igrep program expression options arg)))
 
-;;;###autoload
-(defalias 'dired-do-grep-find 'dired-do-igrep-find)
-
 
 ;;; Utilities: