diff options
| author | Juanma Barranquero | 2007-11-20 16:40:16 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2007-11-20 16:40:16 +0000 |
| commit | 1571d112d97475f53d99a3aff303139ff6ac748b (patch) | |
| tree | 182df168bce5d58c1e5bb857ab9f9687269a3c0d /lisp | |
| parent | 48b4313069f1c3e6d8bc1f5e3e4729833a088d32 (diff) | |
| download | emacs-1571d112d97475f53d99a3aff303139ff6ac748b.tar.gz emacs-1571d112d97475f53d99a3aff303139ff6ac748b.zip | |
(xargs-program): New variable.
(grep-compute-defaults): Use it.
(grep-default-command): Doc fix.
(grep, lgrep, rgrep): Reflow docstrings.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/progmodes/grep.el | 48 |
2 files changed, 36 insertions, 22 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 84fc597c93d..4d04952b62e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2007-11-20 Juanma Barranquero <lekktu@gmail.com> | ||
| 2 | |||
| 3 | * progmodes/grep.el (xargs-program): New variable. | ||
| 4 | (grep-compute-defaults): Use it. | ||
| 5 | (grep-default-command): Doc fix. | ||
| 6 | (grep, lgrep, rgrep): Reflow docstrings. | ||
| 7 | |||
| 1 | 2007-11-20 Dan Nicolaescu <dann@ics.uci.edu> | 8 | 2007-11-20 Dan Nicolaescu <dann@ics.uci.edu> |
| 2 | 9 | ||
| 3 | * vc.el (vc-find-revision): Set the parent buffer. | 10 | * vc.el (vc-find-revision): Set the parent buffer. |
| @@ -14,8 +21,7 @@ | |||
| 14 | * emacs-lisp/tcover-ses.el (ses-set-curcell, ses-update-cells) | 21 | * emacs-lisp/tcover-ses.el (ses-set-curcell, ses-update-cells) |
| 15 | (ses-load, ses-vector-delete, ses-create-header-string) | 22 | (ses-load, ses-vector-delete, ses-create-header-string) |
| 16 | (ses-read-cell, ses-read-symbol, ses-command-hook, ses-jump): | 23 | (ses-read-cell, ses-read-symbol, ses-command-hook, ses-jump): |
| 17 | * emacs-lisp/gulp.el (mail-subject, mail-send): Declare as | 24 | * emacs-lisp/gulp.el (mail-subject, mail-send): Declare as functions. |
| 18 | functions. | ||
| 19 | 25 | ||
| 20 | 2007-11-20 Stefan Monnier <monnier@iro.umontreal.ca> | 26 | 2007-11-20 Stefan Monnier <monnier@iro.umontreal.ca> |
| 21 | 27 | ||
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 091735ee09d..1fee8cbd093 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el | |||
| @@ -333,6 +333,12 @@ This variable's value takes effect when `grep-compute-defaults' is called.") | |||
| 333 | This variable's value takes effect when `grep-compute-defaults' is called.") | 333 | This variable's value takes effect when `grep-compute-defaults' is called.") |
| 334 | 334 | ||
| 335 | ;;;###autoload | 335 | ;;;###autoload |
| 336 | (defvar xargs-program "xargs" | ||
| 337 | "The default xargs program for `grep-find-command'. | ||
| 338 | See `grep-find-use-xargs'. | ||
| 339 | This variable's value takes effect when `grep-compute-defaults' is called.") | ||
| 340 | |||
| 341 | ;;;###autoload | ||
| 336 | (defvar grep-find-use-xargs nil | 342 | (defvar grep-find-use-xargs nil |
| 337 | "Non-nil means that `grep-find' uses the `xargs' utility by default. | 343 | "Non-nil means that `grep-find' uses the `xargs' utility by default. |
| 338 | If `exec', use `find -exec'. | 344 | If `exec', use `find -exec'. |
| @@ -475,15 +481,15 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'." | |||
| 475 | (cond | 481 | (cond |
| 476 | ((and | 482 | ((and |
| 477 | (grep-probe find-program `(nil nil nil ,null-device "-print0")) | 483 | (grep-probe find-program `(nil nil nil ,null-device "-print0")) |
| 478 | (grep-probe "xargs" `(nil nil nil "-0" "-e" "echo"))) | 484 | (grep-probe xargs-program `(nil nil nil "-0" "-e" "echo"))) |
| 479 | 'gnu) | 485 | 'gnu) |
| 480 | (t | 486 | (t |
| 481 | 'exec)))) | 487 | 'exec)))) |
| 482 | (unless grep-find-command | 488 | (unless grep-find-command |
| 483 | (setq grep-find-command | 489 | (setq grep-find-command |
| 484 | (cond ((eq grep-find-use-xargs 'gnu) | 490 | (cond ((eq grep-find-use-xargs 'gnu) |
| 485 | (format "%s . -type f -print0 | xargs -0 -e %s" | 491 | (format "%s . -type f -print0 | %s -0 -e %s" |
| 486 | find-program grep-command)) | 492 | find-program xargs-program grep-command)) |
| 487 | ((eq grep-find-use-xargs 'exec) | 493 | ((eq grep-find-use-xargs 'exec) |
| 488 | (let ((cmd0 (format "%s . -type f -exec %s" | 494 | (let ((cmd0 (format "%s . -type f -exec %s" |
| 489 | find-program grep-command))) | 495 | find-program grep-command))) |
| @@ -493,22 +499,22 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'." | |||
| 493 | (shell-quote-argument ";")) | 499 | (shell-quote-argument ";")) |
| 494 | (1+ (length cmd0))))) | 500 | (1+ (length cmd0))))) |
| 495 | (t | 501 | (t |
| 496 | (format "%s . -type f -print | xargs %s" | 502 | (format "%s . -type f -print | %s %s" |
| 497 | find-program grep-command))))) | 503 | find-program xargs-program grep-command))))) |
| 498 | (unless grep-find-template | 504 | (unless grep-find-template |
| 499 | (setq grep-find-template | 505 | (setq grep-find-template |
| 500 | (let ((gcmd (format "%s <C> %s <R>" | 506 | (let ((gcmd (format "%s <C> %s <R>" |
| 501 | grep-program grep-options))) | 507 | grep-program grep-options))) |
| 502 | (cond ((eq grep-find-use-xargs 'gnu) | 508 | (cond ((eq grep-find-use-xargs 'gnu) |
| 503 | (format "%s . <X> -type f <F> -print0 | xargs -0 -e %s" | 509 | (format "%s . <X> -type f <F> -print0 | %s -0 -e %s" |
| 504 | find-program gcmd)) | 510 | find-program xargs-program gcmd)) |
| 505 | ((eq grep-find-use-xargs 'exec) | 511 | ((eq grep-find-use-xargs 'exec) |
| 506 | (format "%s . <X> -type f <F> -exec %s {} %s %s" | 512 | (format "%s . <X> -type f <F> -exec %s {} %s %s" |
| 507 | find-program gcmd null-device | 513 | find-program gcmd null-device |
| 508 | (shell-quote-argument ";"))) | 514 | (shell-quote-argument ";"))) |
| 509 | (t | 515 | (t |
| 510 | (format "%s . <X> -type f <F> -print | xargs %s" | 516 | (format "%s . <X> -type f <F> -print | %s %s" |
| 511 | find-program gcmd)))))))) | 517 | find-program xargs-program gcmd)))))))) |
| 512 | (unless (or (not grep-highlight-matches) (eq grep-highlight-matches t)) | 518 | (unless (or (not grep-highlight-matches) (eq grep-highlight-matches t)) |
| 513 | (setq grep-highlight-matches | 519 | (setq grep-highlight-matches |
| 514 | (with-temp-buffer | 520 | (with-temp-buffer |
| @@ -543,7 +549,7 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'." | |||
| 543 | "")) | 549 | "")) |
| 544 | 550 | ||
| 545 | (defun grep-default-command () | 551 | (defun grep-default-command () |
| 546 | "Compute the default grep command for C-u M-x grep to offer." | 552 | "Compute the default grep command for \\[universal-argument] \\[grep] to offer." |
| 547 | (let ((tag-default (shell-quote-argument (grep-tag-default))) | 553 | (let ((tag-default (shell-quote-argument (grep-tag-default))) |
| 548 | ;; This a regexp to match single shell arguments. | 554 | ;; This a regexp to match single shell arguments. |
| 549 | ;; Could someone please add comments explaining it? | 555 | ;; Could someone please add comments explaining it? |
| @@ -596,19 +602,19 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'." | |||
| 596 | "Run grep, with user-specified args, and collect output in a buffer. | 602 | "Run grep, with user-specified args, and collect output in a buffer. |
| 597 | While grep runs asynchronously, you can use \\[next-error] (M-x next-error), | 603 | While grep runs asynchronously, you can use \\[next-error] (M-x next-error), |
| 598 | or \\<grep-mode-map>\\[compile-goto-error] in the grep \ | 604 | or \\<grep-mode-map>\\[compile-goto-error] in the grep \ |
| 599 | output buffer, to go to the lines | 605 | output buffer, to go to the lines where grep |
| 600 | where grep found matches. | 606 | found matches. |
| 601 | 607 | ||
| 602 | For doing a recursive `grep', see the `rgrep' command. For running | 608 | For doing a recursive `grep', see the `rgrep' command. For running |
| 603 | `grep' in a specific directory, see `lgrep'. | 609 | `grep' in a specific directory, see `lgrep'. |
| 604 | 610 | ||
| 605 | This command uses a special history list for its COMMAND-ARGS, so you can | 611 | This command uses a special history list for its COMMAND-ARGS, so you |
| 606 | easily repeat a grep command. | 612 | can easily repeat a grep command. |
| 607 | 613 | ||
| 608 | A prefix argument says to default the argument based upon the current | 614 | A prefix argument says to default the argument based upon the current |
| 609 | tag the cursor is over, substituting it into the last grep command | 615 | tag the cursor is over, substituting it into the last grep command |
| 610 | in the grep command history (or into `grep-command' | 616 | in the grep command history (or into `grep-command' if that history |
| 611 | if that history list is empty)." | 617 | list is empty)." |
| 612 | (interactive | 618 | (interactive |
| 613 | (progn | 619 | (progn |
| 614 | (grep-compute-defaults) | 620 | (grep-compute-defaults) |
| @@ -736,8 +742,9 @@ before it is executed. | |||
| 736 | With two \\[universal-argument] prefixes, directly edit and run `grep-command'. | 742 | With two \\[universal-argument] prefixes, directly edit and run `grep-command'. |
| 737 | 743 | ||
| 738 | Collect output in a buffer. While grep runs asynchronously, you | 744 | Collect output in a buffer. While grep runs asynchronously, you |
| 739 | can use \\[next-error] (M-x next-error), or \\<grep-mode-map>\\[compile-goto-error] | 745 | can use \\[next-error] (M-x next-error), or \\<grep-mode-map>\\[compile-goto-error] \ |
| 740 | in the grep output buffer, to go to the lines where grep found matches. | 746 | in the grep output buffer, |
| 747 | to go to the lines where grep found matches. | ||
| 741 | 748 | ||
| 742 | This command shares argument histories with \\[rgrep] and \\[grep]." | 749 | This command shares argument histories with \\[rgrep] and \\[grep]." |
| 743 | (interactive | 750 | (interactive |
| @@ -797,8 +804,9 @@ before it is executed. | |||
| 797 | With two \\[universal-argument] prefixes, directly edit and run `grep-find-command'. | 804 | With two \\[universal-argument] prefixes, directly edit and run `grep-find-command'. |
| 798 | 805 | ||
| 799 | Collect output in a buffer. While find runs asynchronously, you | 806 | Collect output in a buffer. While find runs asynchronously, you |
| 800 | can use \\[next-error] (M-x next-error), or \\<grep-mode-map>\\[compile-goto-error] | 807 | can use \\[next-error] (M-x next-error), or \\<grep-mode-map>\\[compile-goto-error] \ |
| 801 | in the grep output buffer, to go to the lines where grep found matches. | 808 | in the grep output buffer, |
| 809 | to go to the lines where grep found matches. | ||
| 802 | 810 | ||
| 803 | This command shares argument histories with \\[lgrep] and \\[grep-find]." | 811 | This command shares argument histories with \\[lgrep] and \\[grep-find]." |
| 804 | (interactive | 812 | (interactive |