annotate lisp/progmodes/grep.el @ 53871:dbe1ef05fa24

(eshell-hist-word-reference): Fix format string.
author Andreas Schwab <schwab@suse.de>
date Sun, 08 Feb 2004 22:40:55 +0000
parents 823980f7d612
children 1bd1c7b73c9d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
53139
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
1 ;;; grep.el --- run compiler as inferior of Emacs, parse error messages
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
2
53851
823980f7d612 (grep-regexp-alist): Allow :, \t and ( in file names.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 53750
diff changeset
3 ;; Copyright (C) 1985, 86, 87, 93, 94, 95, 96, 97, 98, 1999, 2001, 02, 2004
53139
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
4 ;; Free Software Foundation, Inc.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
5
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
6 ;; Author: Roland McGrath <roland@gnu.org>
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
7 ;; Maintainer: FSF
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
8 ;; Keywords: tools, processes
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
9
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
11
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
15 ;; any later version.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
16
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
20 ;; GNU General Public License for more details.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
21
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
25 ;; Boston, MA 02111-1307, USA.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
26
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
27 ;;; Commentary:
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
28
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
29 ;; This package provides the grep facilities documented in the Emacs
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
30 ;; user's manual.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
31
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
32 ;;; Code:
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
33
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
34 (require 'compile)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
35
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
36 (defgroup grep nil
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
37 "Run compiler as inferior of Emacs, parse error messages."
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
38 :group 'tools
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
39 :group 'processes)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
40
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
41
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
42 ;;;###autoload
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
43 (defcustom grep-window-height nil
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
44 "*Number of lines in a grep window. If nil, use `compilation-window-height'."
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
45 :type '(choice (const :tag "Default" nil)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
46 integer)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
47 :version "21.4"
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
48 :group 'grep)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
49
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
50 (defcustom grep-auto-highlight t
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
51 "*Specify how many grep matches to highlight (and parse) initially.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
52 \(Highlighting applies to an grep match when the mouse is over it.)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
53 If this is a number N, all grep matches in the first N lines
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
54 are highlighted and parsed as soon as they arrive in Emacs.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
55 If t, highlight and parse the whole grep output as soon as it arrives.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
56 If nil, don't highlight or parse any of the grep buffer until you try to
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
57 move to the error messages.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
58
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
59 Those grep matches which are not parsed and highlighted initially
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
60 will be parsed and highlighted as soon as you try to move to them."
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
61 :type '(choice (const :tag "All" t)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
62 (const :tag "None" nil)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
63 (integer :tag "First N lines"))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
64 :version "21.4"
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
65 :group 'grep)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
66
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
67 (defcustom grep-scroll-output nil
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
68 "*Non-nil to scroll the *grep* buffer window as output appears.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
69
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
70 Setting it causes the grep commands to put point at the end of their
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
71 output window so that the end of the output is always visible rather
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
72 than the begining."
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
73 :type 'boolean
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
74 :version "21.4"
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
75 :group 'grep)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
76
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
77 (defcustom grep-command nil
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
78 "The default grep command for \\[grep].
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
79 If the grep program used supports an option to always include file names
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
80 in its output (such as the `-H' option to GNU grep), it's a good idea to
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
81 include it when specifying `grep-command'.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
82
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
83 The default value of this variable is set up by `grep-compute-defaults';
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
84 call that function before using this variable in your program."
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
85 :type '(choice string
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
86 (const :tag "Not Set" nil))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
87 :group 'grep)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
88
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
89 (defcustom grep-use-null-device 'auto-detect
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
90 "If t, append the value of `null-device' to `grep' commands.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
91 This is done to ensure that the output of grep includes the filename of
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
92 any match in the case where only a single file is searched, and is not
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
93 necessary if the grep program used supports the `-H' option.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
94
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
95 The default value of this variable is set up by `grep-compute-defaults';
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
96 call that function before using this variable in your program."
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
97 :type 'boolean
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
98 :type '(choice (const :tag "Do Not Append Null Device" nil)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
99 (const :tag "Append Null Device" t)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
100 (other :tag "Not Set" auto-detect))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
101 :group 'grep)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
102
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
103 (defcustom grep-find-command nil
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
104 "The default find command for \\[grep-find].
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
105 The default value of this variable is set up by `grep-compute-defaults';
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
106 call that function before using this variable in your program."
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
107 :type '(choice string
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
108 (const :tag "Not Set" nil))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
109 :group 'grep)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
110
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
111 (defcustom grep-tree-command nil
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
112 "The default find command for \\[grep-tree].
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
113 The default value of this variable is set up by `grep-compute-defaults';
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
114 call that function before using this variable in your program.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
115 The following place holders should be present in the string:
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
116 <D> - base directory for find
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
117 <X> - find options to restrict or expand the directory list
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
118 <F> - find options to limit the files matched
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
119 <C> - place to put -i if case insensitive grep
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
120 <R> - the regular expression searched for."
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
121 :type '(choice string
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
122 (const :tag "Not Set" nil))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
123 :version "21.4"
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
124 :group 'grep)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
125
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
126 (defcustom grep-tree-files-aliases '(
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
127 ("ch" . "*.[ch]")
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
128 ("c" . "*.c")
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
129 ("h" . "*.h")
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
130 ("m" . "[Mm]akefile*")
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
131 ("asm" . "*.[sS]")
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
132 ("all" . "*")
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
133 ("el" . "*.el")
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
134 )
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
135 "*Alist of aliases for the FILES argument to `grep-tree'."
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
136 :type 'alist
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
137 :group 'grep)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
138
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
139 (defcustom grep-tree-ignore-case t
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
140 "*If non-nil, `grep-tree' ignores case in matches."
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
141 :type 'boolean
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
142 :group 'grep)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
143
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
144 (defcustom grep-tree-ignore-CVS-directories t
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
145 "*If non-nil, `grep-tree' does no recurse into CVS directories."
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
146 :type 'boolean
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
147 :group 'grep)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
148
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
149 ;;;###autoload
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
150 (defcustom grep-setup-hook nil
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
151 "List of hook functions run by `grep-process-setup' (see `run-hooks')."
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
152 :type 'hook
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
153 :group 'grep)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
154
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
155 (defvar grep-mode-map
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
156 (let ((map (cons 'keymap compilation-minor-mode-map)))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
157 (define-key map " " 'scroll-up)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
158 (define-key map "\^?" 'scroll-down)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
159
53486
23376885b0f9 (grep-mode-map): Don't remap next-line, previous-line.
Richard M. Stallman <rms@gnu.org>
parents: 53154
diff changeset
160 ;; This is intolerable -- rms
23376885b0f9 (grep-mode-map): Don't remap next-line, previous-line.
Richard M. Stallman <rms@gnu.org>
parents: 53154
diff changeset
161 ;;; (define-key map [remap next-line] 'compilation-next-error)
23376885b0f9 (grep-mode-map): Don't remap next-line, previous-line.
Richard M. Stallman <rms@gnu.org>
parents: 53154
diff changeset
162 ;;; (define-key map [remap previous-line] 'compilation-previous-error)
53139
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
163
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
164 (define-key map "\r" 'compile-goto-error) ;; ?
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
165 (define-key map "n" 'next-error-no-select)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
166 (define-key map "p" 'previous-error-no-select)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
167 (define-key map "{" 'compilation-previous-file)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
168 (define-key map "}" 'compilation-next-file)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
169 (define-key map "\t" 'compilation-next-file)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
170
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
171 ;; Set up the menu-bar
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
172 (define-key map [menu-bar grep]
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
173 (cons "Grep" (make-sparse-keymap "Grep")))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
174
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
175 (define-key map [menu-bar grep compilation-kill-compilation]
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
176 '("Kill Grep" . kill-compilation))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
177 (define-key map [menu-bar grep compilation-separator2]
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
178 '("----" . nil))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
179 (define-key map [menu-bar grep compilation-compile]
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
180 '("Compile..." . compile))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
181 (define-key map [menu-bar grep compilation-grep]
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
182 '("Another grep" . grep))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
183 (define-key map [menu-bar grep compilation-recompile]
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
184 '("Repeat grep" . recompile))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
185 (define-key map [menu-bar grep compilation-separator2]
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
186 '("----" . nil))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
187 (define-key map [menu-bar grep compilation-first-error]
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
188 '("First Match" . first-error))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
189 (define-key map [menu-bar grep compilation-previous-error]
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
190 '("Previous Match" . previous-error))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
191 (define-key map [menu-bar grep compilation-next-error]
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
192 '("Next Match" . next-error))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
193 map)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
194 "Keymap for grep buffers.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
195 `compilation-minor-mode-map' is a cdr of this.")
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
196
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
197 ;;;; TODO --- refine this!!
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
198
53145
a0151f86f01e Remove grep-use-compilation-buffer defcustom.
Kim F. Storm <storm@cua.dk>
parents: 53139
diff changeset
199 ;;; (defcustom grep-use-compilation-buffer t
a0151f86f01e Remove grep-use-compilation-buffer defcustom.
Kim F. Storm <storm@cua.dk>
parents: 53139
diff changeset
200 ;;; "When non-nil, grep specific commands update `compilation-last-buffer'.
a0151f86f01e Remove grep-use-compilation-buffer defcustom.
Kim F. Storm <storm@cua.dk>
parents: 53139
diff changeset
201 ;;; This means that standard compile commands like \\[next-error] and \\[compile-goto-error]
a0151f86f01e Remove grep-use-compilation-buffer defcustom.
Kim F. Storm <storm@cua.dk>
parents: 53139
diff changeset
202 ;;; can be used to navigate between grep matches (the default).
a0151f86f01e Remove grep-use-compilation-buffer defcustom.
Kim F. Storm <storm@cua.dk>
parents: 53139
diff changeset
203 ;;; Otherwise, the grep specific commands like \\[grep-next-match] must
a0151f86f01e Remove grep-use-compilation-buffer defcustom.
Kim F. Storm <storm@cua.dk>
parents: 53139
diff changeset
204 ;;; be used to navigate between grep matches."
a0151f86f01e Remove grep-use-compilation-buffer defcustom.
Kim F. Storm <storm@cua.dk>
parents: 53139
diff changeset
205 ;;; :type 'boolean
a0151f86f01e Remove grep-use-compilation-buffer defcustom.
Kim F. Storm <storm@cua.dk>
parents: 53139
diff changeset
206 ;;; :group 'grep)
53139
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
207
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
208 ;; override compilation-last-buffer
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
209 (defvar grep-last-buffer nil
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
210 "The most recent grep buffer.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
211 A grep buffer becomes most recent when its process is started
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
212 or when it is used with \\[grep-next-match].
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
213 Notice that using \\[next-error] or \\[compile-goto-error] modifies
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
214 `complation-last-buffer' rather than `grep-last-buffer'.")
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
215
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
216 ;; Note: the character class after the optional drive letter does not
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
217 ;; include a space to support file names with blanks.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
218 (defvar grep-regexp-alist
53851
823980f7d612 (grep-regexp-alist): Allow :, \t and ( in file names.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 53750
diff changeset
219 '(("\\([a-zA-Z]?:?.+?\\)[:( \t]+\\([0-9]+\\)[:) \t]" 1 2))
53139
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
220 "Regexp used to match grep hits. See `compilation-error-regexp-alist'.")
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
221
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
222 (defvar grep-program
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
223 ;; Currently zgrep has trouble. It runs egrep instead of grep,
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
224 ;; and it doesn't pass along long options right.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
225 "grep"
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
226 ;; (if (equal (condition-case nil ; in case "zgrep" isn't in exec-path
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
227 ;; (call-process "zgrep" nil nil nil
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
228 ;; "foo" null-device)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
229 ;; (error nil))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
230 ;; 1)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
231 ;; "zgrep"
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
232 ;; "grep")
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
233 "The default grep program for `grep-command' and `grep-find-command'.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
234 This variable's value takes effect when `grep-compute-defaults' is called.")
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
235
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
236 (defvar find-program "find"
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
237 "The default find program for `grep-find-command'.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
238 This variable's value takes effect when `grep-compute-defaults' is called.")
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
239
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
240 (defvar grep-find-use-xargs nil
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
241 "Whether \\[grep-find] uses the `xargs' utility by default.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
242
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
243 If nil, it uses `find -exec'; if `gnu', it uses `find -print0' and `xargs -0';
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
244 if not nil and not `gnu', it uses `find -print' and `xargs'.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
245
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
246 This variable's value takes effect when `grep-compute-defaults' is called.")
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
247
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
248 ;; History of grep commands.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
249 (defvar grep-history nil)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
250 (defvar grep-find-history nil)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
251
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
252 (defun grep-process-setup ()
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
253 "Setup compilation variables and buffer for `grep'.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
254 Set up `compilation-exit-message-function' and `compilation-window-height'.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
255 Sets `grep-last-buffer' and runs `grep-setup-hook'."
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
256 (setq grep-last-buffer (current-buffer))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
257 (set (make-local-variable 'compilation-exit-message-function)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
258 (lambda (status code msg)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
259 (if (eq status 'exit)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
260 (cond ((zerop code)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
261 '("finished (matches found)\n" . "matched"))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
262 ((= code 1)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
263 '("finished with no matches found\n" . "no match"))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
264 (t
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
265 (cons msg code)))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
266 (cons msg code))))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
267 (if grep-window-height
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
268 (set (make-local-variable 'compilation-window-height)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
269 grep-window-height))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
270 (set (make-local-variable 'compile-auto-highlight)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
271 grep-auto-highlight)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
272 (set (make-local-variable 'compilation-scroll-output)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
273 grep-scroll-output)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
274 (run-hooks 'grep-setup-hook))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
275
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
276 (defun grep-compute-defaults ()
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
277 (unless (or (not grep-use-null-device) (eq grep-use-null-device t))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
278 (setq grep-use-null-device
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
279 (with-temp-buffer
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
280 (let ((hello-file (expand-file-name "HELLO" data-directory)))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
281 (not
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
282 (and (equal (condition-case nil
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
283 (if grep-command
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
284 ;; `grep-command' is already set, so
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
285 ;; use that for testing.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
286 (call-process-shell-command
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
287 grep-command nil t nil
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
288 "^English" hello-file)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
289 ;; otherwise use `grep-program'
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
290 (call-process grep-program nil t nil
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
291 "-nH" "^English" hello-file))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
292 (error nil))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
293 0)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
294 (progn
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
295 (goto-char (point-min))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
296 (looking-at
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
297 (concat (regexp-quote hello-file)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
298 ":[0-9]+:English")))))))))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
299 (unless grep-command
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
300 (setq grep-command
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
301 (let ((required-options (if grep-use-null-device "-n" "-nH")))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
302 (if (equal (condition-case nil ; in case "grep" isn't in exec-path
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
303 (call-process grep-program nil nil nil
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
304 "-e" "foo" null-device)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
305 (error nil))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
306 1)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
307 (format "%s %s -e " grep-program required-options)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
308 (format "%s %s " grep-program required-options)))))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
309 (unless grep-find-use-xargs
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
310 (setq grep-find-use-xargs
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
311 (if (and
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
312 (equal (call-process "find" nil nil nil
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
313 null-device "-print0")
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
314 0)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
315 (equal (call-process "xargs" nil nil nil
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
316 "-0" "-e" "echo")
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
317 0))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
318 'gnu)))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
319 (unless grep-find-command
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
320 (setq grep-find-command
53750
4deb14fde58c (grep-compute-defaults): Use executable-command-find-posix-p.
Richard M. Stallman <rms@gnu.org>
parents: 53486
diff changeset
321 (cond ((not (executable-command-find-unix-p "find"))
4deb14fde58c (grep-compute-defaults): Use executable-command-find-posix-p.
Richard M. Stallman <rms@gnu.org>
parents: 53486
diff changeset
322 (message
4deb14fde58c (grep-compute-defaults): Use executable-command-find-posix-p.
Richard M. Stallman <rms@gnu.org>
parents: 53486
diff changeset
323 (concat "compile.el: Unix type find(1) not found. "
4deb14fde58c (grep-compute-defaults): Use executable-command-find-posix-p.
Richard M. Stallman <rms@gnu.org>
parents: 53486
diff changeset
324 "Please set `grep-find-command'."))
4deb14fde58c (grep-compute-defaults): Use executable-command-find-posix-p.
Richard M. Stallman <rms@gnu.org>
parents: 53486
diff changeset
325 nil)
4deb14fde58c (grep-compute-defaults): Use executable-command-find-posix-p.
Richard M. Stallman <rms@gnu.org>
parents: 53486
diff changeset
326 ((eq grep-find-use-xargs 'gnu)
53139
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
327 (format "%s . -type f -print0 | xargs -0 -e %s"
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
328 find-program grep-command))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
329 (grep-find-use-xargs
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
330 (format "%s . -type f -print | xargs %s"
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
331 find-program grep-command))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
332 (t (cons (format "%s . -type f -exec %s {} %s \\;"
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
333 find-program grep-command null-device)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
334 (+ 22 (length grep-command)))))))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
335 (unless grep-tree-command
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
336 (setq grep-tree-command
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
337 (let* ((glen (length grep-program))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
338 (gcmd (concat grep-program " <C>" (substring grep-command glen))))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
339 (cond ((eq grep-find-use-xargs 'gnu)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
340 (format "%s <D> <X> -type f <F> -print0 | xargs -0 -e %s <R>"
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
341 find-program gcmd))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
342 (grep-find-use-xargs
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
343 (format "%s <D> <X> -type f <F> -print | xargs %s <R>"
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
344 find-program gcmd))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
345 (t (format "%s <D> <X> -type f <F> -exec %s <R> {} %s \\;"
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
346 find-program gcmd null-device)))))))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
347
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
348 (defun grep-default-command ()
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
349 (let ((tag-default
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
350 (funcall (or find-tag-default-function
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
351 (get major-mode 'find-tag-default-function)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
352 ;; We use grep-tag-default instead of
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
353 ;; find-tag-default, to avoid loading etags.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
354 'grep-tag-default)))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
355 (sh-arg-re "\\(\\(?:\"\\(?:[^\"]\\|\\\\\"\\)+\"\\|'[^']+'\\|[^\"' \t\n]\\)+\\)")
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
356 (grep-default (or (car grep-history) grep-command)))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
357 ;; Replace the thing matching for with that around cursor.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
358 (when (or (string-match
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
359 (concat "[^ ]+\\s +\\(?:-[^ ]+\\s +\\)*"
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
360 sh-arg-re "\\(\\s +\\(\\S +\\)\\)?")
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
361 grep-default)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
362 ;; If the string is not yet complete.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
363 (string-match "\\(\\)\\'" grep-default))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
364 (unless (or (not (stringp buffer-file-name))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
365 (when (match-beginning 2)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
366 (save-match-data
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
367 (string-match
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
368 (wildcard-to-regexp
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
369 (file-name-nondirectory
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
370 (match-string 3 grep-default)))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
371 (file-name-nondirectory buffer-file-name)))))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
372 (setq grep-default (concat (substring grep-default
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
373 0 (match-beginning 2))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
374 " *."
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
375 (file-name-extension buffer-file-name))))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
376 (replace-match (or tag-default "") t t grep-default 1))))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
377
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
378 ;;;###autoload
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
379 (defun grep (command-args &optional highlight-regexp)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
380 "Run grep, with user-specified args, and collect output in a buffer.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
381 While grep runs asynchronously, you can use \\[next-error] (M-x next-error),
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
382 or \\<grep-minor-mode-map>\\[compile-goto-error] in the grep \
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
383 output buffer, to go to the lines
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
384 where grep found matches.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
385
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
386 This command uses a special history list for its COMMAND-ARGS, so you can
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
387 easily repeat a grep command.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
388
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
389 A prefix argument says to default the argument based upon the current
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
390 tag the cursor is over, substituting it into the last grep command
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
391 in the grep command history (or into `grep-command'
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
392 if that history list is empty).
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
393
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
394 If specified, optional second arg HIGHLIGHT-REGEXP is the regexp to
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
395 temporarily highlight in visited source lines."
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
396 (interactive
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
397 (progn
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
398 (unless (and grep-command
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
399 (or (not grep-use-null-device) (eq grep-use-null-device t)))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
400 (grep-compute-defaults))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
401 (let ((default (grep-default-command)))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
402 (list (read-from-minibuffer "Run grep (like this): "
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
403 (if current-prefix-arg
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
404 default grep-command)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
405 nil nil 'grep-history
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
406 (if current-prefix-arg nil default))))))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
407
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
408 ;; Setting process-setup-function makes exit-message-function work
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
409 ;; even when async processes aren't supported.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
410 (let* ((compilation-process-setup-function 'grep-process-setup)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
411 (buf (compile-internal (if (and grep-use-null-device null-device)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
412 (concat command-args " " null-device)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
413 command-args)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
414 "No more grep hits" "grep"
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
415 ;; Give it a simpler regexp to match.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
416 nil grep-regexp-alist
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
417 nil nil nil nil nil nil
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
418 highlight-regexp grep-mode-map)))))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
419
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
420 ;; This is a copy of find-tag-default from etags.el.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
421 (defun grep-tag-default ()
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
422 (save-excursion
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
423 (while (looking-at "\\sw\\|\\s_")
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
424 (forward-char 1))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
425 (when (or (re-search-backward "\\sw\\|\\s_"
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
426 (save-excursion (beginning-of-line) (point))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
427 t)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
428 (re-search-forward "\\(\\sw\\|\\s_\\)+"
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
429 (save-excursion (end-of-line) (point))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
430 t))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
431 (goto-char (match-end 0))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
432 (buffer-substring (point)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
433 (progn (forward-sexp -1)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
434 (while (looking-at "\\s'")
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
435 (forward-char 1))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
436 (point))))))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
437
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
438 ;;;###autoload
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
439 (defun grep-find (command-args)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
440 "Run grep via find, with user-specified args COMMAND-ARGS.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
441 Collect output in a buffer.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
442 While find runs asynchronously, you can use the \\[next-error] command
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
443 to find the text that grep hits refer to.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
444
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
445 This command uses a special history list for its arguments, so you can
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
446 easily repeat a find command."
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
447 (interactive
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
448 (progn
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
449 (unless grep-find-command
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
450 (grep-compute-defaults))
53750
4deb14fde58c (grep-compute-defaults): Use executable-command-find-posix-p.
Richard M. Stallman <rms@gnu.org>
parents: 53486
diff changeset
451 (if grep-find-command
4deb14fde58c (grep-compute-defaults): Use executable-command-find-posix-p.
Richard M. Stallman <rms@gnu.org>
parents: 53486
diff changeset
452 (list (read-from-minibuffer "Run find (like this): "
4deb14fde58c (grep-compute-defaults): Use executable-command-find-posix-p.
Richard M. Stallman <rms@gnu.org>
parents: 53486
diff changeset
453 grep-find-command nil nil
4deb14fde58c (grep-compute-defaults): Use executable-command-find-posix-p.
Richard M. Stallman <rms@gnu.org>
parents: 53486
diff changeset
454 'grep-find-history))
4deb14fde58c (grep-compute-defaults): Use executable-command-find-posix-p.
Richard M. Stallman <rms@gnu.org>
parents: 53486
diff changeset
455 ;; No default was set
4deb14fde58c (grep-compute-defaults): Use executable-command-find-posix-p.
Richard M. Stallman <rms@gnu.org>
parents: 53486
diff changeset
456 (read-string
4deb14fde58c (grep-compute-defaults): Use executable-command-find-posix-p.
Richard M. Stallman <rms@gnu.org>
parents: 53486
diff changeset
457 "compile.el: No `grep-find-command' command available. Press RET.")
4deb14fde58c (grep-compute-defaults): Use executable-command-find-posix-p.
Richard M. Stallman <rms@gnu.org>
parents: 53486
diff changeset
458 (list nil))))
4deb14fde58c (grep-compute-defaults): Use executable-command-find-posix-p.
Richard M. Stallman <rms@gnu.org>
parents: 53486
diff changeset
459 (when (and grep-find-command command-args)
4deb14fde58c (grep-compute-defaults): Use executable-command-find-posix-p.
Richard M. Stallman <rms@gnu.org>
parents: 53486
diff changeset
460 (let ((null-device nil)) ; see grep
4deb14fde58c (grep-compute-defaults): Use executable-command-find-posix-p.
Richard M. Stallman <rms@gnu.org>
parents: 53486
diff changeset
461 (grep command-args))))
53139
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
462
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
463 (defun grep-expand-command-macros (command &optional regexp files dir excl case-fold)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
464 "Patch grep COMMAND replacing <D>, etc."
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
465 (setq command
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
466 (replace-regexp-in-string "<D>"
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
467 (or dir ".") command t t))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
468 (setq command
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
469 (replace-regexp-in-string "<X>"
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
470 (or excl "") command t t))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
471 (setq command
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
472 (replace-regexp-in-string "<F>"
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
473 (or files "") command t t))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
474 (setq command
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
475 (replace-regexp-in-string "<C>"
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
476 (if case-fold "-i" "") command t t))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
477 (setq command
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
478 (replace-regexp-in-string "<R>"
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
479 (or regexp "") command t t))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
480 command)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
481
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
482 (defvar grep-tree-last-regexp "")
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
483 (defvar grep-tree-last-files (car (car grep-tree-files-aliases)))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
484
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
485 ;;;###autoload
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
486 (defun grep-tree (regexp files dir &optional subdirs)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
487 "Grep for REGEXP in FILES in directory tree rooted at DIR.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
488 Collect output in a buffer.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
489 Interactively, prompt separately for each search parameter.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
490 With prefix arg, reuse previous REGEXP.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
491 The search is limited to file names matching shell pattern FILES.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
492 FILES may use abbreviations defined in `grep-tree-files-aliases', e.g.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
493 entering `ch' is equivalent to `*.[ch]'.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
494
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
495 While find runs asynchronously, you can use the \\[next-error] command
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
496 to find the text that grep hits refer to.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
497
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
498 This command uses a special history list for its arguments, so you can
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
499 easily repeat a find command.
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
500
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
501 When used non-interactively, optional arg SUBDIRS limits the search to
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
502 those sub directories of DIR."
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
503 (interactive
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
504 (let* ((regexp
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
505 (if current-prefix-arg
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
506 grep-tree-last-regexp
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
507 (let* ((default (current-word))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
508 (spec (read-string
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
509 (concat "Search for"
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
510 (if (and default (> (length default) 0))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
511 (format " (default %s): " default) ": ")))))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
512 (if (equal spec "") default spec))))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
513 (files
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
514 (read-string (concat "Search for \"" regexp "\" in files (default " grep-tree-last-files "): ")))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
515 (dir
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
516 (read-directory-name "Base directory: " nil default-directory t)))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
517 (list regexp files dir)))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
518 (unless grep-tree-command
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
519 (grep-compute-defaults))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
520 (unless (and (stringp files) (> (length files) 0))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
521 (setq files grep-tree-last-files))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
522 (when files
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
523 (setq grep-tree-last-files files)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
524 (let ((mf (assoc files grep-tree-files-aliases)))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
525 (if mf
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
526 (setq files (cdr mf)))))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
527 (let ((command-args (grep-expand-command-macros
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
528 grep-tree-command
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
529 (setq grep-tree-last-regexp regexp)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
530 (and files (concat "-name '" files "'"))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
531 (if subdirs
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
532 (if (stringp subdirs)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
533 subdirs
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
534 (mapconcat 'identity subdirs " "))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
535 nil) ;; we change default-directory to dir
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
536 (and grep-tree-ignore-CVS-directories "-path '*/CVS' -prune -o ")
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
537 grep-tree-ignore-case))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
538 (default-directory dir)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
539 (null-device nil)) ; see grep
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
540 (grep command-args regexp)))
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
541
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
542
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
543 (provide 'grep)
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
544
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
545 ;;; grep.el ends here
df3033332097 * progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
546
53154
9780583a5871 Resolve CVS conflicts
Miles Bader <miles@gnu.org>
parents: 53145
diff changeset
547 ;;; arch-tag: 5a5b9169-a79d-4f38-9c38-f69615f39c4d