;;; 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.
(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.")
;;;###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")
(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."
(compilation-start regexp 'grep-mode))
(setq dir (file-name-as-directory (expand-file-name dir)))
(require 'find-dired) ; for `find-name-arg'
- ;; In Tramp, there could be problems if the command line is too
- ;; long. We escape it, therefore.
(let ((command (grep-expand-template
grep-find-template
regexp
(mapconcat
#'shell-quote-argument
(split-string files)
- (concat "\\\n" " -o " find-name-arg " "))
+ (concat " -o " find-name-arg " "))
" "
(shell-quote-argument ")"))
dir
(concat "*/"
(cdr ignore)))))))
grep-find-ignored-directories
- "\\\n -o -path ")
+ " -o -path ")
" "
(shell-quote-argument ")")
" -prune -o "))
(shell-quote-argument
(cdr ignore))))))
grep-find-ignored-files
- "\\\n -o -name ")
+ " -o -name ")
" "
(shell-quote-argument ")")
" -prune -o "))))))