* progmodes/grep.el (find-program): Doc fix.
[bpt/emacs.git] / lisp / progmodes / grep.el
index c8a0dc4..3c7f936 100644 (file)
@@ -1,10 +1,10 @@
 ;;; grep.el --- run `grep' and display the results
 
-;; Copyright (C) 1985-1987, 1993-1999, 2001-2013 Free Software
+;; Copyright (C) 1985-1987, 1993-1999, 2001-2014 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Roland McGrath <roland@gnu.org>
-;; Maintainer: FSF
+;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: tools, processes
 
 ;; This file is part of GNU Emacs.
@@ -246,6 +246,7 @@ See `compilation-error-screen-columns'"
   (let ((map (make-sparse-keymap)))
     (set-keymap-parent map compilation-minor-mode-map)
     (define-key map " " 'scroll-up-command)
+    (define-key map [?\S-\ ] 'scroll-down-command)
     (define-key map "\^?" 'scroll-down-command)
     (define-key map "\C-c\C-f" 'next-error-follow-minor-mode)
 
@@ -359,7 +360,7 @@ Notice that using \\[next-error] or \\[compile-goto-error] modifies
        (when grep-highlight-matches
          (let* ((beg (match-end 0))
                 (end (save-excursion (goto-char beg) (line-end-position)))
-                (mbeg (text-property-any beg end 'font-lock-face 'match)))
+                (mbeg (text-property-any beg end 'font-lock-face grep-match-face)))
            (when mbeg
              (- mbeg beg)))))
       .
@@ -367,7 +368,7 @@ Notice that using \\[next-error] or \\[compile-goto-error] modifies
        (when grep-highlight-matches
          (let* ((beg (match-end 0))
                 (end (save-excursion (goto-char beg) (line-end-position)))
-                (mbeg (text-property-any beg end 'font-lock-face 'match))
+                (mbeg (text-property-any beg end 'font-lock-face grep-match-face))
                 (mend (and mbeg (next-single-property-change mbeg 'font-lock-face nil end))))
            (when mend
              (- mend beg)))))))
@@ -409,7 +410,9 @@ Notice that using \\[next-error] or \\[compile-goto-error] modifies
       (0 '(face nil compilation-message nil help-echo nil mouse-face nil) t)
       (1 grep-error-face)
       (2 grep-error-face nil t))
-     ("^.+?-[0-9]+-.*\n" (0 grep-context-face)))
+     ;; "filename-linenumber-" format is used for context lines in GNU grep,
+     ;; "filename=linenumber=" for lines with function names in "git grep -p".
+     ("^.+?[-=][0-9]+[-=].*\n" (0 grep-context-face)))
    "Additional things to highlight in grep output.
 This gets tacked on the end of the generated expressions.")
 
@@ -420,8 +423,9 @@ This variable's value takes effect when `grep-compute-defaults' is called.")
 
 ;;;###autoload
 (defvar find-program (purecopy "find")
-  "The default find program for `grep-find-command'.
-This variable's value takes effect when `grep-compute-defaults' is called.")
+  "The default find program.
+This is used by commands like `grep-find-command', `find-dired'
+and others.")
 
 ;;;###autoload
 (defvar xargs-program (purecopy "xargs")
@@ -586,7 +590,7 @@ This function is called from `compilation-filter-hook'."
                  'exec-plus)
                 ((and
                   (grep-probe find-program `(nil nil nil ,null-device "-print0"))
-                  (grep-probe xargs-program `(nil nil nil "-0" "-e" "echo")))
+                  (grep-probe xargs-program `(nil nil nil "-0" "echo")))
                  'gnu)
                 (t
                  'exec))))
@@ -596,7 +600,7 @@ This function is called from `compilation-filter-hook'."
                       ;; Windows shells need the program file name
                       ;; after the pipe symbol be quoted if they use
                       ;; forward slashes as directory separators.
-                      (format "%s . -type f -print0 | \"%s\" -0 -e %s"
+                      (format "%s . -type f -print0 | \"%s\" -0 %s"
                               find-program xargs-program grep-command))
                      ((memq grep-find-use-xargs '(exec exec-plus))
                       (let ((cmd0 (format "%s . -type f -exec %s"
@@ -621,7 +625,7 @@ This function is called from `compilation-filter-hook'."
                                (format "%s " null-device)
                              "")))
                  (cond ((eq grep-find-use-xargs 'gnu)
-                        (format "%s . <X> -type f <F> -print0 | \"%s\" -0 -e %s"
+                        (format "%s . <X> -type f <F> -print0 | \"%s\" -0 %s"
                                 find-program xargs-program gcmd))
                        ((eq grep-find-use-xargs 'exec)
                         (format "%s . <X> -type f <F> -exec %s {} %s%s"
@@ -816,12 +820,7 @@ substitution string.  Note dynamic scoping of variables.")
 
 (defun grep-read-regexp ()
   "Read regexp arg for interactive grep."
-  (let ((default (grep-tag-default)))
-    (read-regexp
-     (concat "Search for"
-            (if (and default (> (length default) 0))
-                (format " (default \"%s\"): " default) ": "))
-     default 'grep-regexp-history)))
+  (read-regexp "Search for" 'grep-tag-default 'grep-regexp-history))
 
 (defun grep-read-files (regexp)
   "Read files arg for interactive grep."
@@ -997,9 +996,10 @@ to specify a command to run."
                      regexp
                      (concat (shell-quote-argument "(")
                              " " find-name-arg " "
-                             (mapconcat #'shell-quote-argument
-                                        (split-string files)
-                                        (concat " -o " find-name-arg " "))
+                             (mapconcat
+                              #'shell-quote-argument
+                              (split-string files)
+                              (concat " -o " find-name-arg " "))
                              " "
                              (shell-quote-argument ")"))
                      dir