Mercurial > hg > xemacs-beta
comparison 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 |
comparison
equal
deleted
inserted
replaced
172:a38aed19690b | 173:8eaf7971accc |
---|---|
158 | 158 |
159 (require 'backquote) ; igrep-with-default-in-history | 159 (require 'backquote) ; igrep-with-default-in-history |
160 (require 'compile) ; compile-internal and grep-regexp- | 160 (require 'compile) ; compile-internal and grep-regexp- |
161 ; alist | 161 ; alist |
162 | 162 |
163 (eval-when-compile | |
164 (require 'dired)) | |
165 | |
163 (defconst igrep-version "2.56" | 166 (defconst igrep-version "2.56" |
164 "Version of igrep.el") | 167 "Version of igrep.el") |
165 | 168 |
166 | 169 |
167 ;;; User options: | 170 ;;; User options: |
168 | 171 |
169 (progn | 172 (defgroup igrep nil |
170 (defgroup igrep nil | 173 "An improved interface to `grep'." |
171 "An improved interface to `grep'." | 174 :group 'processes) |
172 :group 'processes) | |
173 ) | |
174 | 175 |
175 (defcustom igrep-options nil | 176 (defcustom igrep-options nil |
176 "*The options passed by \\[igrep] to `igrep-program', or nil. | 177 "*The options passed by \\[igrep] to `igrep-program', or nil. |
177 | 178 |
178 `-n' will automatically be passed to `igrep-program', to generate the | 179 `-n' will automatically be passed to `igrep-program', to generate the |
308 "The minibuffer history list for \\[igrep]'s FILES argument.") | 309 "The minibuffer history list for \\[igrep]'s FILES argument.") |
309 | 310 |
310 | 311 |
311 ;;; Commands: | 312 ;;; Commands: |
312 | 313 |
313 ;; ;;;###autoload Not ready to replace compile.el's grep yet. -sb | 314 ;; This used to be evaluated at top level. We consider it evil, so it |
314 (defadvice grep (around igrep-interface first (&rest grep-args) activate) | 315 ;; goes into a user-callable function. --hniksic |
315 "If called interactively, use the \\[igrep] interface instead, | 316 ;;;###autoload |
317 (defun igrep-insinuate () | |
318 "Replace the `grep' functions with `igrep'." | |
319 (defadvice grep (around igrep-interface first (&rest grep-args) activate) | |
320 "If called interactively, use the \\[igrep] interface instead, | |
316 where GREP-ARGS is (PROGRAM EXPRESSION FILES OPTIONS); | 321 where GREP-ARGS is (PROGRAM EXPRESSION FILES OPTIONS); |
317 if called programmatically, GREP-ARGS is still (COMMAND)." | 322 if called programmatically, GREP-ARGS is still (COMMAND)." |
318 (interactive (igrep-read-args)) | 323 (interactive (igrep-read-args)) |
319 (if (interactive-p) | 324 (if (interactive-p) |
320 (apply (function igrep) grep-args) | 325 (apply (function igrep) grep-args) |
321 ad-do-it)) | 326 ad-do-it)) |
322 | 327 (defalias 'grep-find 'igrep-find) |
323 (defalias 'grep-find 'igrep-find) | 328 (defalias 'dired-do-grep 'dired-do-igrep) |
329 (defalias 'dired-do-grep-find 'dired-do-igrep-find)) | |
330 | |
331 | |
332 (defvar win32-quote-process-args) ; XEmacs | |
324 | 333 |
325 ;;;###autoload | 334 ;;;###autoload |
326 (defun igrep (program expression files &optional options) | 335 (defun igrep (program expression files &optional options) |
327 "*Run `grep` PROGRAM to match EXPRESSION in FILES. | 336 "*Run `grep` PROGRAM to match EXPRESSION in FILES. |
328 The output is displayed in the *igrep* buffer, which \\[next-error] and | 337 The output is displayed in the *igrep* buffer, which \\[next-error] and |
517 'dired-mark-get-files)) | 526 'dired-mark-get-files)) |
518 t arg) | 527 t arg) |
519 options)) | 528 options)) |
520 | 529 |
521 ;;;###autoload | 530 ;;;###autoload |
522 (defalias 'dired-do-grep 'dired-do-igrep) | |
523 | 531 |
524 ;; Dired recursive (`find`) commands: | 532 ;; Dired recursive (`find`) commands: |
525 | 533 |
526 ;;;###autoload | 534 ;;;###autoload |
527 (defun dired-do-igrep-find (program expression &optional options arg) | 535 (defun dired-do-igrep-find (program expression &optional options arg) |
535 (setcdr (nthcdr 1 igrep-args) (nthcdr 3 igrep-args)) | 543 (setcdr (nthcdr 1 igrep-args) (nthcdr 3 igrep-args)) |
536 ;; Append ARG: | 544 ;; Append ARG: |
537 (nconc igrep-args (list current-prefix-arg)))) | 545 (nconc igrep-args (list current-prefix-arg)))) |
538 (let ((igrep-find t)) | 546 (let ((igrep-find t)) |
539 (dired-do-igrep program expression options arg))) | 547 (dired-do-igrep program expression options arg))) |
540 | |
541 ;;;###autoload | |
542 (defalias 'dired-do-grep-find 'dired-do-igrep-find) | |
543 | 548 |
544 | 549 |
545 ;;; Utilities: | 550 ;;; Utilities: |
546 | 551 |
547 (defsubst igrep-file-directory (name) | 552 (defsubst igrep-file-directory (name) |