Mercurial > emacs
annotate lisp/progmodes/grep.el @ 65708:824d09eb82bf
Preliminary Forth support.
(prolog_pr): Cast strlen to int before comparison.
(LOOKING_AT, LOOKING_AT_NOCASE): Let the preprocessor check that
the second argument is indeed a literal string.
(longopts, print_help, main): The -a (--append) option
can be used in ctags also; for one, the Linux make file uses it.
author | Francesco Potortì <pot@gnu.org> |
---|---|
date | Tue, 27 Sep 2005 13:23:47 +0000 |
parents | 6b7109ed93a0 |
children | dc49655f57ae a3716f7538f2 |
rev | line source |
---|---|
62160 | 1 ;;; grep.el --- run Grep as inferior of Emacs, parse match messages |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
2 |
57769
e663f6b659a6
(grep-regexp-alist): Move match highlighting
Juri Linkov <juri@jurta.org>
parents:
57043
diff
changeset
|
3 ;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
64699
629afbe74e61
Update copyright for release of 22.1 for progmodes directory.
Nick Roberts <nickrob@snap.net.nz>
parents:
64619
diff
changeset
|
4 ;; 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
53139
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 |
64085 | 24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 ;; Boston, MA 02110-1301, USA. | |
53139
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 |
65232
6b7109ed93a0
(font-lock-lines-before): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
65126
diff
changeset
|
36 (defvar font-lock-lines-before) |
6b7109ed93a0
(font-lock-lines-before): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
65126
diff
changeset
|
37 |
6b7109ed93a0
(font-lock-lines-before): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
65126
diff
changeset
|
38 |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
39 (defgroup grep nil |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
40 "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
|
41 :group 'tools |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
42 :group 'processes) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
43 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
44 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
45 ;;;###autoload |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
46 (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
|
47 "*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
|
48 :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
|
49 integer) |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59991
diff
changeset
|
50 :version "22.1" |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
51 :group 'grep) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
52 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
53 (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
|
54 "*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
|
55 \(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
|
56 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
|
57 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
|
58 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
|
59 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
|
60 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
|
61 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
62 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
|
63 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
|
64 :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
|
65 (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
|
66 (integer :tag "First N lines")) |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59991
diff
changeset
|
67 :version "22.1" |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
68 :group 'grep) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
69 |
56948
f6f74981c4b0
(grep-highlight-matches): Change default from
Juri Linkov <juri@jurta.org>
parents:
56921
diff
changeset
|
70 (defcustom grep-highlight-matches 'auto-detect |
56960
84482ed458f2
(grep-highlight-matches): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
56948
diff
changeset
|
71 "If t, use special markers to highlight grep matches. |
56881
4be25baf31b5
(grep-highlight-matches): New defcustom.
Juri Linkov <juri@jurta.org>
parents:
56828
diff
changeset
|
72 |
4be25baf31b5
(grep-highlight-matches): New defcustom.
Juri Linkov <juri@jurta.org>
parents:
56828
diff
changeset
|
73 Some grep programs are able to surround matches with special |
4be25baf31b5
(grep-highlight-matches): New defcustom.
Juri Linkov <juri@jurta.org>
parents:
56828
diff
changeset
|
74 markers in grep output. Such markers can be used to highlight |
4be25baf31b5
(grep-highlight-matches): New defcustom.
Juri Linkov <juri@jurta.org>
parents:
56828
diff
changeset
|
75 matches in grep mode. |
4be25baf31b5
(grep-highlight-matches): New defcustom.
Juri Linkov <juri@jurta.org>
parents:
56828
diff
changeset
|
76 |
4be25baf31b5
(grep-highlight-matches): New defcustom.
Juri Linkov <juri@jurta.org>
parents:
56828
diff
changeset
|
77 This option sets the environment variable GREP_COLOR to specify |
4be25baf31b5
(grep-highlight-matches): New defcustom.
Juri Linkov <juri@jurta.org>
parents:
56828
diff
changeset
|
78 markers for highlighting and GREP_OPTIONS to add the --color |
4be25baf31b5
(grep-highlight-matches): New defcustom.
Juri Linkov <juri@jurta.org>
parents:
56828
diff
changeset
|
79 option in front of any explicit grep options before starting |
56960
84482ed458f2
(grep-highlight-matches): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
56948
diff
changeset
|
80 the grep. |
84482ed458f2
(grep-highlight-matches): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
56948
diff
changeset
|
81 |
84482ed458f2
(grep-highlight-matches): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
56948
diff
changeset
|
82 The default value of this variable is set up by `grep-compute-defaults'; |
84482ed458f2
(grep-highlight-matches): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
56948
diff
changeset
|
83 call that function before using this variable in your program." |
56948
f6f74981c4b0
(grep-highlight-matches): Change default from
Juri Linkov <juri@jurta.org>
parents:
56921
diff
changeset
|
84 :type '(choice (const :tag "Do not highlight matches with grep markers" nil) |
f6f74981c4b0
(grep-highlight-matches): Change default from
Juri Linkov <juri@jurta.org>
parents:
56921
diff
changeset
|
85 (const :tag "Highlight matches with grep markers" t) |
f6f74981c4b0
(grep-highlight-matches): Change default from
Juri Linkov <juri@jurta.org>
parents:
56921
diff
changeset
|
86 (other :tag "Not Set" auto-detect)) |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59991
diff
changeset
|
87 :version "22.1" |
56881
4be25baf31b5
(grep-highlight-matches): New defcustom.
Juri Linkov <juri@jurta.org>
parents:
56828
diff
changeset
|
88 :group 'grep) |
4be25baf31b5
(grep-highlight-matches): New defcustom.
Juri Linkov <juri@jurta.org>
parents:
56828
diff
changeset
|
89 |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
90 (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
|
91 "*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
|
92 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
93 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
|
94 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
|
95 than the begining." |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
96 :type 'boolean |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59991
diff
changeset
|
97 :version "22.1" |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
98 :group 'grep) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
99 |
56333
eb4bc9a65835
(grep-compute-defaults, grep-command)
Eli Zaretskii <eliz@gnu.org>
parents:
56226
diff
changeset
|
100 ;;;###autoload |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
101 (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
|
102 "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
|
103 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
|
104 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
|
105 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
|
106 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
107 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
|
108 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
|
109 :type '(choice string |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
110 (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
|
111 :group 'grep) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
112 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
113 (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
|
114 "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
|
115 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
|
116 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
|
117 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
|
118 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
119 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
|
120 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
|
121 :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
|
122 (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
|
123 (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
|
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 |
56333
eb4bc9a65835
(grep-compute-defaults, grep-command)
Eli Zaretskii <eliz@gnu.org>
parents:
56226
diff
changeset
|
126 ;;;###autoload |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
127 (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
|
128 "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
|
129 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
|
130 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
|
131 :type '(choice string |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
132 (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
|
133 :group 'grep) |
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 (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
|
136 "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
|
137 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
|
138 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
|
139 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
|
140 <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
|
141 <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
|
142 <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
|
143 <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
|
144 <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
|
145 :type '(choice string |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
146 (const :tag "Not Set" nil)) |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59991
diff
changeset
|
147 :version "22.1" |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
148 :group 'grep) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
149 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
150 (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
|
151 ("ch" . "*.[ch]") |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
152 ("c" . "*.c") |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
153 ("h" . "*.h") |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
154 ("m" . "[Mm]akefile*") |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
155 ("asm" . "*.[sS]") |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
156 ("all" . "*") |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
157 ("el" . "*.el") |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
158 ) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
159 "*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
|
160 :type 'alist |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
161 :group 'grep) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
162 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
163 (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
|
164 "*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
|
165 :type 'boolean |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
166 :group 'grep) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
167 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
168 (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
|
169 "*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
|
170 :type 'boolean |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
171 :group 'grep) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
172 |
56226
bfe817c8d413
(grep-error-screen-columns): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56155
diff
changeset
|
173 (defcustom grep-error-screen-columns nil |
bfe817c8d413
(grep-error-screen-columns): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56155
diff
changeset
|
174 "*If non-nil, column numbers in grep hits are screen columns. |
bfe817c8d413
(grep-error-screen-columns): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56155
diff
changeset
|
175 See `compilation-error-screen-columns'" |
bfe817c8d413
(grep-error-screen-columns): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56155
diff
changeset
|
176 :type '(choice (const :tag "Default" nil) |
bfe817c8d413
(grep-error-screen-columns): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56155
diff
changeset
|
177 integer) |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59991
diff
changeset
|
178 :version "22.1" |
56226
bfe817c8d413
(grep-error-screen-columns): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56155
diff
changeset
|
179 :group 'grep) |
bfe817c8d413
(grep-error-screen-columns): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56155
diff
changeset
|
180 |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
181 ;;;###autoload |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
182 (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
|
183 "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
|
184 :type 'hook |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
185 :group 'grep) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
186 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
187 (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
|
188 (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
|
189 (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
|
190 (define-key map "\^?" 'scroll-down) |
57022
463edf7390ca
(grep-mode-map): Rename `next-error-follow-mode' to `next-error-follow-minor-mode'.
Juri Linkov <juri@jurta.org>
parents:
56998
diff
changeset
|
191 (define-key map "\C-c\C-f" 'next-error-follow-minor-mode) |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
192 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
193 (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
|
194 (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
|
195 (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
|
196 (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
|
197 (define-key map "}" 'compilation-next-file) |
64728
c1b77e79c51a
(grep-mode-map): Bind TAB to `compilation-next-error'
Juri Linkov <juri@jurta.org>
parents:
64725
diff
changeset
|
198 (define-key map "\t" 'compilation-next-error) |
c1b77e79c51a
(grep-mode-map): Bind TAB to `compilation-next-error'
Juri Linkov <juri@jurta.org>
parents:
64725
diff
changeset
|
199 (define-key map [backtab] '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
|
200 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
201 ;; 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
|
202 (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
|
203 (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
|
204 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
205 (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
|
206 '("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
|
207 (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
|
208 '("----" . nil)) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
209 (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
|
210 '("Compile..." . compile)) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
211 (define-key map [menu-bar grep compilation-grep] |
64944
c845f6151d83
(grep-mode-map): Add ellipsis to "Another grep".
Juri Linkov <juri@jurta.org>
parents:
64864
diff
changeset
|
212 '("Another grep..." . grep)) |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
213 (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
|
214 '("Repeat grep" . recompile)) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
215 (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
|
216 '("----" . nil)) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
217 (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
|
218 '("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
|
219 (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
|
220 '("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
|
221 (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
|
222 '("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
|
223 map) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
224 "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
|
225 `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
|
226 |
54372
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
227 (defalias 'kill-grep 'kill-compilation) |
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
228 |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
229 ;;;; TODO --- refine this!! |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
230 |
53145
a0151f86f01e
Remove grep-use-compilation-buffer defcustom.
Kim F. Storm <storm@cua.dk>
parents:
53139
diff
changeset
|
231 ;;; (defcustom grep-use-compilation-buffer t |
a0151f86f01e
Remove grep-use-compilation-buffer defcustom.
Kim F. Storm <storm@cua.dk>
parents:
53139
diff
changeset
|
232 ;;; "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
|
233 ;;; 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
|
234 ;;; 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
|
235 ;;; 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
|
236 ;;; be used to navigate between grep matches." |
a0151f86f01e
Remove grep-use-compilation-buffer defcustom.
Kim F. Storm <storm@cua.dk>
parents:
53139
diff
changeset
|
237 ;;; :type 'boolean |
a0151f86f01e
Remove grep-use-compilation-buffer defcustom.
Kim F. Storm <storm@cua.dk>
parents:
53139
diff
changeset
|
238 ;;; :group 'grep) |
53139
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 ;; 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
|
241 (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
|
242 "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
|
243 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
|
244 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
|
245 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
|
246 `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
|
247 |
56333
eb4bc9a65835
(grep-compute-defaults, grep-command)
Eli Zaretskii <eliz@gnu.org>
parents:
56226
diff
changeset
|
248 ;;;###autoload |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
249 (defvar grep-regexp-alist |
64864
c474b6f22449
(grep-regexp-alist): Use `.+?' instead of `[^:\n]+'.
Juri Linkov <juri@jurta.org>
parents:
64740
diff
changeset
|
250 '(("^\\(.+?\\)\\(:[ \t]*\\)\\([0-9]+\\)\\2" |
64725
0344b299e9e6
(grep-regexp-alist): Replace complex regexp
Juri Linkov <juri@jurta.org>
parents:
64699
diff
changeset
|
251 1 3) |
0344b299e9e6
(grep-regexp-alist): Replace complex regexp
Juri Linkov <juri@jurta.org>
parents:
64699
diff
changeset
|
252 ;; Rule to match column numbers is commented out since no known grep |
0344b299e9e6
(grep-regexp-alist): Replace complex regexp
Juri Linkov <juri@jurta.org>
parents:
64699
diff
changeset
|
253 ;; produces them |
64864
c474b6f22449
(grep-regexp-alist): Use `.+?' instead of `[^:\n]+'.
Juri Linkov <juri@jurta.org>
parents:
64740
diff
changeset
|
254 ;; ("^\\(.+?\\)\\(:[ \t]*\\)\\([0-9]+\\)\\2\\(?:\\([0-9]+\\)\\(?:-\\([0-9]+\\)\\)?\\2\\)?" |
64725
0344b299e9e6
(grep-regexp-alist): Replace complex regexp
Juri Linkov <juri@jurta.org>
parents:
64699
diff
changeset
|
255 ;; 1 3 (4 . 5)) |
63576
7c3d537469b0
(grep-regexp-alist): Use backreference at the
Juri Linkov <juri@jurta.org>
parents:
62160
diff
changeset
|
256 ("^\\(\\(.+?\\):\\([0-9]+\\):\\).*?\ |
64509 | 257 \\(\033\\[01;31m\\(?:\033\\[K\\)?\\)\\(.*?\\)\\(\033\\[[0-9]*m\\)" |
63576
7c3d537469b0
(grep-regexp-alist): Use backreference at the
Juri Linkov <juri@jurta.org>
parents:
62160
diff
changeset
|
258 2 3 |
57769
e663f6b659a6
(grep-regexp-alist): Move match highlighting
Juri Linkov <juri@jurta.org>
parents:
57043
diff
changeset
|
259 ;; Calculate column positions (beg . end) of first grep match on a line |
56881
4be25baf31b5
(grep-highlight-matches): New defcustom.
Juri Linkov <juri@jurta.org>
parents:
56828
diff
changeset
|
260 ((lambda () |
64509 | 261 (setq compilation-error-screen-columns nil) |
262 (- (match-beginning 4) (match-end 1))) | |
56881
4be25baf31b5
(grep-highlight-matches): New defcustom.
Juri Linkov <juri@jurta.org>
parents:
56828
diff
changeset
|
263 . |
64509 | 264 (lambda () (- (match-end 5) (match-end 1) |
265 (- (match-end 4) (match-beginning 4))))) | |
63576
7c3d537469b0
(grep-regexp-alist): Use backreference at the
Juri Linkov <juri@jurta.org>
parents:
62160
diff
changeset
|
266 nil 1) |
64740
eeed7a7c1afa
(grep-regexp-alist): Set 5th arg `TYPE' to
Juri Linkov <juri@jurta.org>
parents:
64728
diff
changeset
|
267 ("^Binary file \\(.+\\) matches$" 1 nil nil 0 1)) |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
268 "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
|
269 |
54372
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
270 (defvar grep-error "grep hit" |
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
271 "Message to print when no matches are found.") |
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
272 |
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
273 ;; Reverse the colors because grep hits are not errors (though we jump there |
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
274 ;; with `next-error'), and unreadable files can't be gone to. |
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
275 (defvar grep-hit-face compilation-info-face |
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
276 "Face name to use for grep hits.") |
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
277 |
64864
c474b6f22449
(grep-regexp-alist): Use `.+?' instead of `[^:\n]+'.
Juri Linkov <juri@jurta.org>
parents:
64740
diff
changeset
|
278 (defvar grep-error-face 'compilation-error |
54372
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
279 "Face name to use for grep error messages.") |
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
280 |
58988
067d5dcfe531
(grep-match-face): New defvar.
Juri Linkov <juri@jurta.org>
parents:
58493
diff
changeset
|
281 (defvar grep-match-face 'match |
067d5dcfe531
(grep-match-face): New defvar.
Juri Linkov <juri@jurta.org>
parents:
58493
diff
changeset
|
282 "Face name to use for grep matches.") |
067d5dcfe531
(grep-match-face): New defvar.
Juri Linkov <juri@jurta.org>
parents:
58493
diff
changeset
|
283 |
64725
0344b299e9e6
(grep-regexp-alist): Replace complex regexp
Juri Linkov <juri@jurta.org>
parents:
64699
diff
changeset
|
284 (defvar grep-context-face 'shadow |
0344b299e9e6
(grep-regexp-alist): Replace complex regexp
Juri Linkov <juri@jurta.org>
parents:
64699
diff
changeset
|
285 "Face name to use for grep context lines.") |
0344b299e9e6
(grep-regexp-alist): Replace complex regexp
Juri Linkov <juri@jurta.org>
parents:
64699
diff
changeset
|
286 |
54372
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
287 (defvar grep-mode-font-lock-keywords |
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
288 '(;; Command output lines. |
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
289 ("^\\([A-Za-z_0-9/\.+-]+\\)[ \t]*:" 1 font-lock-function-name-face) |
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
290 (": \\(.+\\): \\(?:Permission denied\\|No such \\(?:file or directory\\|device or address\\)\\)$" |
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
291 1 grep-error-face) |
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
292 ;; remove match from grep-regexp-alist before fontifying |
65126
559a37c2f306
(grep, grep-mode): Make buffer-local variables
Juri Linkov <juri@jurta.org>
parents:
65056
diff
changeset
|
293 ("^Grep started.*" |
559a37c2f306
(grep, grep-mode): Make buffer-local variables
Juri Linkov <juri@jurta.org>
parents:
65056
diff
changeset
|
294 (0 '(face nil message nil help-echo nil mouse-face nil) t)) |
54372
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
295 ("^Grep finished \\(?:(\\(matches found\\))\\|with \\(no matches found\\)\\).*" |
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
296 (0 '(face nil message nil help-echo nil mouse-face nil) t) |
64864
c474b6f22449
(grep-regexp-alist): Use `.+?' instead of `[^:\n]+'.
Juri Linkov <juri@jurta.org>
parents:
64740
diff
changeset
|
297 (1 compilation-info-face nil t) |
c474b6f22449
(grep-regexp-alist): Use `.+?' instead of `[^:\n]+'.
Juri Linkov <juri@jurta.org>
parents:
64740
diff
changeset
|
298 (2 compilation-warning-face nil t)) |
64944
c845f6151d83
(grep-mode-map): Add ellipsis to "Another grep".
Juri Linkov <juri@jurta.org>
parents:
64864
diff
changeset
|
299 ("^Grep \\(exited abnormally\\|interrupt\\|killed\\|terminated\\)\\(?:.*with code \\([0-9]+\\)\\)?.*" |
54372
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
300 (0 '(face nil message nil help-echo nil mouse-face nil) t) |
64864
c474b6f22449
(grep-regexp-alist): Use `.+?' instead of `[^:\n]+'.
Juri Linkov <juri@jurta.org>
parents:
64740
diff
changeset
|
301 (1 grep-error-face) |
64944
c845f6151d83
(grep-mode-map): Add ellipsis to "Another grep".
Juri Linkov <juri@jurta.org>
parents:
64864
diff
changeset
|
302 (2 grep-error-face nil t)) |
64864
c474b6f22449
(grep-regexp-alist): Use `.+?' instead of `[^:\n]+'.
Juri Linkov <juri@jurta.org>
parents:
64740
diff
changeset
|
303 ("^.+?-[0-9]+-.*\n" (0 grep-context-face)) |
57769
e663f6b659a6
(grep-regexp-alist): Move match highlighting
Juri Linkov <juri@jurta.org>
parents:
57043
diff
changeset
|
304 ;; Highlight grep matches and delete markers |
64509 | 305 ("\\(\033\\[01;31m\\)\\(.*?\\)\\(\033\\[[0-9]*m\\)" |
61902
e8076329ceee
(grep-mode-font-lock-keywords): Use the font-lock-face property to
Lute Kamstra <lute@gnu.org>
parents:
59996
diff
changeset
|
306 ;; Refontification does not work after the markers have been |
e8076329ceee
(grep-mode-font-lock-keywords): Use the font-lock-face property to
Lute Kamstra <lute@gnu.org>
parents:
59996
diff
changeset
|
307 ;; deleted. So we use the font-lock-face property here as Font |
e8076329ceee
(grep-mode-font-lock-keywords): Use the font-lock-face property to
Lute Kamstra <lute@gnu.org>
parents:
59996
diff
changeset
|
308 ;; Lock does not clear that. |
e8076329ceee
(grep-mode-font-lock-keywords): Use the font-lock-face property to
Lute Kamstra <lute@gnu.org>
parents:
59996
diff
changeset
|
309 (2 (list 'face nil 'font-lock-face grep-match-face)) |
64509 | 310 ((lambda (bound)) |
57769
e663f6b659a6
(grep-regexp-alist): Move match highlighting
Juri Linkov <juri@jurta.org>
parents:
57043
diff
changeset
|
311 (progn |
e663f6b659a6
(grep-regexp-alist): Move match highlighting
Juri Linkov <juri@jurta.org>
parents:
57043
diff
changeset
|
312 ;; Delete markers with `replace-match' because it updates |
e663f6b659a6
(grep-regexp-alist): Move match highlighting
Juri Linkov <juri@jurta.org>
parents:
57043
diff
changeset
|
313 ;; the match-data, whereas `delete-region' would render it obsolete. |
e663f6b659a6
(grep-regexp-alist): Move match highlighting
Juri Linkov <juri@jurta.org>
parents:
57043
diff
changeset
|
314 (replace-match "" t t nil 3) |
64509 | 315 (replace-match "" t t nil 1)))) |
316 ("\\(\033\\[[0-9;]*[mK]\\)" | |
317 ;; Delete all remaining escape sequences | |
318 ((lambda (bound)) | |
319 (replace-match "" t t nil 1)))) | |
54372
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
320 "Additional things to highlight in grep output. |
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
321 This gets tacked on the end of the generated expressions.") |
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
322 |
56333
eb4bc9a65835
(grep-compute-defaults, grep-command)
Eli Zaretskii <eliz@gnu.org>
parents:
56226
diff
changeset
|
323 ;;;###autoload |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
324 (defvar grep-program |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
325 ;; 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
|
326 ;; 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
|
327 "grep" |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
328 ;; (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
|
329 ;; (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
|
330 ;; "foo" null-device) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
331 ;; (error nil)) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
332 ;; 1) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
333 ;; "zgrep" |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
334 ;; "grep") |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
335 "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
|
336 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
|
337 |
56333
eb4bc9a65835
(grep-compute-defaults, grep-command)
Eli Zaretskii <eliz@gnu.org>
parents:
56226
diff
changeset
|
338 ;;;###autoload |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
339 (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
|
340 "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
|
341 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
|
342 |
56333
eb4bc9a65835
(grep-compute-defaults, grep-command)
Eli Zaretskii <eliz@gnu.org>
parents:
56226
diff
changeset
|
343 ;;;###autoload |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
344 (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
|
345 "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
|
346 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
347 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
|
348 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
|
349 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
350 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
|
351 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
352 ;; History of grep commands. |
56333
eb4bc9a65835
(grep-compute-defaults, grep-command)
Eli Zaretskii <eliz@gnu.org>
parents:
56226
diff
changeset
|
353 ;;;###autoload |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
354 (defvar grep-history nil) |
56333
eb4bc9a65835
(grep-compute-defaults, grep-command)
Eli Zaretskii <eliz@gnu.org>
parents:
56226
diff
changeset
|
355 ;;;###autoload |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
356 (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
|
357 |
56333
eb4bc9a65835
(grep-compute-defaults, grep-command)
Eli Zaretskii <eliz@gnu.org>
parents:
56226
diff
changeset
|
358 ;;;###autoload |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
359 (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
|
360 "Setup compilation variables and buffer for `grep'. |
54372
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
361 Set up `compilation-exit-message-function' and run `grep-setup-hook'." |
56960
84482ed458f2
(grep-highlight-matches): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
56948
diff
changeset
|
362 (unless (or (not grep-highlight-matches) (eq grep-highlight-matches t)) |
84482ed458f2
(grep-highlight-matches): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
56948
diff
changeset
|
363 (grep-compute-defaults)) |
84482ed458f2
(grep-highlight-matches): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
56948
diff
changeset
|
364 (when (eq grep-highlight-matches t) |
56881
4be25baf31b5
(grep-highlight-matches): New defcustom.
Juri Linkov <juri@jurta.org>
parents:
56828
diff
changeset
|
365 ;; Modify `process-environment' locally bound in `compilation-start' |
4be25baf31b5
(grep-highlight-matches): New defcustom.
Juri Linkov <juri@jurta.org>
parents:
56828
diff
changeset
|
366 (setenv "GREP_OPTIONS" (concat (getenv "GREP_OPTIONS") " --color=always")) |
64509 | 367 ;; for GNU grep 2.5.1 |
368 (setenv "GREP_COLOR" "01;31") | |
369 ;; for GNU grep 2.5.1-cvs | |
370 (setenv "GREP_COLORS" "mt=01;31:fn=:ln=:bn=:se=:ml=:cx=:ne")) | |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
371 (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
|
372 (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
|
373 (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
|
374 (cond ((zerop code) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
375 '("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
|
376 ((= code 1) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
377 '("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
|
378 (t |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
379 (cons msg code))) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
380 (cons msg code)))) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
381 (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
|
382 |
56333
eb4bc9a65835
(grep-compute-defaults, grep-command)
Eli Zaretskii <eliz@gnu.org>
parents:
56226
diff
changeset
|
383 ;;;###autoload |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
384 (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
|
385 (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
|
386 (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
|
387 (with-temp-buffer |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
388 (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
|
389 (not |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
390 (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
|
391 (if grep-command |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
392 ;; `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
|
393 ;; 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
|
394 (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
|
395 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
|
396 "^English" hello-file) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
397 ;; 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
|
398 (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
|
399 "-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
|
400 (error nil)) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
401 0) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
402 (progn |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
403 (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
|
404 (looking-at |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
405 (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
|
406 ":[0-9]+:English"))))))))) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
407 (unless grep-command |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
408 (setq grep-command |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
409 (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
|
410 (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
|
411 (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
|
412 "-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
|
413 (error nil)) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
414 1) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
415 (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
|
416 (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
|
417 (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
|
418 (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
|
419 (if (and |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
420 (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
|
421 null-device "-print0") |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
422 0) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
423 (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
|
424 "-0" "-e" "echo") |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
425 0)) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
426 'gnu))) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
427 (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
|
428 (setq grep-find-command |
54012
1313586e1e29
(grep-compute-defaults): Undo change from
Eli Zaretskii <eliz@is.elta.co.il>
parents:
53953
diff
changeset
|
429 (cond ((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
|
430 (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
|
431 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
|
432 (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
|
433 (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
|
434 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
|
435 (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
|
436 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
|
437 (+ 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
|
438 (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
|
439 (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
|
440 (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
|
441 (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
|
442 (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
|
443 (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
|
444 find-program gcmd)) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
445 (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
|
446 (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
|
447 find-program gcmd)) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
448 (t (format "%s <D> <X> -type f <F> -exec %s <R> {} %s \\;" |
56948
f6f74981c4b0
(grep-highlight-matches): Change default from
Juri Linkov <juri@jurta.org>
parents:
56921
diff
changeset
|
449 find-program gcmd null-device)))))) |
f6f74981c4b0
(grep-highlight-matches): Change default from
Juri Linkov <juri@jurta.org>
parents:
56921
diff
changeset
|
450 (unless (or (not grep-highlight-matches) (eq grep-highlight-matches t)) |
f6f74981c4b0
(grep-highlight-matches): Change default from
Juri Linkov <juri@jurta.org>
parents:
56921
diff
changeset
|
451 (setq grep-highlight-matches |
f6f74981c4b0
(grep-highlight-matches): Change default from
Juri Linkov <juri@jurta.org>
parents:
56921
diff
changeset
|
452 (with-temp-buffer |
56960
84482ed458f2
(grep-highlight-matches): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
56948
diff
changeset
|
453 (and (equal (condition-case nil |
84482ed458f2
(grep-highlight-matches): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
56948
diff
changeset
|
454 (call-process grep-program nil t nil "--help") |
84482ed458f2
(grep-highlight-matches): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
56948
diff
changeset
|
455 (error nil)) |
84482ed458f2
(grep-highlight-matches): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
56948
diff
changeset
|
456 0) |
84482ed458f2
(grep-highlight-matches): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
56948
diff
changeset
|
457 (progn |
84482ed458f2
(grep-highlight-matches): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
56948
diff
changeset
|
458 (goto-char (point-min)) |
84482ed458f2
(grep-highlight-matches): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
56948
diff
changeset
|
459 (search-forward "--color" nil t)) |
84482ed458f2
(grep-highlight-matches): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
56948
diff
changeset
|
460 t))))) |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
461 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
462 (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
|
463 (let ((tag-default |
57908
a4ed247d476f
(grep-default-command): Take empty string
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57769
diff
changeset
|
464 (shell-quote-argument |
a4ed247d476f
(grep-default-command): Take empty string
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57769
diff
changeset
|
465 (or (funcall (or find-tag-default-function |
a4ed247d476f
(grep-default-command): Take empty string
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57769
diff
changeset
|
466 (get major-mode 'find-tag-default-function) |
a4ed247d476f
(grep-default-command): Take empty string
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57769
diff
changeset
|
467 'find-tag-default)) |
a4ed247d476f
(grep-default-command): Take empty string
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57769
diff
changeset
|
468 ""))) |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
469 (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
|
470 (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
|
471 ;; 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
|
472 (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
|
473 (concat "[^ ]+\\s +\\(?:-[^ ]+\\s +\\)*" |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
474 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
|
475 grep-default) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
476 ;; 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
|
477 (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
|
478 (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
|
479 (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
|
480 (save-match-data |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
481 (string-match |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
482 (wildcard-to-regexp |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
483 (file-name-nondirectory |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
484 (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
|
485 (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
|
486 (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
|
487 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
|
488 " *." |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
489 (file-name-extension buffer-file-name)))) |
57908
a4ed247d476f
(grep-default-command): Take empty string
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57769
diff
changeset
|
490 (replace-match tag-default t t grep-default 1)))) |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
491 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
492 ;;;###autoload |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
493 (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
|
494 "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
|
495 While grep runs asynchronously, you can use \\[next-error] (M-x next-error), |
56420 | 496 or \\<grep-mode-map>\\[compile-goto-error] in the grep \ |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
497 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
|
498 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
|
499 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
500 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
|
501 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
|
502 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
503 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
|
504 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
|
505 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
|
506 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
|
507 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
508 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
|
509 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
|
510 (interactive |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
511 (progn |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
512 (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
|
513 (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
|
514 (grep-compute-defaults)) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
515 (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
|
516 (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
|
517 (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
|
518 default grep-command) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
519 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
|
520 (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
|
521 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
522 ;; 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
|
523 ;; even when async processes aren't supported. |
65126
559a37c2f306
(grep, grep-mode): Make buffer-local variables
Juri Linkov <juri@jurta.org>
parents:
65056
diff
changeset
|
524 (compilation-start (if (and grep-use-null-device null-device) |
559a37c2f306
(grep, grep-mode): Make buffer-local variables
Juri Linkov <juri@jurta.org>
parents:
65056
diff
changeset
|
525 (concat command-args " " null-device) |
559a37c2f306
(grep, grep-mode): Make buffer-local variables
Juri Linkov <juri@jurta.org>
parents:
65056
diff
changeset
|
526 command-args) |
559a37c2f306
(grep, grep-mode): Make buffer-local variables
Juri Linkov <juri@jurta.org>
parents:
65056
diff
changeset
|
527 'grep-mode nil highlight-regexp)) |
54372
a4d3c17f991f
(kill-grep): Move here from compile.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54012
diff
changeset
|
528 |
64509 | 529 ;;;###autoload |
55018 | 530 (define-compilation-mode grep-mode "Grep" |
531 "Sets `grep-last-buffer' and `compilation-window-height'." | |
532 (setq grep-last-buffer (current-buffer)) | |
533 (set (make-local-variable 'compilation-error-face) | |
534 grep-hit-face) | |
535 (set (make-local-variable 'compilation-error-regexp-alist) | |
63576
7c3d537469b0
(grep-regexp-alist): Use backreference at the
Juri Linkov <juri@jurta.org>
parents:
62160
diff
changeset
|
536 grep-regexp-alist) |
65126
559a37c2f306
(grep, grep-mode): Make buffer-local variables
Juri Linkov <juri@jurta.org>
parents:
65056
diff
changeset
|
537 (set (make-local-variable 'compilation-process-setup-function) |
559a37c2f306
(grep, grep-mode): Make buffer-local variables
Juri Linkov <juri@jurta.org>
parents:
65056
diff
changeset
|
538 'grep-process-setup) |
559a37c2f306
(grep, grep-mode): Make buffer-local variables
Juri Linkov <juri@jurta.org>
parents:
65056
diff
changeset
|
539 (set (make-local-variable 'compilation-disable-input) t) |
63576
7c3d537469b0
(grep-regexp-alist): Use backreference at the
Juri Linkov <juri@jurta.org>
parents:
62160
diff
changeset
|
540 ;; Set `font-lock-lines-before' to 0 to not refontify the previous |
7c3d537469b0
(grep-regexp-alist): Use backreference at the
Juri Linkov <juri@jurta.org>
parents:
62160
diff
changeset
|
541 ;; line where grep markers may be already removed. |
7c3d537469b0
(grep-regexp-alist): Use backreference at the
Juri Linkov <juri@jurta.org>
parents:
62160
diff
changeset
|
542 (set (make-local-variable 'font-lock-lines-before) 0)) |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
543 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
544 ;;;###autoload |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
545 (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
|
546 "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
|
547 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
|
548 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
|
549 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
|
550 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
551 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
|
552 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
|
553 (interactive |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
554 (progn |
59605
b64dd2ff73f7
(grep-find): Copy from `grep' the condition for calling grep-compute-defaults.
Richard M. Stallman <rms@gnu.org>
parents:
58988
diff
changeset
|
555 (unless (and grep-command |
b64dd2ff73f7
(grep-find): Copy from `grep' the condition for calling grep-compute-defaults.
Richard M. Stallman <rms@gnu.org>
parents:
58988
diff
changeset
|
556 (or (not grep-use-null-device) (eq grep-use-null-device t))) |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
557 (grep-compute-defaults)) |
53750
4deb14fde58c
(grep-compute-defaults): Use executable-command-find-posix-p.
Richard M. Stallman <rms@gnu.org>
parents:
53486
diff
changeset
|
558 (if grep-find-command |
4deb14fde58c
(grep-compute-defaults): Use executable-command-find-posix-p.
Richard M. Stallman <rms@gnu.org>
parents:
53486
diff
changeset
|
559 (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
|
560 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
|
561 'grep-find-history)) |
4deb14fde58c
(grep-compute-defaults): Use executable-command-find-posix-p.
Richard M. Stallman <rms@gnu.org>
parents:
53486
diff
changeset
|
562 ;; No default was set |
4deb14fde58c
(grep-compute-defaults): Use executable-command-find-posix-p.
Richard M. Stallman <rms@gnu.org>
parents:
53486
diff
changeset
|
563 (read-string |
4deb14fde58c
(grep-compute-defaults): Use executable-command-find-posix-p.
Richard M. Stallman <rms@gnu.org>
parents:
53486
diff
changeset
|
564 "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
|
565 (list nil)))) |
4deb14fde58c
(grep-compute-defaults): Use executable-command-find-posix-p.
Richard M. Stallman <rms@gnu.org>
parents:
53486
diff
changeset
|
566 (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
|
567 (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
|
568 (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
|
569 |
59688
3761d1e2619d
* NEWS: Mention alias `find-grep' for `grep-find'.
David Kastrup <dak@gnu.org>
parents:
59605
diff
changeset
|
570 ;;;###autoload |
3761d1e2619d
* NEWS: Mention alias `find-grep' for `grep-find'.
David Kastrup <dak@gnu.org>
parents:
59605
diff
changeset
|
571 (defalias 'find-grep 'grep-find) |
3761d1e2619d
* NEWS: Mention alias `find-grep' for `grep-find'.
David Kastrup <dak@gnu.org>
parents:
59605
diff
changeset
|
572 |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
573 (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
|
574 "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
|
575 (setq command |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
576 (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
|
577 (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
|
578 (setq command |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
579 (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
|
580 (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
|
581 (setq command |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
582 (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
|
583 (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
|
584 (setq command |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
585 (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
|
586 (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
|
587 (setq command |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
588 (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
|
589 (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
|
590 command) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
591 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
592 (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
|
593 (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
|
594 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
595 ;;;###autoload |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
596 (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
|
597 "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
|
598 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
|
599 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
|
600 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
|
601 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
|
602 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
|
603 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
|
604 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
605 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
|
606 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
|
607 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
608 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
|
609 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
|
610 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
611 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
|
612 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
|
613 (interactive |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
614 (let* ((regexp |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
615 (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
|
616 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
|
617 (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
|
618 (spec (read-string |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
619 (concat "Search for" |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
620 (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
|
621 (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
|
622 (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
|
623 (files |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
624 (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
|
625 (dir |
55804
9766648e58a2
(grep-tree): Rework previous fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55747
diff
changeset
|
626 (read-directory-name "Base directory: " nil default-directory t))) |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
627 (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
|
628 (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
|
629 (grep-compute-defaults)) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
630 (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
|
631 (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
|
632 (when files |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
633 (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
|
634 (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
|
635 (if mf |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
636 (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
|
637 (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
|
638 grep-tree-command |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
639 (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
|
640 (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
|
641 (if subdirs |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
642 (if (stringp subdirs) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
643 subdirs |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
644 (mapconcat 'identity subdirs " ")) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
645 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
|
646 (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
|
647 grep-tree-ignore-case)) |
55804
9766648e58a2
(grep-tree): Rework previous fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55747
diff
changeset
|
648 (default-directory (file-name-as-directory (expand-file-name dir))) |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
649 (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
|
650 (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
|
651 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
652 |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
653 (provide 'grep) |
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
654 |
57043
cb013e5835b8
(grep-mode): Remove unnecessary autoload.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57022
diff
changeset
|
655 ;; arch-tag: 5a5b9169-a79d-4f38-9c38-f69615f39c4d |
53139
df3033332097
* progmodes/grep.el: New file with grep code from compile.el.
Kim F. Storm <storm@cua.dk>
parents:
diff
changeset
|
656 ;;; grep.el ends here |