Commit | Line | Data |
---|---|---|
55535639 | 1 | ;;; compile.el --- run compiler as inferior of Emacs, parse error messages |
fad160d5 | 2 | |
812fade8 | 3 | ;; Copyright (C) 1985, 86, 87, 93, 94, 95, 96, 97, 98, 1999, 2001, 2003 |
e335e194 | 4 | ;; Free Software Foundation, Inc. |
3a801d0c | 5 | |
c4d7c00a | 6 | ;; Author: Roland McGrath <roland@gnu.org> |
d1c7011d | 7 | ;; Maintainer: FSF |
e9571d2a | 8 | ;; Keywords: tools, processes |
d1c7011d | 9 | |
55dfd2c4 RS |
10 | ;; This file is part of GNU Emacs. |
11 | ||
29add8b9 RM |
12 | ;; GNU Emacs is free software; you can redistribute it and/or modify |
13 | ;; it under the terms of the GNU General Public License as published by | |
14 | ;; the Free Software Foundation; either version 2, or (at your option) | |
15 | ;; any later version. | |
16 | ||
55dfd2c4 | 17 | ;; GNU Emacs is distributed in the hope that it will be useful, |
29add8b9 RM |
18 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | ;; GNU General Public License for more details. | |
21 | ||
22 | ;; You should have received a copy of the GNU General Public License | |
b578f267 EN |
23 | ;; along with GNU Emacs; see the file COPYING. If not, write to the |
24 | ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
25 | ;; Boston, MA 02111-1307, USA. | |
55dfd2c4 | 26 | |
5cc57841 ER |
27 | ;;; Commentary: |
28 | ||
29 | ;; This package provides the compile and grep facilities documented in | |
30 | ;; the Emacs user's manual. | |
31 | ||
d1c7011d ER |
32 | ;;; Code: |
33 | ||
c5049fa0 RS |
34 | (defgroup compilation nil |
35 | "Run compiler as inferior of Emacs, parse error messages." | |
36 | :group 'tools | |
37 | :group 'processes) | |
38 | ||
39 | ||
7c163413 | 40 | ;;;###autoload |
c5049fa0 RS |
41 | (defcustom compilation-mode-hook nil |
42 | "*List of hook functions run by `compilation-mode' (see `run-hooks')." | |
43 | :type 'hook | |
44 | :group 'compilation) | |
7c163413 RM |
45 | |
46 | ;;;###autoload | |
c5049fa0 RS |
47 | (defcustom compilation-window-height nil |
48 | "*Number of lines in a compilation window. If nil, use Emacs default." | |
49 | :type '(choice (const :tag "Default" nil) | |
50 | integer) | |
51 | :group 'compilation) | |
d3cb357b | 52 | |
59bb4146 | 53 | (defcustom compile-auto-highlight nil |
37f5f978 | 54 | "*Specify how many compiler errors to highlight (and parse) initially. |
a24770bc | 55 | \(Highlighting applies to an error message when the mouse is over it.) |
37f5f978 RS |
56 | If this is a number N, all compiler error messages in the first N lines |
57 | are highlighted and parsed as soon as they arrive in Emacs. | |
01e6e8c9 | 58 | If t, highlight and parse the whole compilation output as soon as it arrives. |
37f5f978 RS |
59 | If nil, don't highlight or parse any of the buffer until you try to |
60 | move to the error messages. | |
61 | ||
01e6e8c9 | 62 | Those messages which are not parsed and highlighted initially |
4315d68e RS |
63 | will be parsed and highlighted as soon as you try to move to them." |
64 | :type '(choice (const :tag "All" t) | |
65 | (const :tag "None" nil) | |
66 | (integer :tag "First N lines")) | |
67 | :group 'compilation) | |
37f5f978 | 68 | |
55dfd2c4 RS |
69 | (defvar compilation-error-list nil |
70 | "List of error message descriptors for visiting erring functions. | |
fc0094d7 RM |
71 | Each error descriptor is a cons (or nil). Its car is a marker pointing to |
72 | an error message. If its cdr is a marker, it points to the text of the | |
533304f8 RM |
73 | line the message is about. If its cdr is a cons, it is a list |
74 | \(\(DIRECTORY . FILE\) LINE [COLUMN]\). Or its cdr may be nil if that | |
75 | error is not interesting. | |
d3cb357b RM |
76 | |
77 | The value may be t instead of a list; this means that the buffer of | |
29478cc5 JB |
78 | error messages should be reparsed the next time the list of errors is wanted. |
79 | ||
80 | Some other commands (like `diff') use this list to control the error | |
9c09c008 | 81 | message tracking facilities; if you change its structure, you should make |
29478cc5 JB |
82 | sure you also change those packages. Perhaps it is better not to change |
83 | it at all.") | |
55dfd2c4 RS |
84 | |
85 | (defvar compilation-old-error-list nil | |
86 | "Value of `compilation-error-list' after errors were parsed.") | |
87 | ||
501cf428 | 88 | (defvar compilation-parse-errors-function 'compilation-parse-errors |
b2bb6ec8 | 89 | "Function to call to parse error messages from a compilation. |
c540863c RM |
90 | It takes args LIMIT-SEARCH and FIND-AT-LEAST. |
91 | If LIMIT-SEARCH is non-nil, don't bother parsing past that location. | |
501cf428 | 92 | If FIND-AT-LEAST is non-nil, don't bother parsing after finding that |
e78e10ca | 93 | many new errors. |
d3cb357b RM |
94 | It should read in the source files which have errors and set |
95 | `compilation-error-list' to a list with an element for each error message | |
96 | found. See that variable for more info.") | |
55dfd2c4 | 97 | |
e335e194 GM |
98 | (defvar compilation-parse-errors-filename-function nil |
99 | "Function to call to post-process filenames while parsing error messages. | |
100 | It takes one arg FILENAME which is the name of a file as found | |
101 | in the compilation output, and should return a transformed file name.") | |
102 | ||
49683a13 EZ |
103 | ;;;###autoload |
104 | (defvar compilation-process-setup-function nil | |
105 | "*Function to call to customize the compilation process. | |
106 | This functions is called immediately before the compilation process is | |
107 | started. It can be used to set any variables or functions that are used | |
9ac57479 KS |
108 | while processing the output of the compilation process. The function |
109 | is called with variables `compilation-buffer' and `compilation-window' | |
110 | bound to the compilation buffer and window, respectively.") | |
49683a13 | 111 | |
aa228418 | 112 | ;;;###autoload |
d3cb357b | 113 | (defvar compilation-buffer-name-function nil |
6c43f2f9 RS |
114 | "Function to compute the name of a compilation buffer. |
115 | The function receives one argument, the name of the major mode of the | |
116 | compilation buffer. It should return a string. | |
117 | nil means compute the name with `(concat \"*\" (downcase major-mode) \"*\")'.") | |
55dfd2c4 | 118 | |
aa228418 | 119 | ;;;###autoload |
d3cb357b | 120 | (defvar compilation-finish-function nil |
c5049fa0 | 121 | "Function to call when a compilation process finishes. |
d3cb357b RM |
122 | It is called with two arguments: the compilation buffer, and a string |
123 | describing how the process finished.") | |
55dfd2c4 | 124 | |
4cc36b17 RS |
125 | ;;;###autoload |
126 | (defvar compilation-finish-functions nil | |
c5049fa0 | 127 | "Functions to call when a compilation process finishes. |
4cc36b17 RS |
128 | Each function is called with two arguments: the compilation buffer, |
129 | and a string describing how the process finished.") | |
130 | ||
d3cb357b | 131 | (defvar compilation-last-buffer nil |
6c43f2f9 RS |
132 | "The most recent compilation buffer. |
133 | A buffer becomes most recent when its compilation is started | |
134 | or when it is used with \\[next-error] or \\[compile-goto-error].") | |
55dfd2c4 | 135 | |
ebff767c RM |
136 | (defvar compilation-in-progress nil |
137 | "List of compilation processes now running.") | |
138 | (or (assq 'compilation-in-progress minor-mode-alist) | |
139 | (setq minor-mode-alist (cons '(compilation-in-progress " Compiling") | |
140 | minor-mode-alist))) | |
141 | ||
d3cb357b | 142 | (defvar compilation-parsing-end nil |
c4d7c00a | 143 | "Marker position of end of buffer when last error messages were parsed.") |
d3cb357b RM |
144 | |
145 | (defvar compilation-error-message "No more errors" | |
6c43f2f9 RS |
146 | "Message to print when no more matches are found.") |
147 | ||
58856335 RS |
148 | (defvar compilation-arguments nil |
149 | "Arguments that were given to `compile-internal'.") | |
150 | ||
6c43f2f9 | 151 | (defvar compilation-num-errors-found) |
d3cb357b RM |
152 | |
153 | (defvar compilation-error-regexp-alist | |
154 | '( | |
d86bdede | 155 | ;; NOTE! See also grep-regexp-alist, below. |
7ee790ac | 156 | |
d3cb357b | 157 | ;; 4.3BSD grep, cc, lint pass 1: |
7ee790ac RM |
158 | ;; /usr/src/foo/foo.c(8): warning: w may be used before set |
159 | ;; or GNU utilities: | |
160 | ;; foo.c:8: error message | |
161 | ;; or HP-UX 7.0 fc: | |
162 | ;; foo.f :16 some horrible error message | |
08b1edf4 RM |
163 | ;; or GNU utilities with column (GNAT 1.82): |
164 | ;; foo.adb:2:1: Unit name does not match file name | |
9b7dee86 DL |
165 | ;; or with column and program name: |
166 | ;; jade:dbcommon.dsl:133:17:E: missing argument for function call | |
501cf428 | 167 | ;; |
57c8389c JB |
168 | ;; We'll insist that the number be followed by a colon or closing |
169 | ;; paren, because otherwise this matches just about anything | |
170 | ;; containing a number with spaces around it. | |
d914bed5 KH |
171 | |
172 | ;; We insist on a non-digit in the file name | |
173 | ;; so that we don't mistake the file name for a command name | |
174 | ;; and take the line number as the file name. | |
a0730fbd | 175 | ("\\([a-zA-Z][-a-zA-Z._0-9]+: ?\\)?\ |
d914bed5 | 176 | \\([a-zA-Z]?:?[^:( \t\n]*[^:( \t\n0-9][^:( \t\n]*\\)[:(][ \t]*\\([0-9]+\\)\ |
e228c7e2 | 177 | \\([) \t]\\|:\\(\\([0-9]+:\\)\\|[0-9]*[^:0-9]\\)\\)" 2 3 6) |
69d4d27f | 178 | |
fb49f36a RS |
179 | ;; GNU utilities with precise locations (line and columns), |
180 | ;; possibly ranges: | |
181 | ;; foo.c:8.23-9.1: error message | |
ccc41714 | 182 | ("\\([a-zA-Z][-a-zA-Z._0-9]+\\): ?\ |
fb49f36a RS |
183 | \\([0-9]+\\)\\.\\([0-9]+\\)\ |
184 | -\\([0-9]+\\)\\.\\([0-9]+\\)\ | |
185 | :" 1 2 3) ;; When ending points are supported, add line = 4 and col = 5. | |
186 | ;; foo.c:8.23-45: error message | |
ccc41714 | 187 | ("\\([a-zA-Z][-a-zA-Z._0-9]+\\): ?\ |
fb49f36a RS |
188 | \\([0-9]+\\)\\.\\([0-9]+\\)\ |
189 | -\\([0-9]+\\)\ | |
190 | :" 1 2 3) ;; When ending points are supported, add line = 2 and col = 4. | |
191 | ;; foo.c:8-45.3: error message | |
ccc41714 | 192 | ("\\([a-zA-Z][-a-zA-Z._0-9]+\\): ?\ |
fb49f36a RS |
193 | \\([0-9]+\\)\ |
194 | -\\([0-9]+\\)\\.\\([0-9]+\\)\ | |
195 | :" 1 2 nil) ;; When ending points are supported, add line = 2 and col = 4. | |
196 | ;; foo.c:8.23: error message | |
ccc41714 | 197 | ("\\([a-zA-Z][-a-zA-Z._0-9]+\\): ?\ |
fb49f36a RS |
198 | \\([0-9]+\\)\\.\\([0-9]+\\)\ |
199 | :" 1 2 3) | |
200 | ;; foo.c:8-23: error message | |
ccc41714 | 201 | ("\\([a-zA-Z][-a-zA-Z._0-9]+\\): ?\ |
fb49f36a RS |
202 | \\([0-9]+\\)\ |
203 | -\\([0-9]+\\)\ | |
204 | :" 1 2 nil);; When ending points are supported, add line = 3. | |
205 | ||
0c43cc89 RS |
206 | ;; Microsoft C/C++: |
207 | ;; keyboard.c(537) : warning C4005: 'min' : macro redefinition | |
208 | ;; d:\tmp\test.c(23) : error C2143: syntax error : missing ';' before 'if' | |
9cab952d RS |
209 | ;; This used to be less selective and allow characters other than |
210 | ;; parens around the line number, but that caused confusion for | |
211 | ;; GNU-style error messages. | |
d2705a18 | 212 | ;; This used to reject spaces and dashes in file names, |
717149ec | 213 | ;; but they are valid now; so I made it more strict about the error |
d2705a18 RS |
214 | ;; message that follows. |
215 | ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\)) \ | |
216 | : \\(error\\|warning\\) C[0-9]+:" 1 3) | |
0c43cc89 | 217 | |
717149ec | 218 | ;; Borland C++, C++Builder: |
69d4d27f RS |
219 | ;; Error ping.c 15: Unable to open include file 'sys/types.h' |
220 | ;; Warning ping.c 68: Call to function 'func' with no prototype | |
717149ec KH |
221 | ;; Error E2010 ping.c 15: Unable to open include file 'sys/types.h' |
222 | ;; Warning W1022 ping.c 68: Call to function 'func' with no prototype | |
223 | ("\\(Error\\|Warning\\) \\(\\([FEW][0-9]+\\) \\)?\ | |
224 | \\([a-zA-Z]?:?[^:( \t\n]+\\)\ | |
225 | \\([0-9]+\\)\\([) \t]\\|:[^0-9\n]\\)" 4 5) | |
7ee790ac | 226 | |
56ce04a3 RS |
227 | ;; Valgrind (memory debugger for x86 GNU/Linux): |
228 | ;; ==1332== at 0x8008621: main (vtest.c:180) | |
229 | ;; Currently this regexp only matches the first error. | |
230 | ;; Thanks to Hans Petter Jansson <hpj@ximian.com> for his regexp wisdom. | |
231 | ("^==[0-9]+==[^(]+\(([^:]+):([0-9]+)" 1 2) | |
232 | ||
d3cb357b | 233 | ;; 4.3BSD lint pass 2 |
7ee790ac | 234 | ;; strcmp: variable # of args. llib-lc(359) :: /usr/src/foo/foo.c(8) |
2fa55e20 | 235 | (".*[ \t:]\\([a-zA-Z]?:?[^:( \t\n]+\\)[:(](+[ \t]*\\([0-9]+\\))[:) \t]*$" |
3e8258e7 | 236 | 1 2) |
7ee790ac | 237 | |
d3cb357b | 238 | ;; 4.3BSD lint pass 3 |
7ee790ac | 239 | ;; bloofle defined( /users/wolfgang/foo.c(4) ), but never used |
daa37602 | 240 | ;; This used to be |
3e8258e7 | 241 | ;; ("[ \t(]+\\([a-zA-Z]?:?[^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]+" 1 2) |
daa37602 | 242 | ;; which is regexp Impressionism - it matches almost anything! |
2fa55e20 | 243 | (".*([ \t]*\\([a-zA-Z]?:?[^:( \t\n]+\\)[:(][ \t]*\\([0-9]+\\))" 1 2) |
7ee790ac | 244 | |
369d3cdc RM |
245 | ;; MIPS lint pass<n>; looks good for SunPro lint also |
246 | ;; TrimMask (255) in solomon.c may be indistinguishable from TrimMasks (93) in solomon.c due to truncation | |
2fa55e20 | 247 | ("[^\n ]+ (\\([0-9]+\\)) in \\([^ \n]+\\)" 2 1) |
369d3cdc | 248 | ;; name defined but never used: LinInt in cmap_calc.c(199) |
2fa55e20 | 249 | (".*in \\([^(\n]+\\)(\\([0-9]+\\))$" 1 2) |
369d3cdc | 250 | |
ff735134 | 251 | ;; Ultrix 3.0 f77: |
f89fdaed | 252 | ;; fort: Severe: addstf.f, line 82: Missing operator or delimiter symbol |
984ae4ed RM |
253 | ;; Some SGI cc version: |
254 | ;; cfe: Warning 835: foo.c, line 2: something | |
2fa55e20 | 255 | ("\\(cfe\\|fort\\): [^:\n]*: \\([^ \n]*\\), line \\([0-9]+\\):" 2 3) |
501cf428 | 256 | ;; Error on line 3 of t.f: Execution error unclassifiable statement |
ff735134 | 257 | ;; Unknown who does this: |
9c09c008 | 258 | ;; Line 45 of "foo.c": bloofle undefined |
5ff3b093 RM |
259 | ;; Absoft FORTRAN 77 Compiler 3.1.3 |
260 | ;; error on line 19 of fplot.f: spelling error? | |
261 | ;; warning on line 17 of fplot.f: data type is undefined for variable d | |
a24770bc | 262 | ("\\(.* on \\)?[Ll]ine[ \t]+\\([0-9]+\\)[ \t]+\ |
3e8258e7 | 263 | of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2) |
7ee790ac RM |
264 | |
265 | ;; Apollo cc, 4.3BSD fc: | |
266 | ;; "foo.f", line 3: Error: syntax error near end of statement | |
6d68d793 RS |
267 | ;; IBM RS6000: |
268 | ;; "vvouch.c", line 19.5: 1506-046 (S) Syntax error. | |
a0c567b5 RM |
269 | ;; Microtec mcc68k: |
270 | ;; "foo.c", line 32 pos 1; (E) syntax error; unexpected symbol: "lossage" | |
501cf428 | 271 | ;; GNAT (as of July 94): |
37fd2208 | 272 | ;; "foo.adb", line 2(11): warning: file name does not match ... |
b1707ae4 RM |
273 | ;; IBM AIX xlc compiler: |
274 | ;; "src/swapping.c", line 30.34: 1506-342 (W) "/*" detected in comment. | |
2fa55e20 | 275 | (".*\"\\([^,\" \n\t]+\\)\", lines? \ |
b1707ae4 | 276 | \\([0-9]+\\)\\([\(.]\\([0-9]+\\)\)?\\)?[:., (-]" 1 2 4) |
18710add | 277 | |
154b2b10 RS |
278 | ;; Python: |
279 | ;; File "foobar.py", line 5, blah blah | |
280 | ("^File \"\\([^,\" \n\t]+\\)\", line \\([0-9]+\\)," 1 2) | |
281 | ||
96db060f RS |
282 | ;; Caml compiler: |
283 | ;; File "foobar.ml", lines 5-8, characters 20-155: blah blah | |
284 | ("^File \"\\([^,\" \n\t]+\\)\", lines? \\([0-9]+\\)[-0-9]*, characters? \\([0-9]+\\)" 1 2 3) | |
285 | ||
18710add | 286 | ;; MIPS RISC CC - the one distributed with Ultrix: |
7ee790ac | 287 | ;; ccom: Error: foo.c, line 2: syntax error |
dfb89664 | 288 | ;; DEC AXP OSF/1 cc |
501cf428 | 289 | ;; /usr/lib/cmplrs/cc/cfe: Error: foo.c: 1: blah blah |
4d60e093 | 290 | ("[a-z0-9/]+: \\([eE]rror\\|[wW]arning\\): \\([^,\" \n\t]+\\)[,:] \\(line \\)?\\([0-9]+\\):" 2 4) |
7ee790ac RM |
291 | |
292 | ;; IBM AIX PS/2 C version 1.1: | |
293 | ;; ****** Error number 140 in line 8 of file errors.c ****** | |
2fa55e20 | 294 | (".*in line \\([0-9]+\\) of file \\([^ \n]+[^. \n]\\)\\.? " 2 1) |
d3cb357b RM |
295 | ;; IBM AIX lint is too painful to do right this way. File name |
296 | ;; prefixes entire sections rather than being on each line. | |
57c8389c | 297 | |
a24770bc RS |
298 | ;; SPARCcompiler Pascal: |
299 | ;; 20 linjer : array[1..4] of linje; | |
300 | ;; e 18480-----------^--- Inserted ';' | |
301 | ;; and | |
302 | ;; E 18520 line 61 - 0 is undefined | |
303 | ;; These messages don't contain a file name. Instead the compiler gives | |
304 | ;; a message whenever the file being compiled is changed. | |
305 | (" +\\([0-9]+\\) +.*\n[ew] [0-9]+-+" nil 1) | |
306 | ("[Ew] +[0-9]+ line \\([0-9]+\\) - " nil 1) | |
307 | ||
72244bea RM |
308 | ;; Lucid Compiler, lcc 3.x |
309 | ;; E, file.cc(35,52) Illegal operation on pointers | |
2fa55e20 | 310 | ("[EW], \\([^(\n]*\\)(\\([0-9]+\\),[ \t]*\\([0-9]+\\)" 1 2 3) |
72244bea | 311 | |
5b6858da SM |
312 | ;; This seems to be superfluous because the first pattern matches it. |
313 | ;; ;; GNU messages with program name and optional column number. | |
314 | ;; ("[a-zA-Z]?:?[^0-9 \n\t:]+[^ \n\t:]*:[ \t]*\\([^ \n\t:]+\\):\ | |
315 | ;;\\([0-9]+\\):\\(\\([0-9]+\\)[: \t]\\)?" 1 2 4) | |
4dbf8a2c RM |
316 | |
317 | ;; Cray C compiler error messages | |
a24770bc RS |
318 | ("\\(cc\\| cft\\)-[0-9]+ c\\(c\\|f77\\): ERROR \\([^,\n]+, \\)* File = \ |
319 | \\([^,\n]+\\), Line = \\([0-9]+\\)" 4 5) | |
4dbf8a2c RM |
320 | |
321 | ;; IBM C/C++ Tools 2.01: | |
322 | ;; foo.c(2:0) : informational EDC0804: Function foo is not referenced. | |
323 | ;; foo.c(3:8) : warning EDC0833: Implicit return statement encountered. | |
324 | ;; foo.c(5:5) : error EDC0350: Syntax error. | |
2fa55e20 | 325 | ("\\([^( \n\t]+\\)(\\([0-9]+\\):\\([0-9]+\\)) : " 1 2 3) |
cfda7e6d | 326 | |
b1b56e01 RS |
327 | ;; IAR Systems C Compiler: |
328 | ;; "foo.c",3 Error[32]: Error message | |
329 | ;; "foo.c",3 Warning[32]: Error message | |
330 | ("\"\\(.*\\)\",\\([0-9]+\\)\\s-+\\(Error\\|Warning\\)\\[[0-9]+\\]:" 1 2) | |
331 | ||
cfda7e6d RM |
332 | ;; Sun ada (VADS, Solaris): |
333 | ;; /home3/xdhar/rcds_rc/main.a, line 361, char 6:syntax error: "," inserted | |
2fa55e20 | 334 | ("\\([^, \n\t]+\\), line \\([0-9]+\\), char \\([0-9]+\\)[:., \(-]" 1 2 3) |
cbf7f476 RS |
335 | |
336 | ;; Perl -w: | |
337 | ;; syntax error at automake line 922, near "':'" | |
3d8be0c9 RS |
338 | ;; Perl debugging traces |
339 | ;; store::odrecall('File_A', 'x2') called at store.pm line 90 | |
340 | (".* at \\([^ \n]+\\) line \\([0-9]+\\)[,.\n]" 1 2) | |
7ce22b41 RS |
341 | |
342 | ;; Oracle pro*c: | |
343 | ;; Semantic error at line 528, column 5, file erosacqdb.pc: | |
344 | ("Semantic error at line \\([0-9]+\\), column \\([0-9]+\\), file \\(.*\\):" | |
345 | 3 1 2) | |
5dfa3d35 RS |
346 | |
347 | ;; EPC F90 compiler: | |
348 | ;; Error 24 at (2:progran.f90) : syntax error | |
349 | ("Error [0-9]+ at (\\([0-9]*\\):\\([^)\n]+\\))" 2 1) | |
c7c5bbc0 | 350 | |
04f12e57 | 351 | ;; SGI IRIX MipsPro 7.3 compilers: |
e3c0f9de RS |
352 | ;; cc-1070 cc: ERROR File = linkl.c, Line = 38 |
353 | (".*: ERROR File = \\(.+\\), Line = \\([0-9]+\\)" 1 2) | |
354 | (".*: WARNING File = \\(.+\\), Line = \\([0-9]+\\)" 1 2) | |
355 | ||
c7c5bbc0 | 356 | ;; Sun F90 error messages: |
851231e9 | 357 | ;; cf90-113 f90comp: ERROR NSE, File = Hoved.f90, Line = 16, Column = 3 |
c7c5bbc0 KH |
358 | (".* ERROR [a-zA-Z0-9 ]+, File = \\(.+\\), Line = \\([0-9]+\\), Column = \\([0-9]+\\)" |
359 | 1 2 3) | |
c299126f MB |
360 | |
361 | ;; RXP - GPL XML validator at http://www.cogsci.ed.ac.uk/~richard/rxp.html: | |
362 | ;; Error: Mismatched end tag: expected </geroup>, got </group> | |
363 | ;; in unnamed entity at line 71 char 8 of file:///home/reto/test/group.xml | |
364 | ("Error:.*\n.* line \\([0-9]+\\) char \\([0-9]+\\) of file://\\(.+\\)" | |
365 | 3 1 2) | |
366 | ;; Warning: Start tag for undeclared element geroup | |
367 | ;; in unnamed entity at line 4 char 8 of file:///home/reto/test/group.xml | |
368 | ("Warning:.*\n.* line \\([0-9]+\\) char \\([0-9]+\\) of file://\\(.+\\)" | |
369 | 3 1 2) | |
e1f540f2 AS |
370 | |
371 | ;; See http://ant.apache.org/faq.html | |
372 | ;; Ant Java: works for jikes | |
373 | ("^\\s-*\\[[^]]*\\]\\s-*\\(.+\\):\\([0-9]+\\):\\([0-9]+\\):[0-9]+:[0-9]+:" 1 2 3) | |
374 | ||
375 | ;; Ant Java: works for javac | |
376 | ("^\\s-*\\[[^]]*\\]\\s-*\\(.+\\):\\([0-9]+\\):" 1 2) | |
377 | ||
d3cb357b | 378 | ) |
40d63d1f | 379 | |
6c43f2f9 | 380 | "Alist that specifies how to match errors in compiler output. |
20c1daec | 381 | Each elt has the form (REGEXP FILE-IDX LINE-IDX [COLUMN-IDX FILE-FORMAT...]) |
72244bea RM |
382 | If REGEXP matches, the FILE-IDX'th subexpression gives the file name, and |
383 | the LINE-IDX'th subexpression gives the line number. If COLUMN-IDX is | |
20c1daec RM |
384 | given, the COLUMN-IDX'th subexpression gives the column number on that line. |
385 | If any FILE-FORMAT is given, each is a format string to produce a file name to | |
386 | try; %s in the string is replaced by the text matching the FILE-IDX'th | |
387 | subexpression.") | |
55dfd2c4 | 388 | |
ebb8cb68 EZ |
389 | (defvar compilation-directory nil |
390 | "Directory to restore to when doing `recompile'.") | |
391 | ||
a24770bc RS |
392 | (defvar compilation-enter-directory-regexp-alist |
393 | '( | |
394 | ;; Matches lines printed by the `-w' option of GNU Make. | |
395 | (".*: Entering directory `\\(.*\\)'$" 1) | |
3b5fb045 RS |
396 | ;; Matches lines made by Emacs byte compiler. |
397 | ("^Entering directory `\\(.*\\)'$" 1) | |
a24770bc RS |
398 | ) |
399 | "Alist specifying how to match lines that indicate a new current directory. | |
400 | Note that the match is done at the beginning of lines. | |
401 | Each elt has the form (REGEXP IDX). | |
402 | If REGEXP matches, the IDX'th subexpression gives the directory name. | |
403 | ||
404 | The default value matches lines printed by the `-w' option of GNU Make.") | |
405 | ||
406 | (defvar compilation-leave-directory-regexp-alist | |
407 | '( | |
408 | ;; Matches lines printed by the `-w' option of GNU Make. | |
409 | (".*: Leaving directory `\\(.*\\)'$" 1) | |
3b5fb045 RS |
410 | ;; Matches lines made by Emacs byte compiler. |
411 | ("^Leaving directory `\\(.*\\)'$" 1) | |
a24770bc RS |
412 | ) |
413 | "Alist specifying how to match lines that indicate restoring current directory. | |
414 | Note that the match is done at the beginning of lines. | |
415 | Each elt has the form (REGEXP IDX). | |
416 | If REGEXP matches, the IDX'th subexpression gives the name of the directory | |
851231e9 | 417 | being moved from. If IDX is nil, the last directory entered \(by a line |
a24770bc RS |
418 | matching `compilation-enter-directory-regexp-alist'\) is assumed. |
419 | ||
420 | The default value matches lines printed by the `-w' option of GNU Make.") | |
421 | ||
422 | (defvar compilation-file-regexp-alist | |
423 | '( | |
424 | ;; This matches entries with date time year file-name: like | |
425 | ;; Thu May 14 10:46:12 1992 mom3.p: | |
426 | ("\\w\\w\\w \\w\\w\\w +[0-9]+ [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9][0-9][0-9][0-9] \\(.*\\):$" 1) | |
427 | ) | |
428 | "Alist specifying how to match lines that indicate a new current file. | |
429 | Note that the match is done at the beginning of lines. | |
430 | Each elt has the form (REGEXP IDX). | |
851231e9 | 431 | If REGEXP matches, the IDX'th subexpression gives the file name. This is |
a24770bc RS |
432 | used with compilers that don't indicate file name in every error message.") |
433 | ||
434 | ;; There is no generally useful regexp that will match non messages, but | |
435 | ;; in special cases there might be one. The lines that are not matched by | |
436 | ;; a regexp take much longer time than the ones that are recognized so if | |
437 | ;; you have same regexeps here, parsing is faster. | |
438 | (defvar compilation-nomessage-regexp-alist | |
439 | '( | |
440 | ) | |
441 | "Alist specifying how to match lines that have no message. | |
442 | Note that the match is done at the beginning of lines. | |
851231e9 | 443 | Each elt has the form (REGEXP). This alist is by default empty, but if |
a24770bc RS |
444 | you have some good regexps here, the parsing of messages will be faster.") |
445 | ||
9ac57479 KS |
446 | (defvar compilation-highlight-regexp t |
447 | "Regexp matching part of visited source lines to highlight temporarily. | |
448 | Highlight entire line if t; don't highlight source lines if nil.") | |
449 | ||
450 | (defvar compilation-highlight-overlay nil | |
451 | "Overlay used to temporarily highlight compilation matches.") | |
452 | ||
f8e03ecb AS |
453 | (defcustom compilation-error-screen-columns t |
454 | "*If non-nil, column numbers in error messages are screen columns. | |
455 | Otherwise they are interpreted as character positions, with | |
456 | each character occupying one column. | |
457 | The default is to use screen columns, which requires that the compilation | |
458 | program and Emacs agree about the display width of the characters, | |
459 | especially the TAB character." | |
460 | :type 'boolean | |
461 | :group 'compilation | |
462 | :version "20.4") | |
463 | ||
c5049fa0 | 464 | (defcustom compilation-read-command t |
851231e9 DL |
465 | "*Non-nil means \\[compile] reads the compilation command to use. |
466 | Otherwise, \\[compile] just uses the value of `compile-command'." | |
c5049fa0 RS |
467 | :type 'boolean |
468 | :group 'compilation) | |
90016295 | 469 | |
e83be080 | 470 | ;;;###autoload |
c5049fa0 | 471 | (defcustom compilation-ask-about-save t |
851231e9 | 472 | "*Non-nil means \\[compile] asks which buffers to save before compiling. |
c5049fa0 RS |
473 | Otherwise, it saves all modified buffers without asking." |
474 | :type 'boolean | |
475 | :group 'compilation) | |
90016295 | 476 | |
7c163413 | 477 | ;;;###autoload |
c5049fa0 | 478 | (defcustom compilation-search-path '(nil) |
7c163413 | 479 | "*List of directories to search for source files named in error messages. |
d3cb357b | 480 | Elements should be directory names, not file names of directories. |
c5049fa0 RS |
481 | nil as an element means to try the default directory." |
482 | :type '(repeat (choice (const :tag "Default" nil) | |
483 | (string :tag "Directory"))) | |
484 | :group 'compilation) | |
55dfd2c4 | 485 | |
c5049fa0 RS |
486 | (defcustom compile-command "make -k " |
487 | "*Last shell command used to do a compilation; default for next compilation. | |
55dfd2c4 RS |
488 | |
489 | Sometimes it is useful for files to supply local values for this variable. | |
490 | You might also use mode hooks to specify it in certain modes, like this: | |
491 | ||
61c4aaf8 | 492 | (add-hook 'c-mode-hook |
61c4aaf8 RS |
493 | (lambda () |
494 | (unless (or (file-exists-p \"makefile\") | |
495 | (file-exists-p \"Makefile\")) | |
5b6858da SM |
496 | (set (make-local-variable 'compile-command) |
497 | (concat \"make -k \" | |
498 | (file-name-sans-extension buffer-file-name))))))" | |
c5049fa0 RS |
499 | :type 'string |
500 | :group 'compilation) | |
55dfd2c4 | 501 | |
d3cb357b | 502 | (defvar compilation-directory-stack nil |
6c43f2f9 | 503 | "Stack of previous directories for `compilation-leave-directory-regexp'. |
aa53db6a | 504 | The last element is the directory the compilation was started in.") |
d3cb357b | 505 | |
01f89d11 RM |
506 | (defvar compilation-exit-message-function nil "\ |
507 | If non-nil, called when a compilation process dies to return a status message. | |
fd5e58d7 RM |
508 | This should be a function of three arguments: process status, exit status, |
509 | and exit message; it returns a cons (MESSAGE . MODELINE) of the strings to | |
510 | write into the compilation buffer, and to put in its mode line.") | |
01f89d11 | 511 | |
c20f961b JPW |
512 | (defvar compilation-environment nil |
513 | "*List of environment variables for compilation to inherit. | |
514 | Each element should be a string of the form ENVVARNAME=VALUE. | |
515 | This list is temporarily prepended to `process-environment' prior to | |
516 | starting the compilation process.") | |
517 | ||
770970cb RS |
518 | ;; History of compile commands. |
519 | (defvar compile-history nil) | |
770970cb | 520 | |
e93b2a55 SM |
521 | (defun compilation-mode-font-lock-keywords () |
522 | "Return expressions to highlight in Compilation mode." | |
523 | (nconc | |
524 | ;; | |
525 | ;; Compiler warning/error lines. | |
5dfa3d35 RS |
526 | (mapcar (function |
527 | (lambda (item) | |
528 | ;; Prepend "^", adjusting FILE-IDX and LINE-IDX accordingly. | |
22052f1d KH |
529 | (let ((file-idx (nth 1 item)) |
530 | (line-idx (nth 2 item)) | |
531 | (col-idx (nth 3 item)) | |
532 | keyword) | |
533 | (when (numberp col-idx) | |
534 | (setq keyword | |
535 | (cons (list (1+ col-idx) 'font-lock-type-face nil t) | |
536 | keyword))) | |
5dfa3d35 RS |
537 | (when (numberp line-idx) |
538 | (setq keyword | |
539 | (cons (list (1+ line-idx) 'font-lock-variable-name-face) | |
540 | keyword))) | |
541 | (when (numberp file-idx) | |
542 | (setq keyword | |
543 | (cons (list (1+ file-idx) 'font-lock-warning-face) | |
544 | keyword))) | |
545 | (cons (concat "^\\(" (nth 0 item) "\\)") keyword)))) | |
e93b2a55 SM |
546 | compilation-error-regexp-alist) |
547 | (list | |
548 | ;; | |
a24770bc | 549 | ;; Compiler output lines. Recognize `make[n]:' lines too. |
e93b2a55 SM |
550 | '("^\\([A-Za-z_0-9/\.+-]+\\)\\(\\[\\([0-9]+\\)\\]\\)?[ \t]*:" |
551 | (1 font-lock-function-name-face) (3 font-lock-comment-face nil t))) | |
552 | )) | |
01f89d11 | 553 | \f |
d3cb357b | 554 | ;;;###autoload |
55dfd2c4 RS |
555 | (defun compile (command) |
556 | "Compile the program including the current buffer. Default: run `make'. | |
557 | Runs COMMAND, a shell command, in a separate process asynchronously | |
558 | with output going to the buffer `*compilation*'. | |
d3cb357b | 559 | |
55dfd2c4 RS |
560 | You can then use the command \\[next-error] to find the next error message |
561 | and move to the source code that caused it. | |
562 | ||
08b1edf4 RM |
563 | Interactively, prompts for the command if `compilation-read-command' is |
564 | non-nil; otherwise uses `compile-command'. With prefix arg, always prompts. | |
565 | ||
c72095b3 RS |
566 | To run more than one compilation at once, start one and rename |
567 | the \`*compilation*' buffer to some other name with | |
568 | \\[rename-buffer]. Then start the next one. On most systems, | |
569 | termination of the main compilation process kills its | |
570 | subprocesses. | |
d3cb357b RM |
571 | |
572 | The name used for the buffer is actually whatever is returned by | |
573 | the function in `compilation-buffer-name-function', so you can set that | |
574 | to a function that generates a unique name." | |
90016295 | 575 | (interactive |
08b1edf4 | 576 | (if (or compilation-read-command current-prefix-arg) |
90016295 | 577 | (list (read-from-minibuffer "Compile command: " |
5b6858da | 578 | (eval compile-command) nil nil |
90016295 | 579 | '(compile-history . 1))) |
5b6858da SM |
580 | (list (eval compile-command)))) |
581 | (unless (equal command (eval compile-command)) | |
582 | (setq compile-command command)) | |
90016295 | 583 | (save-some-buffers (not compilation-ask-about-save) nil) |
ebb8cb68 | 584 | (setq compilation-directory default-directory) |
5b6858da | 585 | (compile-internal command "No more errors")) |
55dfd2c4 | 586 | |
5b6858da | 587 | ;; run compile with the default command line |
e60476ca | 588 | (defun recompile () |
6867356a RS |
589 | "Re-compile the program including the current buffer. |
590 | If this is run in a compilation-mode buffer, re-use the arguments from the | |
591 | original use. Otherwise, it recompiles using `compile-command'." | |
e60476ca RS |
592 | (interactive) |
593 | (save-some-buffers (not compilation-ask-about-save) nil) | |
ebb8cb68 EZ |
594 | (let ((default-directory (or compilation-directory default-directory))) |
595 | (apply 'compile-internal (or compilation-arguments | |
596 | `(,(eval compile-command) | |
597 | "No more errors"))))) | |
09843b4a | 598 | |
b5812513 DL |
599 | (defcustom compilation-scroll-output nil |
600 | "*Non-nil to scroll the *compilation* buffer window as output appears. | |
601 | ||
602 | Setting it causes the compilation-mode commands to put point at the | |
603 | end of their output window so that the end of the output is always | |
604 | visible rather than the begining." | |
605 | :type 'boolean | |
a46fddeb | 606 | :version "20.3" |
b5812513 DL |
607 | :group 'compilation) |
608 | ||
7bdb67b2 GM |
609 | |
610 | (defun compilation-buffer-name (mode-name name-function) | |
611 | "Return the name of a compilation buffer to use. | |
612 | If NAME-FUNCTION is non-nil, call it with one argument MODE-NAME | |
613 | to determine the buffer name. | |
614 | Likewise if `compilation-buffer-name-function' is non-nil. | |
615 | If current buffer is in Compilation mode for the same mode name | |
616 | return the name of the current buffer, so that it gets reused. | |
617 | Otherwise, construct a buffer name from MODE-NAME." | |
dc2feacf | 618 | (cond (name-function |
7bdb67b2 | 619 | (funcall name-function mode-name)) |
dc2feacf | 620 | (compilation-buffer-name-function |
7bdb67b2 GM |
621 | (funcall compilation-buffer-name-function mode-name)) |
622 | ((and (eq major-mode 'compilation-mode) | |
623 | (equal mode-name (nth 2 compilation-arguments))) | |
624 | (buffer-name)) | |
625 | (t | |
626 | (concat "*" (downcase mode-name) "*")))) | |
627 | ||
628 | ||
55dfd2c4 | 629 | (defun compile-internal (command error-message |
a24770bc RS |
630 | &optional name-of-mode parser |
631 | error-regexp-alist name-function | |
632 | enter-regexp-alist leave-regexp-alist | |
23b0c5fc | 633 | file-regexp-alist nomessage-regexp-alist |
9ac57479 | 634 | no-async highlight-regexp local-map) |
55dfd2c4 RS |
635 | "Run compilation command COMMAND (low level interface). |
636 | ERROR-MESSAGE is a string to print if the user asks to see another error | |
9ac57479 KS |
637 | and there are no more errors. |
638 | ||
639 | The rest of the arguments are optional; for them, nil means use the default. | |
640 | ||
a24770bc | 641 | NAME-OF-MODE is the name to display as the major mode in the compilation |
9ac57479 KS |
642 | buffer. |
643 | ||
644 | PARSER is the error parser function. | |
645 | ERROR-REGEXP-ALIST is the error message regexp alist to use. | |
646 | NAME-FUNCTION is a function called to name the buffer. | |
647 | ENTER-REGEXP-ALIST is the enter directory message regexp alist to use. | |
a24770bc RS |
648 | LEAVE-REGEXP-ALIST is the leave directory message regexp alist to use. |
649 | FILE-REGEXP-ALIST is the change current file message regexp alist to use. | |
650 | NOMESSAGE-REGEXP-ALIST is the nomessage regexp alist to use. | |
651 | The defaults for these variables are the global values of | |
652 | \`compilation-parse-errors-function', `compilation-error-regexp-alist', | |
653 | \`compilation-buffer-name-function', `compilation-enter-directory-regexp-alist', | |
654 | \`compilation-leave-directory-regexp-alist', `compilation-file-regexp-alist', | |
655 | \ and `compilation-nomessage-regexp-alist', respectively. | |
08815e25 | 656 | For arg 7-10 a value t means an empty alist. |
646bd331 | 657 | |
23b0c5fc CW |
658 | If NO-ASYNC is non-nil, start the compilation process synchronously. |
659 | ||
9ac57479 KS |
660 | If HIGHLIGHT-REGEXP is non-nil, `next-error' will temporarily highlight |
661 | matching section of the visited source line; the default is to use the | |
662 | global value of `compilation-highlight-regexp'. | |
663 | ||
664 | If LOCAL-MAP is non-nil, use the given keymap instead of `compilation-mode-map'. | |
665 | ||
646bd331 | 666 | Returns the compilation buffer created." |
23b0c5fc CW |
667 | (unless no-async |
668 | (setq no-async (not (fboundp 'start-process)))) | |
d3cb357b | 669 | (let (outbuf) |
55dfd2c4 | 670 | (save-excursion |
d3cb357b RM |
671 | (or name-of-mode |
672 | (setq name-of-mode "Compilation")) | |
673 | (setq outbuf | |
7bdb67b2 GM |
674 | (get-buffer-create (compilation-buffer-name name-of-mode |
675 | name-function))) | |
d3cb357b RM |
676 | (set-buffer outbuf) |
677 | (let ((comp-proc (get-buffer-process (current-buffer)))) | |
678 | (if comp-proc | |
679 | (if (or (not (eq (process-status comp-proc) 'run)) | |
680 | (yes-or-no-p | |
bea1d57a JB |
681 | (format "A %s process is running; kill it? " |
682 | name-of-mode))) | |
d3cb357b RM |
683 | (condition-case () |
684 | (progn | |
685 | (interrupt-process comp-proc) | |
686 | (sit-for 1) | |
687 | (delete-process comp-proc)) | |
688 | (error nil)) | |
689 | (error "Cannot have two processes in `%s' at once" | |
690 | (buffer-name)) | |
691 | ))) | |
692 | ;; In case the compilation buffer is current, make sure we get the global | |
693 | ;; values of compilation-error-regexp-alist, etc. | |
694 | (kill-all-local-variables)) | |
a24770bc RS |
695 | (or error-regexp-alist |
696 | (setq error-regexp-alist compilation-error-regexp-alist)) | |
697 | (or enter-regexp-alist | |
698 | (setq enter-regexp-alist compilation-enter-directory-regexp-alist)) | |
699 | (or leave-regexp-alist | |
700 | (setq leave-regexp-alist compilation-leave-directory-regexp-alist)) | |
701 | (or file-regexp-alist | |
702 | (setq file-regexp-alist compilation-file-regexp-alist)) | |
703 | (or nomessage-regexp-alist | |
704 | (setq nomessage-regexp-alist compilation-nomessage-regexp-alist)) | |
9ac57479 KS |
705 | (or highlight-regexp |
706 | (setq highlight-regexp compilation-highlight-regexp)) | |
a24770bc RS |
707 | (or parser (setq parser compilation-parse-errors-function)) |
708 | (let ((thisdir default-directory) | |
501cf428 | 709 | outwin) |
d3cb357b RM |
710 | (save-excursion |
711 | ;; Clear out the compilation buffer and make it writable. | |
712 | ;; Change its default-directory to the directory where the compilation | |
713 | ;; will happen, and insert a `cd' command to indicate this. | |
714 | (set-buffer outbuf) | |
715 | (setq buffer-read-only nil) | |
5d5ab7ac | 716 | (buffer-disable-undo (current-buffer)) |
d3cb357b | 717 | (erase-buffer) |
5d5ab7ac | 718 | (buffer-enable-undo (current-buffer)) |
d3cb357b RM |
719 | (setq default-directory thisdir) |
720 | (insert "cd " thisdir "\n" command "\n") | |
721 | (set-buffer-modified-p nil)) | |
722 | ;; If we're already in the compilation buffer, go to the end | |
723 | ;; of the buffer, so point will track the compilation output. | |
724 | (if (eq outbuf (current-buffer)) | |
725 | (goto-char (point-max))) | |
726 | ;; Pop up the compilation buffer. | |
92d8844e | 727 | (setq outwin (display-buffer outbuf nil t)) |
812fade8 | 728 | (with-current-buffer outbuf |
aa53db6a | 729 | (compilation-mode name-of-mode) |
9ac57479 KS |
730 | (if local-map |
731 | (use-local-map local-map)) | |
5b6858da SM |
732 | ;; In what way is it non-ergonomic ? -stef |
733 | ;; (toggle-read-only 1) ;;; Non-ergonomic. | |
d4ece679 RS |
734 | (set (make-local-variable 'compilation-parse-errors-function) parser) |
735 | (set (make-local-variable 'compilation-error-message) error-message) | |
a24770bc RS |
736 | (set (make-local-variable 'compilation-error-regexp-alist) |
737 | error-regexp-alist) | |
738 | (set (make-local-variable 'compilation-enter-directory-regexp-alist) | |
739 | enter-regexp-alist) | |
740 | (set (make-local-variable 'compilation-leave-directory-regexp-alist) | |
741 | leave-regexp-alist) | |
742 | (set (make-local-variable 'compilation-file-regexp-alist) | |
743 | file-regexp-alist) | |
744 | (set (make-local-variable 'compilation-nomessage-regexp-alist) | |
745 | nomessage-regexp-alist) | |
9ac57479 KS |
746 | (set (make-local-variable 'compilation-highlight-regexp) |
747 | highlight-regexp) | |
58856335 RS |
748 | (set (make-local-variable 'compilation-arguments) |
749 | (list command error-message | |
750 | name-of-mode parser | |
751 | error-regexp-alist name-function | |
752 | enter-regexp-alist leave-regexp-alist | |
9ac57479 KS |
753 | file-regexp-alist nomessage-regexp-alist |
754 | nil ; or no-async ?? | |
755 | highlight-regexp local-map)) | |
b5812513 DL |
756 | ;; This proves a good idea if the buffer's going to scroll |
757 | ;; with lazy-lock on. | |
32d6fffb | 758 | (set (make-local-variable 'lazy-lock-defer-on-scrolling) t) |
d4ece679 RS |
759 | (setq default-directory thisdir |
760 | compilation-directory-stack (list default-directory)) | |
761 | (set-window-start outwin (point-min)) | |
d4ece679 | 762 | (or (eq outwin (selected-window)) |
b34e9a28 | 763 | (set-window-point outwin (point))) |
9ac57479 KS |
764 | ;; The setup function is called before compilation-set-window-height |
765 | ;; so it can set the compilation-window-height buffer locally. | |
49683a13 EZ |
766 | (if compilation-process-setup-function |
767 | (funcall compilation-process-setup-function)) | |
9ac57479 | 768 | (compilation-set-window-height outwin) |
d4ece679 | 769 | ;; Start the compilation. |
23b0c5fc | 770 | (if (not no-async) |
75da8302 RS |
771 | (let* ((process-environment |
772 | (append | |
c20f961b | 773 | compilation-environment |
75da8302 RS |
774 | (if (and (boundp 'system-uses-terminfo) |
775 | system-uses-terminfo) | |
776 | (list "TERM=dumb" "TERMCAP=" | |
777 | (format "COLUMNS=%d" (window-width))) | |
778 | (list "TERM=emacs" | |
779 | (format "TERMCAP=emacs:co#%d:tc=unknown:" | |
780 | (window-width)))) | |
781 | ;; Set the EMACS variable, but | |
782 | ;; don't override users' setting of $EMACS. | |
783 | (if (getenv "EMACS") | |
784 | process-environment | |
785 | (cons "EMACS=t" process-environment)))) | |
2bb240a9 RS |
786 | (proc (start-process-shell-command (downcase mode-name) |
787 | outbuf | |
788 | command))) | |
35f7e85b RS |
789 | (set-process-sentinel proc 'compilation-sentinel) |
790 | (set-process-filter proc 'compilation-filter) | |
791 | (set-marker (process-mark proc) (point) outbuf) | |
501cf428 | 792 | (setq compilation-in-progress |
35f7e85b | 793 | (cons proc compilation-in-progress))) |
fd5e58d7 RM |
794 | ;; No asynchronous processes available. |
795 | (message "Executing `%s'..." command) | |
d3e56891 RS |
796 | ;; Fake modeline display as if `start-process' were run. |
797 | (setq mode-line-process ":run") | |
fd5e58d7 RM |
798 | (force-mode-line-update) |
799 | (sit-for 0) ; Force redisplay | |
35f7e85b | 800 | (let ((status (call-process shell-file-name nil outbuf nil "-c" |
fd5e58d7 RM |
801 | command))) |
802 | (cond ((numberp status) | |
803 | (compilation-handle-exit 'exit status | |
804 | (if (zerop status) | |
805 | "finished\n" | |
806 | (format "\ | |
807 | exited abnormally with code %d\n" | |
808 | status)))) | |
809 | ((stringp status) | |
810 | (compilation-handle-exit 'signal status | |
811 | (concat status "\n"))) | |
812 | (t | |
813 | (compilation-handle-exit 'bizarre status status)))) | |
b5812513 | 814 | (message "Executing `%s'...done" command))) |
9ac57479 | 815 | (if (buffer-local-value 'compilation-scroll-output outbuf) |
bccc6e3d | 816 | (save-selected-window |
9ac57479 KS |
817 | (select-window outwin) |
818 | (goto-char (point-max))))) | |
d3cb357b RM |
819 | ;; Make it so the next C-x ` will use this buffer. |
820 | (setq compilation-last-buffer outbuf))) | |
55dfd2c4 | 821 | |
c94b02d6 | 822 | (defun compilation-set-window-height (window) |
851231e9 | 823 | "Set the height of WINDOW according to `compilation-window-height'." |
9ac57479 KS |
824 | (let ((height (buffer-local-value 'compilation-window-height (window-buffer window)))) |
825 | (and height | |
826 | (= (window-width window) (frame-width (window-frame window))) | |
827 | ;; If window is alone in its frame, aside from a minibuffer, | |
828 | ;; don't change its height. | |
829 | (not (eq window (frame-root-window (window-frame window)))) | |
830 | ;; This save-current-buffer prevents us from changing the current | |
831 | ;; buffer, which might not be the same as the selected window's buffer. | |
832 | (save-current-buffer | |
833 | (save-selected-window | |
834 | (select-window window) | |
835 | (enlarge-window (- height (window-height)))))))) | |
c94b02d6 | 836 | |
4282eba1 SM |
837 | (defvar compilation-menu-map |
838 | (let ((map (make-sparse-keymap "Errors"))) | |
839 | (define-key map [stop-subjob] | |
37bf89ab | 840 | '("Stop Compilation" . kill-compilation)) |
4282eba1 SM |
841 | (define-key map [compilation-mode-separator2] |
842 | '("----" . nil)) | |
9ac57479 | 843 | (define-key map [compilation-first-error] |
4282eba1 | 844 | '("First Error" . first-error)) |
9ac57479 | 845 | (define-key map [compilation-previous-error] |
4282eba1 | 846 | '("Previous Error" . previous-error)) |
9ac57479 | 847 | (define-key map [compilation-next-error] |
4282eba1 SM |
848 | '("Next Error" . next-error)) |
849 | map)) | |
850 | ||
0b18a8f6 | 851 | (defvar compilation-minor-mode-map |
55dfd2c4 | 852 | (let ((map (make-sparse-keymap))) |
f98494a4 | 853 | (define-key map [mouse-2] 'compile-mouse-goto-error) |
55dfd2c4 | 854 | (define-key map "\C-c\C-c" 'compile-goto-error) |
4e7ce12e | 855 | (define-key map "\C-m" 'compile-goto-error) |
d3cb357b | 856 | (define-key map "\C-c\C-k" 'kill-compilation) |
646bd331 RM |
857 | (define-key map "\M-n" 'compilation-next-error) |
858 | (define-key map "\M-p" 'compilation-previous-error) | |
d1ed4475 RM |
859 | (define-key map "\M-{" 'compilation-previous-file) |
860 | (define-key map "\M-}" 'compilation-next-file) | |
4282eba1 SM |
861 | ;; Set up the menu-bar |
862 | (define-key map [menu-bar compilation] | |
863 | (cons "Errors" compilation-menu-map)) | |
55dfd2c4 | 864 | map) |
4f6e4ad6 | 865 | "Keymap for `compilation-minor-mode'.") |
0b18a8f6 | 866 | |
a24770bc RS |
867 | (defvar compilation-shell-minor-mode-map |
868 | (let ((map (make-sparse-keymap))) | |
869 | (define-key map [mouse-2] 'compile-mouse-goto-error) | |
870 | (define-key map "\M-\C-m" 'compile-goto-error) | |
871 | (define-key map "\M-\C-n" 'compilation-next-error) | |
872 | (define-key map "\M-\C-p" 'compilation-previous-error) | |
873 | (define-key map "\M-{" 'compilation-previous-file) | |
874 | (define-key map "\M-}" 'compilation-next-file) | |
875 | ;; Set up the menu-bar | |
4282eba1 SM |
876 | (define-key map [menu-bar compilation] |
877 | (cons "Errors" compilation-menu-map)) | |
a24770bc RS |
878 | map) |
879 | "Keymap for `compilation-shell-minor-mode'.") | |
880 | ||
0b18a8f6 | 881 | (defvar compilation-mode-map |
4282eba1 SM |
882 | (let ((map (make-sparse-keymap))) |
883 | (set-keymap-parent map compilation-minor-mode-map) | |
0b18a8f6 RM |
884 | (define-key map " " 'scroll-up) |
885 | (define-key map "\^?" 'scroll-down) | |
9ac57479 | 886 | |
e60476ca | 887 | ;; Set up the menu-bar |
4282eba1 | 888 | (define-key map [menu-bar compilation] |
e60476ca | 889 | (cons "Compile" (make-sparse-keymap "Compile"))) |
4282eba1 | 890 | (define-key map [menu-bar compilation compilation-separator2] |
e60476ca | 891 | '("----" . nil)) |
9ac57479 | 892 | (define-key map [menu-bar compilation compilation-grep] |
7933678b | 893 | '("Search Files (grep)" . grep)) |
9ac57479 | 894 | (define-key map [menu-bar compilation compilation-recompile] |
e60476ca | 895 | '("Recompile" . recompile)) |
9ac57479 | 896 | (define-key map [menu-bar compilation compilation-compile] |
32f4ab17 | 897 | '("Compile..." . compile)) |
0b18a8f6 RM |
898 | map) |
899 | "Keymap for compilation log buffers. | |
4282eba1 | 900 | `compilation-minor-mode-map' is a parent of this.") |
55dfd2c4 | 901 | |
0a35bd79 RS |
902 | (put 'compilation-mode 'mode-class 'special) |
903 | ||
501cf428 | 904 | ;;;###autoload |
aa53db6a | 905 | (defun compilation-mode (&optional name-of-mode) |
55dfd2c4 RS |
906 | "Major mode for compilation log buffers. |
907 | \\<compilation-mode-map>To visit the source for a line-numbered error, | |
d3cb357b | 908 | move point to the error message line and type \\[compile-goto-error]. |
7c163413 RM |
909 | To kill the compilation, type \\[kill-compilation]. |
910 | ||
911 | Runs `compilation-mode-hook' with `run-hooks' (which see)." | |
55dfd2c4 | 912 | (interactive) |
9af0d309 | 913 | (kill-all-local-variables) |
55dfd2c4 | 914 | (use-local-map compilation-mode-map) |
0b18a8f6 | 915 | (setq major-mode 'compilation-mode |
aa53db6a | 916 | mode-name (or name-of-mode "Compilation")) |
0b18a8f6 | 917 | (compilation-setup) |
63a2daf6 SM |
918 | (set (make-local-variable 'font-lock-defaults) |
919 | '(compilation-mode-font-lock-keywords t)) | |
58856335 RS |
920 | (set (make-local-variable 'revert-buffer-function) |
921 | 'compilation-revert-buffer) | |
0b18a8f6 RM |
922 | (run-hooks 'compilation-mode-hook)) |
923 | ||
58856335 | 924 | (defun compilation-revert-buffer (ignore-auto noconfirm) |
9ed2ab9f RS |
925 | (if buffer-file-name |
926 | (let (revert-buffer-function) | |
9ac57479 | 927 | (revert-buffer ignore-auto noconfirm)) |
9ed2ab9f RS |
928 | (if (or noconfirm (yes-or-no-p (format "Restart compilation? "))) |
929 | (apply 'compile-internal compilation-arguments)))) | |
58856335 | 930 | |
0b18a8f6 | 931 | (defun compilation-setup () |
851231e9 | 932 | "Prepare the buffer for the compilation parsing commands to work." |
0b18a8f6 | 933 | ;; Make the buffer's mode line show process state. |
ebf0b439 | 934 | (setq mode-line-process '(":%s")) |
d3cb357b RM |
935 | (set (make-local-variable 'compilation-error-list) nil) |
936 | (set (make-local-variable 'compilation-old-error-list) nil) | |
c4d7c00a | 937 | (set (make-local-variable 'compilation-parsing-end) (copy-marker 1)) |
474d71ae RS |
938 | (set (make-local-variable 'compilation-directory-stack) |
939 | (list default-directory)) | |
18aac618 | 940 | (make-local-variable 'compilation-error-screen-columns) |
0b18a8f6 RM |
941 | (setq compilation-last-buffer (current-buffer))) |
942 | ||
7052680b | 943 | ;;;###autoload |
4282eba1 | 944 | (define-minor-mode compilation-shell-minor-mode |
7052680b RS |
945 | "Toggle compilation shell minor mode. |
946 | With arg, turn compilation mode on if and only if arg is positive. | |
4282eba1 SM |
947 | In this minor mode, all the error-parsing commands of the |
948 | Compilation major mode are available but bound to keys that don't | |
949 | collide with Shell mode. See `compilation-mode'. | |
7052680b | 950 | Turning the mode on runs the normal hook `compilation-shell-minor-mode-hook'." |
4282eba1 | 951 | nil " Shell-Compile" nil |
d408fed8 | 952 | :group 'compilation |
4282eba1 SM |
953 | (let (mode-line-process) |
954 | (compilation-setup))) | |
7052680b | 955 | |
d6bd8dca | 956 | ;;;###autoload |
4282eba1 | 957 | (define-minor-mode compilation-minor-mode |
0b18a8f6 RM |
958 | "Toggle compilation minor mode. |
959 | With arg, turn compilation mode on if and only if arg is positive. | |
4282eba1 SM |
960 | In this minor mode, all the error-parsing commands of the |
961 | Compilation major mode are available. See `compilation-mode'. | |
fee3f63a | 962 | Turning the mode on runs the normal hook `compilation-minor-mode-hook'." |
4282eba1 | 963 | nil " Compilation" nil |
d408fed8 | 964 | :group 'compilation |
4282eba1 SM |
965 | (let ((mode-line-process)) |
966 | (compilation-setup))) | |
55dfd2c4 | 967 | |
fd5e58d7 | 968 | (defun compilation-handle-exit (process-status exit-status msg) |
851231e9 | 969 | "Write msg in the current buffer and hack its mode-line-process." |
fd5e58d7 RM |
970 | (let ((buffer-read-only nil) |
971 | (status (if compilation-exit-message-function | |
972 | (funcall compilation-exit-message-function | |
973 | process-status exit-status msg) | |
974 | (cons msg exit-status))) | |
975 | (omax (point-max)) | |
976 | (opoint (point))) | |
977 | ;; Record where we put the message, so we can ignore it | |
978 | ;; later on. | |
979 | (goto-char omax) | |
980 | (insert ?\n mode-name " " (car status)) | |
0eac1faa RS |
981 | (if (and (numberp compilation-window-height) |
982 | (zerop compilation-window-height)) | |
983 | (message "%s" (cdr status))) | |
01c50447 RS |
984 | (if (bolp) |
985 | (forward-char -1)) | |
fd5e58d7 | 986 | (insert " at " (substring (current-time-string) 0 19)) |
01c50447 | 987 | (goto-char (point-max)) |
47092737 RS |
988 | ;; Prevent that message from being recognized as a compilation error. |
989 | (add-text-properties omax (point) | |
990 | (append '(compilation-handle-exit t) nil)) | |
52f84622 | 991 | (setq mode-line-process (format ":%s [%s]" process-status (cdr status))) |
fd5e58d7 RM |
992 | ;; Force mode line redisplay soon. |
993 | (force-mode-line-update) | |
994 | (if (and opoint (< opoint omax)) | |
995 | (goto-char opoint)) | |
01e6e8c9 RS |
996 | ;; Automatically parse (and mouse-highlight) error messages: |
997 | (cond ((eq compile-auto-highlight t) | |
37f5f978 | 998 | (compile-reinitialize-errors nil (point-max))) |
01e6e8c9 RS |
999 | ((numberp compile-auto-highlight) |
1000 | (compile-reinitialize-errors nil | |
1001 | (save-excursion | |
1002 | (goto-line compile-auto-highlight) | |
1003 | (point))))) | |
fd5e58d7 | 1004 | (if compilation-finish-function |
4cc36b17 RS |
1005 | (funcall compilation-finish-function (current-buffer) msg)) |
1006 | (let ((functions compilation-finish-functions)) | |
1007 | (while functions | |
1008 | (funcall (car functions) (current-buffer) msg) | |
1009 | (setq functions (cdr functions)))))) | |
fd5e58d7 | 1010 | |
55dfd2c4 | 1011 | ;; Called when compilation process changes state. |
55dfd2c4 | 1012 | (defun compilation-sentinel (proc msg) |
d3cb357b RM |
1013 | "Sentinel for compilation buffers." |
1014 | (let ((buffer (process-buffer proc))) | |
ebff767c RM |
1015 | (if (memq (process-status proc) '(signal exit)) |
1016 | (progn | |
1017 | (if (null (buffer-name buffer)) | |
1018 | ;; buffer killed | |
1019 | (set-process-buffer proc nil) | |
fd5e58d7 | 1020 | (let ((obuf (current-buffer))) |
ebff767c RM |
1021 | ;; save-excursion isn't the right thing if |
1022 | ;; process-buffer is current-buffer | |
1023 | (unwind-protect | |
1024 | (progn | |
1025 | ;; Write something in the compilation buffer | |
1026 | ;; and hack its mode line. | |
1027 | (set-buffer buffer) | |
fd5e58d7 RM |
1028 | (compilation-handle-exit (process-status proc) |
1029 | (process-exit-status proc) | |
1030 | msg) | |
1031 | ;; Since the buffer and mode line will show that the | |
1032 | ;; process is dead, we can delete it now. Otherwise it | |
1033 | ;; will stay around until M-x list-processes. | |
1034 | (delete-process proc)) | |
6c43f2f9 | 1035 | (set-buffer obuf)))) |
ebff767c RM |
1036 | (setq compilation-in-progress (delq proc compilation-in-progress)) |
1037 | )))) | |
55dfd2c4 | 1038 | |
ad62b7f1 RM |
1039 | (defun compilation-filter (proc string) |
1040 | "Process filter for compilation buffers. | |
4f6e4ad6 | 1041 | Just inserts the text, but uses `insert-before-markers'." |
991c70f8 | 1042 | (if (buffer-name (process-buffer proc)) |
ad62b7f1 | 1043 | (save-excursion |
991c70f8 | 1044 | (set-buffer (process-buffer proc)) |
c4d7c00a RS |
1045 | (let ((buffer-read-only nil) |
1046 | (end (marker-position compilation-parsing-end))) | |
991c70f8 RS |
1047 | (save-excursion |
1048 | (goto-char (process-mark proc)) | |
1049 | (insert-before-markers string) | |
c4d7c00a | 1050 | (set-marker compilation-parsing-end end) ;don't move it |
d89793b7 | 1051 | (run-hooks 'compilation-filter-hook) |
c4d7c00a RS |
1052 | ;; this seems redundant since we insert-before-marks -stefan |
1053 | ;;(set-marker (process-mark proc) (point)) | |
1054 | ))))) | |
ad62b7f1 | 1055 | |
b5bb472e | 1056 | (defun compile-error-at-point () |
851231e9 | 1057 | "Return the cdr of `compilation-old-error-list' for error containing point." |
b5bb472e RM |
1058 | (compile-reinitialize-errors nil (point)) |
1059 | (let ((errors compilation-old-error-list)) | |
1060 | (while (and errors | |
1061 | (> (point) (car (car errors)))) | |
1062 | (setq errors (cdr errors))) | |
1063 | errors)) | |
1064 | ||
51ba27e7 | 1065 | (defsubst compilation-buffer-p (buffer) |
20c1daec RM |
1066 | (save-excursion |
1067 | (set-buffer buffer) | |
a24770bc RS |
1068 | (or compilation-shell-minor-mode compilation-minor-mode |
1069 | (eq major-mode 'compilation-mode)))) | |
51ba27e7 | 1070 | |
646bd331 RM |
1071 | (defun compilation-next-error (n) |
1072 | "Move point to the next error in the compilation buffer. | |
851231e9 DL |
1073 | Prefix arg N says how many error messages to move forwards (or |
1074 | backwards, if negative). | |
646bd331 RM |
1075 | Does NOT find the source line like \\[next-error]." |
1076 | (interactive "p") | |
1077 | (or (compilation-buffer-p (current-buffer)) | |
851231e9 | 1078 | (error "Not in a compilation buffer")) |
646bd331 | 1079 | (setq compilation-last-buffer (current-buffer)) |
b5bb472e RM |
1080 | |
1081 | (let ((errors (compile-error-at-point))) | |
1082 | ||
1083 | ;; Move to the error after the one containing point. | |
1084 | (goto-char (car (if (< n 0) | |
1085 | (let ((i 0) | |
1086 | (e compilation-old-error-list)) | |
1087 | ;; See how many cdrs away ERRORS is from the start. | |
1088 | (while (not (eq e errors)) | |
1089 | (setq i (1+ i) | |
1090 | e (cdr e))) | |
1091 | (if (> (- n) i) | |
1092 | (error "Moved back past first error") | |
1093 | (nth (+ i n) compilation-old-error-list))) | |
83b5c8e0 | 1094 | (save-excursion |
c72095b3 | 1095 | (while (and (> n 0) errors) |
83b5c8e0 | 1096 | ;; Discard the current error and any previous. |
c72095b3 | 1097 | (while (and errors (>= (point) (car (car errors)))) |
83b5c8e0 RS |
1098 | (setq errors (cdr errors))) |
1099 | ;; Now (car errors) is the next error. | |
1100 | ;; If we want to move down more errors, | |
1101 | ;; put point at this one and start again. | |
1102 | (setq n (1- n)) | |
1103 | (if (and errors (> n 0)) | |
1104 | (goto-char (car (car errors)))))) | |
1105 | (let ((compilation-error-list errors)) | |
b5bb472e RM |
1106 | (compile-reinitialize-errors nil nil n) |
1107 | (if compilation-error-list | |
1108 | (nth (1- n) compilation-error-list) | |
1109 | (error "Moved past last error")))))))) | |
646bd331 RM |
1110 | |
1111 | (defun compilation-previous-error (n) | |
1112 | "Move point to the previous error in the compilation buffer. | |
851231e9 DL |
1113 | Prefix arg N says how many error messages to move backwards (or |
1114 | forwards, if negative). | |
646bd331 RM |
1115 | Does NOT find the source line like \\[next-error]." |
1116 | (interactive "p") | |
1117 | (compilation-next-error (- n))) | |
1118 | ||
9ac57479 KS |
1119 | (defun next-error-no-select (n) |
1120 | "Move point to the next error in the compilation buffer and highlight match. | |
1121 | Prefix arg N says how many error messages to move forwards. | |
1122 | Finds and highlights the source line like \\[next-error], but does not | |
1123 | select the source buffer." | |
1124 | (interactive "p") | |
1125 | (next-error n) | |
1126 | (pop-to-buffer compilation-last-buffer)) | |
1127 | ||
1128 | (defun previous-error-no-select (n) | |
1129 | "Move point to the previous error in the compilation buffer and highlight match. | |
1130 | Prefix arg N says how many error messages to move forwards. | |
1131 | Finds and highlights the source line like \\[next-error], but does not | |
1132 | select the source buffer." | |
1133 | (interactive "p") | |
1134 | (next-error (- n)) | |
1135 | (pop-to-buffer compilation-last-buffer)) | |
646bd331 | 1136 | |
fc0094d7 RM |
1137 | ;; Given an elt of `compilation-error-list', return an object representing |
1138 | ;; the referenced file which is equal to (but not necessarily eq to) what | |
1139 | ;; this function would return for another error in the same file. | |
1140 | (defsubst compilation-error-filedata (data) | |
b5bb472e RM |
1141 | (setq data (cdr data)) |
1142 | (if (markerp data) | |
fc0094d7 | 1143 | (marker-buffer data) |
aead2f9f | 1144 | (car data))) |
b5bb472e | 1145 | |
fc0094d7 RM |
1146 | ;; Return a string describing a value from compilation-error-filedata. |
1147 | ;; This value is not necessarily useful as a file name, but should be | |
1148 | ;; indicative to the user of what file's errors are being referred to. | |
1149 | (defsubst compilation-error-filedata-file-name (filedata) | |
1150 | (if (bufferp filedata) | |
1151 | (buffer-file-name filedata) | |
1152 | (car filedata))) | |
1153 | ||
b5bb472e RM |
1154 | (defun compilation-next-file (n) |
1155 | "Move point to the next error for a different file than the current one." | |
1156 | (interactive "p") | |
1157 | (or (compilation-buffer-p (current-buffer)) | |
851231e9 | 1158 | (error "Not in a compilation buffer")) |
b5bb472e RM |
1159 | (setq compilation-last-buffer (current-buffer)) |
1160 | ||
1161 | (let ((reversed (< n 0)) | |
fc0094d7 | 1162 | errors filedata) |
b5bb472e RM |
1163 | |
1164 | (if (not reversed) | |
1165 | (setq errors (or (compile-error-at-point) | |
1166 | (error "Moved past last error"))) | |
1167 | ||
1168 | ;; Get a reversed list of the errors up through the one containing point. | |
1169 | (compile-reinitialize-errors nil (point)) | |
1170 | (setq errors (reverse compilation-old-error-list) | |
1171 | n (- n)) | |
1172 | ||
1173 | ;; Ignore errors after point. (car ERRORS) will be the error | |
1174 | ;; containing point, (cadr ERRORS) the one before it. | |
1175 | (while (and errors | |
1176 | (< (point) (car (car errors)))) | |
1177 | (setq errors (cdr errors)))) | |
1178 | ||
1179 | (while (> n 0) | |
fc0094d7 RM |
1180 | (setq filedata (compilation-error-filedata (car errors))) |
1181 | ||
1182 | ;; Skip past the following errors for this file. | |
1183 | (while (equal filedata | |
1184 | (compilation-error-filedata | |
1185 | (car (or errors | |
1186 | (if reversed | |
1187 | (error "%s the first erring file" | |
1188 | (compilation-error-filedata-file-name | |
1189 | filedata)) | |
1190 | (let ((compilation-error-list nil)) | |
1191 | ;; Parse some more. | |
1192 | (compile-reinitialize-errors nil nil 2) | |
1193 | (setq errors compilation-error-list))) | |
501cf428 | 1194 | (error "%s is the last erring file" |
fc0094d7 RM |
1195 | (compilation-error-filedata-file-name |
1196 | filedata)))))) | |
b5bb472e RM |
1197 | (setq errors (cdr errors))) |
1198 | ||
1199 | (setq n (1- n))) | |
1200 | ||
1201 | ;; Move to the following error. | |
1202 | (goto-char (car (car (or errors | |
1203 | (if reversed | |
1204 | (error "This is the first erring file") | |
1205 | (let ((compilation-error-list nil)) | |
1206 | ;; Parse the last one. | |
1207 | (compile-reinitialize-errors nil nil 1) | |
1208 | compilation-error-list)))))))) | |
1209 | ||
1210 | (defun compilation-previous-file (n) | |
1211 | "Move point to the previous error for a different file than the current one." | |
1212 | (interactive "p") | |
1213 | (compilation-next-file (- n))) | |
1214 | ||
55dfd2c4 | 1215 | (defun kill-compilation () |
b765ba64 | 1216 | "Kill the process made by the \\[compile] or \\[grep] commands." |
55dfd2c4 | 1217 | (interactive) |
d3cb357b | 1218 | (let ((buffer (compilation-find-buffer))) |
55dfd2c4 | 1219 | (if (get-buffer-process buffer) |
d3cb357b | 1220 | (interrupt-process (get-buffer-process buffer)) |
851231e9 | 1221 | (error "The compilation process is not running")))) |
d3cb357b | 1222 | |
b765ba64 | 1223 | (defalias 'kill-grep 'kill-compilation) |
55dfd2c4 | 1224 | |
d3cb357b RM |
1225 | ;; Parse any new errors in the compilation buffer, |
1226 | ;; or reparse from the beginning if the user has asked for that. | |
eaa3cac5 RM |
1227 | (defun compile-reinitialize-errors (reparse |
1228 | &optional limit-search find-at-least) | |
d3cb357b RM |
1229 | (save-excursion |
1230 | (set-buffer compilation-last-buffer) | |
1231 | ;; If we are out of errors, or if user says "reparse", | |
1232 | ;; discard the info we have, to force reparsing. | |
1233 | (if (or (eq compilation-error-list t) | |
eaa3cac5 | 1234 | reparse) |
51ba27e7 | 1235 | (compilation-forget-errors)) |
c540863c | 1236 | (if (and compilation-error-list |
b5bb472e RM |
1237 | (or (not limit-search) |
1238 | (> compilation-parsing-end limit-search)) | |
c540863c | 1239 | (or (not find-at-least) |
a72ba929 | 1240 | (>= (length compilation-error-list) find-at-least))) |
d3cb357b RM |
1241 | ;; Since compilation-error-list is non-nil, it points to a specific |
1242 | ;; error the user wanted. So don't move it around. | |
1243 | nil | |
51ba27e7 RM |
1244 | ;; This was here for a long time (before my rewrite); why? --roland |
1245 | ;;(switch-to-buffer compilation-last-buffer) | |
55dfd2c4 | 1246 | (set-buffer-modified-p nil) |
b5bb472e | 1247 | (if (< compilation-parsing-end (point-max)) |
51ba27e7 | 1248 | ;; compilation-error-list might be non-nil if we have a non-nil |
676a14e1 | 1249 | ;; LIMIT-SEARCH or FIND-AT-LEAST arg. In that case its value |
51ba27e7 RM |
1250 | ;; records the current position in the error list, and we must |
1251 | ;; preserve that after reparsing. | |
1252 | (let ((error-list-pos compilation-error-list)) | |
b5bb472e | 1253 | (funcall compilation-parse-errors-function |
51ba27e7 RM |
1254 | limit-search |
1255 | (and find-at-least | |
1256 | ;; We only need enough new parsed errors to reach | |
1257 | ;; FIND-AT-LEAST errors past the current | |
1258 | ;; position. | |
1259 | (- find-at-least (length compilation-error-list)))) | |
1260 | ;; Remember the entire list for compilation-forget-errors. If | |
1261 | ;; this is an incremental parse, append to previous list. If | |
1262 | ;; we are parsing anew, compilation-forget-errors cleared | |
1263 | ;; compilation-old-error-list above. | |
1264 | (setq compilation-old-error-list | |
1265 | (nconc compilation-old-error-list compilation-error-list)) | |
1266 | (if error-list-pos | |
1267 | ;; We started in the middle of an existing list of parsed | |
1268 | ;; errors before parsing more; restore that position. | |
1269 | (setq compilation-error-list error-list-pos)) | |
01e6e8c9 | 1270 | ;; Mouse-Highlight (the first line of) each error message when the |
37f5f978 RS |
1271 | ;; mouse pointer moves over it: |
1272 | (let ((inhibit-read-only t) | |
474d71ae RS |
1273 | (buffer-undo-list t) |
1274 | deactivate-mark | |
311ff235 | 1275 | (buffer-was-modified (buffer-modified-p)) |
37f5f978 RS |
1276 | (error-list compilation-error-list)) |
1277 | (while error-list | |
1278 | (save-excursion | |
08de70d7 EZ |
1279 | (add-text-properties (goto-char (car (car error-list))) |
1280 | (progn (end-of-line) (point)) | |
1281 | '(mouse-face highlight help-echo "\ | |
1282 | mouse-2: visit this file and line"))) | |
311ff235 JB |
1283 | (setq error-list (cdr error-list))) |
1284 | (set-buffer-modified-p buffer-was-modified)) | |
b5bb472e | 1285 | ))))) |
55dfd2c4 | 1286 | |
f98494a4 | 1287 | (defun compile-mouse-goto-error (event) |
d28701c7 RS |
1288 | "Visit the source for the error message the mouse is pointing at. |
1289 | This is like `compile-goto-error' called without prefix arg | |
1290 | at the end of the line." | |
f98494a4 | 1291 | (interactive "e") |
e78e10ca KH |
1292 | (save-excursion |
1293 | (set-buffer (window-buffer (posn-window (event-end event)))) | |
1294 | (goto-char (posn-point (event-end event))) | |
1295 | ||
1296 | (or (compilation-buffer-p (current-buffer)) | |
851231e9 | 1297 | (error "Not in a compilation buffer")) |
e78e10ca | 1298 | (setq compilation-last-buffer (current-buffer)) |
167d1418 EZ |
1299 | ;; `compile-reinitialize-errors' needs to see the complete filename |
1300 | ;; on the line where they clicked the mouse. Since it only looks | |
a24770bc | 1301 | ;; up to point, moving point to eol makes sure the filename is |
167d1418 EZ |
1302 | ;; visible to `compile-reinitialize-errors'. |
1303 | (end-of-line) | |
e78e10ca KH |
1304 | (compile-reinitialize-errors nil (point)) |
1305 | ||
1306 | ;; Move to bol; the marker for the error on this line will point there. | |
1307 | (beginning-of-line) | |
1308 | ||
1309 | ;; Move compilation-error-list to the elt of compilation-old-error-list | |
1310 | ;; we want. | |
1311 | (setq compilation-error-list compilation-old-error-list) | |
1312 | (while (and compilation-error-list | |
41a3354e DL |
1313 | ;; The marker can point nowhere if we previously |
1314 | ;; failed to find the relevant file. See | |
1315 | ;; compilation-next-error-locus. | |
1316 | (or (null (marker-buffer (caar compilation-error-list))) | |
8f36a284 | 1317 | (and (> (point) (caar compilation-error-list)) |
2827a3c1 RS |
1318 | (>= (point) |
1319 | ;; Don't skip too far: the text between | |
1320 | ;; two errors belongs to the first. This | |
1321 | ;; in-between text might be other errors | |
1322 | ;; on the same line (see | |
1323 | ;; compilation-skip-to-next-location). | |
1324 | (if (null (cdr compilation-error-list)) | |
1325 | compilation-parsing-end | |
1326 | (caar (cdr compilation-error-list))))))) | |
e78e10ca KH |
1327 | (setq compilation-error-list (cdr compilation-error-list))) |
1328 | (or compilation-error-list | |
1329 | (error "No error to go to"))) | |
1330 | (select-window (posn-window (event-end event))) | |
e78e10ca KH |
1331 | |
1332 | (push-mark) | |
1333 | (next-error 1)) | |
f98494a4 | 1334 | |
55dfd2c4 RS |
1335 | (defun compile-goto-error (&optional argp) |
1336 | "Visit the source for the error message point is on. | |
31efa7c9 | 1337 | Use this command in a compilation log buffer. Sets the mark at point there. |
b2bb6ec8 | 1338 | \\[universal-argument] as a prefix arg means to reparse the buffer's error messages first; |
55dfd2c4 RS |
1339 | other kinds of prefix arguments are ignored." |
1340 | (interactive "P") | |
d3cb357b | 1341 | (or (compilation-buffer-p (current-buffer)) |
851231e9 | 1342 | (error "Not in a compilation buffer")) |
d3cb357b | 1343 | (setq compilation-last-buffer (current-buffer)) |
eaa3cac5 | 1344 | (compile-reinitialize-errors (consp argp) (point)) |
646bd331 | 1345 | |
15d1a8da RM |
1346 | ;; Move to bol; the marker for the error on this line will point there. |
1347 | (beginning-of-line) | |
1348 | ||
646bd331 | 1349 | ;; Move compilation-error-list to the elt of compilation-old-error-list |
643f763f | 1350 | ;; we want. |
646bd331 | 1351 | (setq compilation-error-list compilation-old-error-list) |
643f763f | 1352 | (while (and compilation-error-list |
41a3354e DL |
1353 | ;; The marker can point nowhere if we previously |
1354 | ;; failed to find the relevant file. See | |
1355 | ;; compilation-next-error-locus. | |
1356 | (or (null (marker-buffer (caar compilation-error-list))) | |
8f36a284 | 1357 | (and (> (point) (caar compilation-error-list)) |
2827a3c1 RS |
1358 | (>= (point) |
1359 | ;; Don't skip too far: the text between | |
1360 | ;; two errors belongs to the first. This | |
1361 | ;; in-between text might be other errors | |
1362 | ;; on the same line (see | |
1363 | ;; compilation-skip-to-next-location). | |
1364 | (if (null (cdr compilation-error-list)) | |
1365 | compilation-parsing-end | |
1366 | (caar (cdr compilation-error-list))))))) | |
646bd331 RM |
1367 | (setq compilation-error-list (cdr compilation-error-list))) |
1368 | ||
31efa7c9 | 1369 | (push-mark) |
643f763f | 1370 | (next-error 1)) |
55dfd2c4 | 1371 | |
d3cb357b RM |
1372 | ;; Return a compilation buffer. |
1373 | ;; If the current buffer is a compilation buffer, return it. | |
1374 | ;; If compilation-last-buffer is set to a live buffer, use that. | |
1375 | ;; Otherwise, look for a compilation buffer and signal an error | |
1376 | ;; if there are none. | |
4746118a JB |
1377 | (defun compilation-find-buffer (&optional other-buffer) |
1378 | (if (and (not other-buffer) | |
1379 | (compilation-buffer-p (current-buffer))) | |
d3cb357b RM |
1380 | ;; The current buffer is a compilation buffer. |
1381 | (current-buffer) | |
4746118a | 1382 | (if (and compilation-last-buffer (buffer-name compilation-last-buffer) |
95d219b5 | 1383 | (compilation-buffer-p compilation-last-buffer) |
4746118a JB |
1384 | (or (not other-buffer) (not (eq compilation-last-buffer |
1385 | (current-buffer))))) | |
d3cb357b RM |
1386 | compilation-last-buffer |
1387 | (let ((buffers (buffer-list))) | |
4746118a JB |
1388 | (while (and buffers (or (not (compilation-buffer-p (car buffers))) |
1389 | (and other-buffer | |
1390 | (eq (car buffers) (current-buffer))))) | |
d3cb357b RM |
1391 | (setq buffers (cdr buffers))) |
1392 | (if buffers | |
1393 | (car buffers) | |
4746118a JB |
1394 | (or (and other-buffer |
1395 | (compilation-buffer-p (current-buffer)) | |
1396 | ;; The current buffer is a compilation buffer. | |
1397 | (progn | |
1398 | (if other-buffer | |
1399 | (message "This is the only compilation buffer.")) | |
1400 | (current-buffer))) | |
1401 | (error "No compilation started!"))))))) | |
d3cb357b RM |
1402 | |
1403 | ;;;###autoload | |
55dfd2c4 RS |
1404 | (defun next-error (&optional argp) |
1405 | "Visit next compilation error message and corresponding source code. | |
966c0a72 RS |
1406 | |
1407 | If all the error messages parsed so far have been processed already, | |
1408 | the message buffer is checked for new ones. | |
55dfd2c4 | 1409 | |
ffb4b7a1 | 1410 | A prefix ARGP specifies how many error messages to move; |
55dfd2c4 | 1411 | negative means move back to previous error messages. |
ffb4b7a1 | 1412 | Just \\[universal-argument] as a prefix means reparse the error message buffer |
55dfd2c4 RS |
1413 | and start at the first error. |
1414 | ||
966c0a72 RS |
1415 | \\[next-error] normally uses the most recently started compilation or |
1416 | grep buffer. However, it can operate on any buffer with output from | |
1417 | the \\[compile] and \\[grep] commands, or, more generally, on any | |
1418 | buffer in Compilation mode or with Compilation Minor mode enabled. To | |
1419 | specify use of a particular buffer for error messages, type | |
1420 | \\[next-error] in that buffer. | |
55dfd2c4 | 1421 | |
966c0a72 RS |
1422 | Once \\[next-error] has chosen the buffer for error messages, |
1423 | it stays with that buffer until you use it in some other buffer which | |
1424 | uses Compilation mode or Compilation Minor mode. | |
55dfd2c4 | 1425 | |
d3cb357b RM |
1426 | See variables `compilation-parse-errors-function' and |
1427 | \`compilation-error-regexp-alist' for customization ideas." | |
55dfd2c4 | 1428 | (interactive "P") |
d3cb357b | 1429 | (setq compilation-last-buffer (compilation-find-buffer)) |
eaa3cac5 RM |
1430 | (compilation-goto-locus (compilation-next-error-locus |
1431 | ;; We want to pass a number here only if | |
1432 | ;; we got a numeric prefix arg, not just C-u. | |
1433 | (and (not (consp argp)) | |
1434 | (prefix-numeric-value argp)) | |
1435 | (consp argp)))) | |
1436 | ;;;###autoload (define-key ctl-x-map "`" 'next-error) | |
1437 | ||
00c8f418 | 1438 | (defun previous-error (argp) |
e60476ca | 1439 | "Visit previous compilation error message and corresponding source code. |
00c8f418 EZ |
1440 | |
1441 | A prefix ARGP specifies how many error messages to move; | |
1442 | negative means move forward to next error messages. | |
1443 | ||
1444 | This operates on the output from the \\[compile] and \\[grep] commands." | |
1445 | (interactive "P") | |
1446 | (next-error (- (prefix-numeric-value argp)))) | |
e60476ca RS |
1447 | |
1448 | (defun first-error () | |
d9b73ccc | 1449 | "Reparse the error message buffer and start at the first error. |
e60476ca RS |
1450 | Visit corresponding source code. |
1451 | This operates on the output from the \\[compile] command." | |
1452 | (interactive) | |
eae2c972 | 1453 | (next-error '(4))) |
e60476ca | 1454 | |
c41fe446 KH |
1455 | (defvar compilation-skip-to-next-location nil |
1456 | "*If non-nil, skip multiple error messages for the same source location.") | |
1457 | ||
b4300a1a | 1458 | (defun compilation-next-error-locus (&optional move reparse silent) |
eaa3cac5 RM |
1459 | "Visit next compilation error and return locus in corresponding source code. |
1460 | This operates on the output from the \\[compile] command. | |
1461 | If all preparsed error messages have been processed, | |
1462 | the error message buffer is checked for new ones. | |
1463 | ||
1464 | Returns a cons (ERROR . SOURCE) of two markers: ERROR is a marker at the | |
1465 | location of the error message in the compilation buffer, and SOURCE is a | |
1466 | marker at the location in the source code indicated by the error message. | |
1467 | ||
1468 | Optional first arg MOVE says how many error messages to move forwards (or | |
1469 | backwards, if negative); default is 1. Optional second arg REPARSE, if | |
1470 | non-nil, says to reparse the error message buffer and reset to the first | |
501cf428 | 1471 | error (plus MOVE - 1). If optional third argument SILENT is non-nil, return |
b4300a1a | 1472 | nil instead of raising an error if there are no more errors. |
eaa3cac5 RM |
1473 | |
1474 | The current buffer should be the desired compilation output buffer." | |
1475 | (or move (setq move 1)) | |
667aec94 | 1476 | (compile-reinitialize-errors reparse nil (and (not reparse) (max 0 move))) |
d3cb357b | 1477 | (let (next-errors next-error) |
7fb63acd RS |
1478 | (catch 'no-next-error |
1479 | (save-excursion | |
1480 | (set-buffer compilation-last-buffer) | |
1481 | ;; compilation-error-list points to the "current" error. | |
501cf428 | 1482 | (setq next-errors |
7fb63acd RS |
1483 | (if (> move 0) |
1484 | (nthcdr (1- move) | |
1485 | compilation-error-list) | |
1486 | ;; Zero or negative arg; we need to move back in the list. | |
1487 | (let ((n (1- move)) | |
1488 | (i 0) | |
1489 | (e compilation-old-error-list)) | |
1490 | ;; See how many cdrs away the current error is from the start. | |
1491 | (while (not (eq e compilation-error-list)) | |
1492 | (setq i (1+ i) | |
1493 | e (cdr e))) | |
1494 | (if (> (- n) i) | |
1495 | (error "Moved back past first error") | |
1496 | (nthcdr (+ i n) compilation-old-error-list)))) | |
1497 | next-error (car next-errors)) | |
1498 | (while | |
1499 | (if (null next-error) | |
1500 | (progn | |
1501 | (and move (/= move 1) | |
1502 | (error (if (> move 0) | |
1503 | "Moved past last error") | |
1504 | "Moved back past first error")) | |
1505 | ;; Forget existing error messages if compilation has finished. | |
1506 | (if (not (and (get-buffer-process (current-buffer)) | |
1507 | (eq (process-status | |
1508 | (get-buffer-process | |
1509 | (current-buffer))) | |
1510 | 'run))) | |
1511 | (compilation-forget-errors)) | |
1512 | (if silent | |
1513 | (throw 'no-next-error nil) | |
1514 | (error (concat compilation-error-message | |
1515 | (and (get-buffer-process (current-buffer)) | |
1516 | (eq (process-status | |
1517 | (get-buffer-process | |
1518 | (current-buffer))) | |
1519 | 'run) | |
b4300a1a | 1520 | " yet"))))) |
7fb63acd RS |
1521 | (setq compilation-error-list (cdr next-errors)) |
1522 | (if (null (cdr next-error)) | |
1523 | ;; This error is boring. Go to the next. | |
1524 | t | |
1525 | (or (markerp (cdr next-error)) | |
1526 | ;; This error has a filename/lineno pair. | |
1527 | ;; Find the file and turn it into a marker. | |
1528 | (let* ((fileinfo (car (cdr next-error))) | |
20c1daec RM |
1529 | (buffer (apply 'compilation-find-file |
1530 | (car next-error) fileinfo))) | |
7fb63acd RS |
1531 | (if (null buffer) |
1532 | ;; We can't find this error's file. | |
1533 | ;; Remove all errors in the same file. | |
1534 | (progn | |
1535 | (setq next-errors compilation-old-error-list) | |
1536 | (while next-errors | |
1537 | (and (consp (cdr (car next-errors))) | |
1538 | (equal (car (cdr (car next-errors))) | |
1539 | fileinfo) | |
1540 | (progn | |
1541 | (set-marker (car (car next-errors)) nil) | |
1542 | (setcdr (car next-errors) nil))) | |
1543 | (setq next-errors (cdr next-errors))) | |
1544 | ;; Look for the next error. | |
1545 | t) | |
1546 | ;; We found the file. Get a marker for this error. | |
47d1bc29 KH |
1547 | ;; compilation-old-error-list and |
1548 | ;; compilation-error-screen-columns are buffer-local | |
1549 | ;; so we must be careful to extract their value | |
7fb63acd RS |
1550 | ;; before switching to the source file buffer. |
1551 | (let ((errors compilation-old-error-list) | |
47d1bc29 | 1552 | (columns compilation-error-screen-columns) |
7fb63acd RS |
1553 | (last-line (nth 1 (cdr next-error))) |
1554 | (column (nth 2 (cdr next-error)))) | |
1555 | (set-buffer buffer) | |
1556 | (save-excursion | |
1557 | (save-restriction | |
1558 | (widen) | |
1559 | (goto-line last-line) | |
4dbf8a2c | 1560 | (if (and column (> column 0)) |
4ad26d84 | 1561 | ;; Columns in error msgs are 1-origin. |
47d1bc29 | 1562 | (if columns |
f8e03ecb AS |
1563 | (move-to-column (1- column)) |
1564 | (forward-char (1- column))) | |
7fb63acd RS |
1565 | (beginning-of-line)) |
1566 | (setcdr next-error (point-marker)) | |
1567 | ;; Make all the other error messages referring | |
1568 | ;; to the same file have markers into the buffer. | |
1569 | (while errors | |
1570 | (and (consp (cdr (car errors))) | |
1571 | (equal (car (cdr (car errors))) fileinfo) | |
1572 | (let* ((this (nth 1 (cdr (car errors)))) | |
1573 | (column (nth 2 (cdr (car errors)))) | |
1574 | (lines (- this last-line))) | |
1575 | (if (eq selective-display t) | |
1576 | ;; When selective-display is t, | |
1577 | ;; each C-m is a line boundary, | |
1578 | ;; as well as each newline. | |
1579 | (if (< lines 0) | |
1580 | (re-search-backward "[\n\C-m]" | |
1581 | nil 'end | |
1582 | (- lines)) | |
1583 | (re-search-forward "[\n\C-m]" | |
1584 | nil 'end | |
1585 | lines)) | |
1586 | (forward-line lines)) | |
eae2c972 | 1587 | (if (and column (> column 1)) |
47d1bc29 | 1588 | (if columns |
f8e03ecb AS |
1589 | (move-to-column (1- column)) |
1590 | (forward-char (1- column))) | |
eae2c972 | 1591 | (beginning-of-line)) |
7fb63acd RS |
1592 | (setq last-line this) |
1593 | (setcdr (car errors) (point-marker)))) | |
1594 | (setq errors (cdr errors))))))))) | |
1595 | ;; If we didn't get a marker for this error, or this | |
1596 | ;; marker's buffer was killed, go on to the next one. | |
1597 | (or (not (markerp (cdr next-error))) | |
1598 | (not (marker-buffer (cdr next-error)))))) | |
1599 | (setq next-errors compilation-error-list | |
b4300a1a | 1600 | next-error (car next-errors))))) |
d3cb357b | 1601 | |
c41fe446 KH |
1602 | (if compilation-skip-to-next-location |
1603 | ;; Skip over multiple error messages for the same source location, | |
1604 | ;; so the next C-x ` won't go to an error in the same place. | |
1605 | (while (and compilation-error-list | |
a24770bc RS |
1606 | (equal (cdr (car compilation-error-list)) |
1607 | (cdr next-error))) | |
c41fe446 | 1608 | (setq compilation-error-list (cdr compilation-error-list)))) |
d3cb357b | 1609 | |
eaa3cac5 RM |
1610 | ;; We now have a marker for the position of the error source code. |
1611 | ;; NEXT-ERROR is a cons (ERROR . SOURCE) of two markers. | |
1612 | next-error)) | |
1613 | ||
1614 | (defun compilation-goto-locus (next-error) | |
1615 | "Jump to an error locus returned by `compilation-next-error-locus'. | |
1616 | Takes one argument, a cons (ERROR . SOURCE) of two markers. | |
1617 | Selects a window with point at SOURCE, with another window displaying ERROR." | |
d28701c7 RS |
1618 | (if (eq (window-buffer (selected-window)) |
1619 | (marker-buffer (car next-error))) | |
1620 | ;; If the compilation buffer window is selected, | |
1621 | ;; keep the compilation buffer in this window; | |
1622 | ;; display the source in another window. | |
1623 | (let ((pop-up-windows t)) | |
1624 | (pop-to-buffer (marker-buffer (cdr next-error)))) | |
8f36a284 SM |
1625 | (if (window-dedicated-p (selected-window)) |
1626 | (pop-to-buffer (marker-buffer (cdr next-error))) | |
d28701c7 | 1627 | (switch-to-buffer (marker-buffer (cdr next-error))))) |
eaa3cac5 RM |
1628 | (goto-char (cdr next-error)) |
1629 | ;; If narrowing got in the way of | |
1630 | ;; going to the right place, widen. | |
1631 | (or (= (point) (marker-position (cdr next-error))) | |
1632 | (progn | |
1633 | (widen) | |
1634 | (goto-char (cdr next-error)))) | |
721cfafe TTN |
1635 | ;; If hideshow got in the way of |
1636 | ;; seeing the right place, open permanently. | |
1637 | (mapcar (function (lambda (ov) | |
1638 | (when (eq 'hs (overlay-get ov 'invisible)) | |
1639 | (delete-overlay ov) | |
1640 | (goto-char (cdr next-error))))) | |
1641 | (overlays-at (point))) | |
eaa3cac5 RM |
1642 | |
1643 | ;; Show compilation buffer in other window, scrolled to this error. | |
1644 | (let* ((pop-up-windows t) | |
eae2c972 | 1645 | ;; Use an existing window if it is in a visible frame. |
c94b02d6 | 1646 | (w (or (get-buffer-window (marker-buffer (car next-error)) 'visible) |
eae2c972 | 1647 | ;; Pop up a window. |
9ac57479 KS |
1648 | (display-buffer (marker-buffer (car next-error))))) |
1649 | (highlight-regexp (with-current-buffer (marker-buffer (car next-error)) | |
1650 | compilation-highlight-regexp))) | |
eaa3cac5 | 1651 | (set-window-point w (car next-error)) |
c94b02d6 | 1652 | (set-window-start w (car next-error)) |
9ac57479 KS |
1653 | (compilation-set-window-height w) |
1654 | ||
1655 | (when highlight-regexp | |
1656 | (unless compilation-highlight-overlay | |
1657 | (setq compilation-highlight-overlay (make-overlay 1 1)) | |
1658 | (overlay-put compilation-highlight-overlay 'face 'region)) | |
1659 | (with-current-buffer (marker-buffer (cdr next-error)) | |
1660 | (save-excursion | |
1661 | (end-of-line) | |
1662 | (let ((end (point)) olay) | |
1663 | (beginning-of-line) | |
1664 | (if (and (stringp highlight-regexp) | |
1665 | (re-search-forward highlight-regexp end t)) | |
1666 | (progn | |
1667 | (goto-char (match-beginning 0)) | |
1668 | (move-overlay compilation-highlight-overlay (match-beginning 0) (match-end 0))) | |
1669 | (move-overlay compilation-highlight-overlay (point) end)) | |
1670 | (sit-for 0 500) | |
1671 | (delete-overlay compilation-highlight-overlay))))))) | |
1672 | ||
eaa3cac5 | 1673 | \f |
20c1daec | 1674 | (defun compilation-find-file (marker filename dir &rest formats) |
851231e9 | 1675 | "Find a buffer for file FILENAME. |
ffb4b7a1 SM |
1676 | Search the directories in `compilation-search-path'. |
1677 | A nil in `compilation-search-path' means to try the | |
851231e9 DL |
1678 | current directory, which is passed in DIR. |
1679 | If FILENAME is not found at all, ask the user where to find it. | |
1680 | Pop up the buffer containing MARKER and scroll to MARKER if we ask the user." | |
20c1daec | 1681 | (or formats (setq formats '("%s"))) |
721cfafe TTN |
1682 | (save-excursion |
1683 | (let ((dirs compilation-search-path) | |
1684 | buffer thisdir fmts name) | |
1685 | (if (file-name-absolute-p filename) | |
5b6858da SM |
1686 | ;; The file name is absolute. Use its explicit directory as |
1687 | ;; the first in the search path, and strip it from FILENAME. | |
1688 | (setq filename (abbreviate-file-name (expand-file-name filename)) | |
1689 | dirs (cons (file-name-directory filename) dirs) | |
1690 | filename (file-name-nondirectory filename))) | |
721cfafe TTN |
1691 | ;; Now search the path. |
1692 | (while (and dirs (null buffer)) | |
1693 | (setq thisdir (or (car dirs) dir) | |
1694 | fmts formats) | |
1695 | ;; For each directory, try each format string. | |
1696 | (while (and fmts (null buffer)) | |
1697 | (setq name (expand-file-name (format (car fmts) filename) thisdir) | |
1698 | buffer (and (file-exists-p name) | |
ffb4b7a1 | 1699 | (find-file-noselect name)) |
721cfafe TTN |
1700 | fmts (cdr fmts))) |
1701 | (setq dirs (cdr dirs))) | |
1702 | (or buffer | |
1703 | ;; The file doesn't exist. | |
1704 | ;; Ask the user where to find it. | |
1705 | ;; If he hits C-g, then the next time he does | |
1706 | ;; next-error, he'll skip past it. | |
1707 | (let* ((pop-up-windows t) | |
1708 | (w (display-buffer (marker-buffer marker)))) | |
1709 | (set-window-point w marker) | |
1710 | (set-window-start w marker) | |
1711 | (let ((name (expand-file-name | |
1712 | (read-file-name | |
1713 | (format "Find this error in: (default %s) " | |
1714 | filename) | |
1715 | dir filename t)))) | |
1716 | (if (file-directory-p name) | |
1717 | (setq name (expand-file-name filename name))) | |
1718 | (setq buffer (and (file-exists-p name) | |
1719 | (find-file name)))))) | |
1720 | ;; Make intangible overlays tangible. | |
1721 | (mapcar (function (lambda (ov) | |
1722 | (when (overlay-get ov 'intangible) | |
1723 | (overlay-put ov 'intangible nil)))) | |
1724 | (overlays-in (point-min) (point-max))) | |
1725 | buffer))) | |
1726 | ||
56ce04a3 RS |
1727 | (defun compilation-normalize-filename (filename) |
1728 | "Convert a filename string found in an error message to make it usable." | |
1729 | ||
1730 | ;; Check for a comint-file-name-prefix and prepend it if | |
1731 | ;; appropriate. (This is very useful for | |
1732 | ;; compilation-minor-mode in an rlogin-mode buffer.) | |
1733 | (and (boundp 'comint-file-name-prefix) | |
1734 | ;; If file name is relative, default-directory will | |
1735 | ;; already contain the comint-file-name-prefix (done | |
1736 | ;; by compile-abbreviate-directory). | |
1737 | (file-name-absolute-p filename) | |
1738 | (setq filename | |
1739 | (concat comint-file-name-prefix filename))) | |
1740 | ||
1741 | ;; If compilation-parse-errors-filename-function is | |
1742 | ;; defined, use it to process the filename. | |
1743 | (when compilation-parse-errors-filename-function | |
1744 | (setq filename | |
1745 | (funcall compilation-parse-errors-filename-function | |
1746 | filename))) | |
1747 | ||
1748 | ;; Some compilers (e.g. Sun's java compiler, reportedly) | |
1749 | ;; produce bogus file names like "./bar//foo.c" for file | |
1750 | ;; "bar/foo.c"; expand-file-name will collapse these into | |
1751 | ;; "/foo.c" and fail to find the appropriate file. So we | |
1752 | ;; look for doubled slashes in the file name and fix them | |
1753 | ;; up in the buffer. | |
1754 | (setq filename (command-line-normalize-file-name filename))) | |
d3cb357b RM |
1755 | |
1756 | ;; Set compilation-error-list to nil, and unchain the markers that point to the | |
1757 | ;; error messages and their text, so that they no longer slow down gap motion. | |
1758 | ;; This would happen anyway at the next garbage collection, but it is better to | |
646bd331 | 1759 | ;; do it right away. |
e7512168 | 1760 | (defun compilation-forget-errors () |
55dfd2c4 RS |
1761 | (while compilation-old-error-list |
1762 | (let ((next-error (car compilation-old-error-list))) | |
1763 | (set-marker (car next-error) nil) | |
d3cb357b RM |
1764 | (if (markerp (cdr next-error)) |
1765 | (set-marker (cdr next-error) nil))) | |
55dfd2c4 | 1766 | (setq compilation-old-error-list (cdr compilation-old-error-list))) |
bd3910fe | 1767 | (setq compilation-error-list nil |
c4d7c00a | 1768 | compilation-directory-stack (list default-directory)) |
347c9140 RS |
1769 | (if compilation-parsing-end |
1770 | (set-marker compilation-parsing-end 1)) | |
37f5f978 | 1771 | ;; Remove the highlighting added by compile-reinitialize-errors: |
474d71ae RS |
1772 | (let ((inhibit-read-only t) |
1773 | (buffer-undo-list t) | |
1774 | deactivate-mark) | |
08de70d7 EZ |
1775 | (remove-text-properties (point-min) (point-max) |
1776 | '(mouse-face highlight help-echo nil)))) | |
d3cb357b RM |
1777 | |
1778 | ||
a24770bc RS |
1779 | ;; This function is not needed any more by compilation mode. |
1780 | ;; Does anyone else need it or can it be deleted? | |
d3cb357b RM |
1781 | (defun count-regexp-groupings (regexp) |
1782 | "Return the number of \\( ... \\) groupings in REGEXP (a string)." | |
1783 | (let ((groupings 0) | |
1784 | (len (length regexp)) | |
1785 | (i 0) | |
1786 | c) | |
1787 | (while (< i len) | |
1788 | (setq c (aref regexp i) | |
1789 | i (1+ i)) | |
1790 | (cond ((= c ?\[) | |
1791 | ;; Find the end of this [...]. | |
1792 | (while (and (< i len) | |
1793 | (not (= (aref regexp i) ?\]))) | |
1794 | (setq i (1+ i)))) | |
1795 | ((= c ?\\) | |
1796 | (if (< i len) | |
1797 | (progn | |
1798 | (setq c (aref regexp i) | |
1799 | i (1+ i)) | |
1800 | (if (= c ?\)) | |
1801 | ;; We found the end of a grouping, | |
1802 | ;; so bump our counter. | |
1803 | (setq groupings (1+ groupings)))))))) | |
1804 | groupings)) | |
55dfd2c4 | 1805 | |
a24770bc | 1806 | (defvar compilation-current-file nil |
851231e9 | 1807 | "Used by `compilation-parse-errors' to store filename for file being compiled.") |
a24770bc RS |
1808 | |
1809 | ;; This variable is not used as a global variable. It's defined here just to | |
1810 | ;; shut up the byte compiler. It's bound and used by compilation-parse-errors | |
1811 | ;; and set by compile-collect-regexps. | |
1812 | (defvar compilation-regexps nil) | |
1813 | ||
c540863c | 1814 | (defun compilation-parse-errors (limit-search find-at-least) |
a24770bc | 1815 | "Parse the current buffer as grep, cc, lint or other error messages. |
d3cb357b | 1816 | See variable `compilation-parse-errors-function' for the interface it uses." |
55dfd2c4 RS |
1817 | (setq compilation-error-list nil) |
1818 | (message "Parsing error messages...") | |
a24770bc RS |
1819 | (if (null compilation-error-regexp-alist) |
1820 | (error "compilation-error-regexp-alist is empty!")) | |
1821 | (let* ((compilation-regexps nil) ; Variable set by compile-collect-regexps. | |
aa53db6a | 1822 | (default-directory (car compilation-directory-stack)) |
a24770bc RS |
1823 | (found-desired nil) |
1824 | (compilation-num-errors-found 0) | |
1825 | ;; Set up now the expanded, abbreviated directory variables | |
1826 | ;; that compile-abbreviate-directory will need, so we can | |
1827 | ;; compute them just once here. | |
1828 | (orig (abbreviate-file-name default-directory)) | |
1829 | (orig-expanded (abbreviate-file-name | |
1830 | (file-truename default-directory))) | |
1831 | (parent-expanded (abbreviate-file-name | |
1832 | (expand-file-name "../" orig-expanded)))) | |
1833 | ||
1834 | ;; Make a list of all the regexps. Each element has the form | |
1835 | ;; (REGEXP TYPE IDX1 IDX2 ...) | |
1836 | ;; where TYPE is one of leave, enter, file, error or nomessage. | |
1837 | (compile-collect-regexps 'leave compilation-leave-directory-regexp-alist) | |
1838 | (compile-collect-regexps 'enter compilation-enter-directory-regexp-alist) | |
1839 | (compile-collect-regexps 'file compilation-file-regexp-alist) | |
a24770bc | 1840 | (compile-collect-regexps 'error compilation-error-regexp-alist) |
2497076e | 1841 | (compile-collect-regexps 'nomessage compilation-nomessage-regexp-alist) |
d3cb357b | 1842 | |
55dfd2c4 RS |
1843 | ;; Don't reparse messages already seen at last parse. |
1844 | (goto-char compilation-parsing-end) | |
9cab952d | 1845 | (when (and (bobp) |
9dd1cf67 | 1846 | (compilation-buffer-p (current-buffer))) |
9cab952d RS |
1847 | (setq compilation-current-file nil) ; No current file at start. |
1848 | ;; Don't parse the first two lines as error messages. | |
1849 | ;; This matters for grep. | |
1850 | (forward-line 2)) | |
a24770bc RS |
1851 | |
1852 | ;; Parse messages. | |
47092737 RS |
1853 | (while (not (or found-desired (eobp) |
1854 | ;; Don't parse the "compilation finished" message | |
1855 | ;; as a compilation error. | |
1856 | (get-text-property (point) 'compilation-handle-exit))) | |
a24770bc RS |
1857 | (let ((this compilation-regexps) (prev nil) (alist nil) type) |
1858 | ;; Go through the regular expressions. If a match is found, | |
1859 | ;; variable alist is set to the corresponding alist and the | |
1860 | ;; matching regexp is moved to the front of compilation-regexps | |
1861 | ;; to make it match faster next time. | |
1862 | (while (and this (null alist)) | |
1863 | (if (not (looking-at (car (car this)))) | |
1864 | (progn (setq prev this) ; No match, go to next. | |
1865 | (setq this (cdr this))) | |
1866 | (setq alist (cdr (car this))) ; Got a match. | |
1867 | ;;; (if prev ; If not the first regexp, | |
1868 | ;;; (progn ; move it to the front. | |
1869 | ;;; (setcdr prev (cdr this)) | |
1870 | ;;; (setcdr this compilation-regexps) | |
1871 | ;;; (setq compilation-regexps this))) | |
1872 | )) | |
1873 | (if (and alist ; Seen a match and not to | |
1874 | (not (eq (setq type (car alist)) 'nomessage))) ; be ignored. | |
1875 | (let* ((end-of-match (match-end 0)) | |
1876 | (filename | |
1877 | (compile-buffer-substring (car (setq alist (cdr alist))))) | |
1878 | stack) | |
1879 | (if (eq type 'error) ; error message | |
1880 | (let* ((linenum (if (numberp (car (setq alist (cdr alist)))) | |
1881 | (string-to-int | |
1882 | (compile-buffer-substring (car alist))) | |
1883 | ;; (car alist) is not a number, must be a | |
1884 | ;; function that is called below to return | |
1885 | ;; an error position descriptor. | |
1886 | (car alist))) | |
1887 | ;; Convert to integer later if linenum not a function. | |
1888 | (column (compile-buffer-substring | |
1889 | (car (setq alist (cdr alist))))) | |
1890 | this-error) | |
1891 | ||
1892 | ;; Check that we have a file name. | |
1893 | (or filename | |
1894 | ;; No file name in message, we must have seen it before | |
1895 | (setq filename compilation-current-file) | |
1896 | (error "\ | |
851231e9 | 1897 | An error message with no file name and no file name has been seen earlier")) |
a24770bc | 1898 | |
56ce04a3 RS |
1899 | ;; Clean up the file name string in several ways. |
1900 | (setq filename (compilation-normalize-filename filename)) | |
a24770bc RS |
1901 | |
1902 | (setq filename | |
1903 | (cons filename (cons default-directory (cdr alist)))) | |
1904 | ||
1905 | ;; Locate the erring file and line. | |
1906 | ;; Make this-error a new elt for compilation-error-list, | |
1907 | ;; giving a marker for the current compilation buffer | |
1908 | ;; location, and the file and line number of the error. | |
1909 | ;; Save, as the start of the error, the beginning of the | |
1910 | ;; line containing the match. | |
bb40e751 RS |
1911 | (setq this-error |
1912 | (if (numberp linenum) | |
1913 | (list (point-marker) filename linenum | |
1914 | (and column (string-to-int column))) | |
1915 | ;; If linenum is not a number then it must be | |
1916 | ;; a function returning an error position | |
1917 | ;; descriptor or nil (meaning no position). | |
1918 | (save-excursion | |
1919 | (funcall linenum filename column)))) | |
721cfafe | 1920 | |
bb40e751 RS |
1921 | ;; We have an error position descriptor. |
1922 | ;; If we have found as many new errors as the user | |
1923 | ;; wants, or if we are past the buffer position he | |
1924 | ;; indicated, then we continue to parse until we have | |
1925 | ;; seen all consecutive errors in the same file. This | |
1926 | ;; means that all the errors of a source file will be | |
1927 | ;; seen in one parsing run, so that the error positions | |
1928 | ;; will be recorded as markers in the source file | |
1929 | ;; buffer that will move when the buffer is changed. | |
1930 | (if (and this-error | |
1931 | compilation-error-list ; At least one previous. | |
1932 | (or (and find-at-least | |
1933 | (>= compilation-num-errors-found | |
1934 | find-at-least)) | |
1935 | (and limit-search | |
1936 | (>= end-of-match limit-search))) | |
5b6858da SM |
1937 | ;; `this-error' could contain a pair of |
1938 | ;; markers already. | |
1939 | (let ((thispos (cdr this-error)) | |
1940 | (lastpos (cdar compilation-error-list))) | |
1941 | (not (equal | |
1942 | (if (markerp thispos) | |
1943 | (marker-buffer thispos) | |
1944 | (car thispos)) | |
1945 | (if (markerp lastpos) | |
1946 | (marker-buffer lastpos) | |
1947 | (car lastpos)))))) | |
bb40e751 RS |
1948 | ;; We are past the limits and the last error |
1949 | ;; parsed, didn't belong to the same source file | |
1950 | ;; as the earlier ones i.e. we have seen all the | |
1951 | ;; errors belonging to the earlier file. We don't | |
1952 | ;; add the error just parsed so that the next | |
1953 | ;; parsing run can get it and the following errors | |
1954 | ;; in the same file all at once. | |
1955 | (setq found-desired t) | |
1956 | ||
1957 | (goto-char end-of-match) ; Prepare for next message. | |
1958 | ;; Don't add the same source line more than once. | |
1959 | (and this-error | |
1960 | (not (and | |
1961 | compilation-error-list | |
1962 | (equal (cdr (car compilation-error-list)) | |
1963 | (cdr this-error)))) | |
1964 | (setq compilation-error-list | |
1965 | (cons this-error compilation-error-list) | |
1966 | compilation-num-errors-found | |
1967 | (1+ compilation-num-errors-found))))) | |
a24770bc RS |
1968 | |
1969 | ;; Not an error message. | |
1970 | (if (eq type `file) ; Change current file. | |
56ce04a3 RS |
1971 | (when filename |
1972 | (setq compilation-current-file | |
1973 | ;; Clean up the file name string in several ways. | |
1974 | (compilation-normalize-filename filename))) | |
a24770bc RS |
1975 | ;; Enter or leave directory. |
1976 | (setq stack compilation-directory-stack) | |
56ce04a3 RS |
1977 | ;; Don't check if it is really a directory. |
1978 | ;; Let the code to search and clean up file names | |
1979 | ;; try to use it in any case. | |
1980 | (when filename | |
1981 | ;; Clean up the directory name string in several ways. | |
1982 | (setq filename (compilation-normalize-filename filename)) | |
1983 | (setq filename | |
1984 | ;; The directory name in the message | |
1985 | ;; is a truename. Try to convert it to a form | |
1986 | ;; like what the user typed in. | |
1987 | (compile-abbreviate-directory | |
1988 | (file-name-as-directory | |
1989 | (expand-file-name filename)) | |
1990 | orig orig-expanded parent-expanded)) | |
1991 | (if (eq type 'leave) | |
1992 | ;; If we are leaving a specific directory, | |
1993 | ;; as preparation, pop out of all other directories | |
1994 | ;; that we entered nested within it. | |
1995 | (while (and stack | |
1996 | (not (string-equal (car stack) | |
1997 | filename))) | |
1998 | (setq stack (cdr stack))) | |
1999 | (setq compilation-directory-stack | |
2000 | (cons filename compilation-directory-stack) | |
2001 | default-directory filename))) | |
58856335 RS |
2002 | (and (eq type 'leave) |
2003 | stack | |
2004 | (setq compilation-directory-stack (cdr stack)) | |
2005 | (setq stack (car compilation-directory-stack)) | |
bb40e751 RS |
2006 | (setq default-directory stack))) |
2007 | (goto-char end-of-match) ; Prepare to look at next message. | |
2008 | (and limit-search (>= end-of-match limit-search) | |
2009 | ;; The user wanted a specific error, and we're past it. | |
2010 | ;; We do this check here rather than at the end of the | |
2011 | ;; loop because if the last thing seen is an error | |
2012 | ;; message, we must carefully discard the last error | |
2013 | ;; when it is the first in a new file (see above in | |
2014 | ;; the error-message case) | |
2015 | (setq found-desired t))) | |
a24770bc RS |
2016 | |
2017 | ;; Go to before the last character in the message so that we will | |
2018 | ;; see the next line also when the message ended at end of line. | |
2019 | ;; When we ignore the last error message above, this will | |
2020 | ;; cancel the effect of forward-line below so that point | |
2021 | ;; doesn't move. | |
2022 | (forward-char -1) | |
2023 | ||
2024 | ;; Is this message necessary any more? Parsing is now so fast | |
2025 | ;; that you might not need to know how it proceeds. | |
2026 | (message | |
2027 | "Parsing error messages...%d found. %.0f%% of buffer seen." | |
6c43f2f9 | 2028 | compilation-num-errors-found |
51ba27e7 RM |
2029 | ;; Use floating-point because (* 100 (point)) frequently |
2030 | ;; exceeds the range of Emacs Lisp integers. | |
2031 | (/ (* 100.0 (point)) (point-max))) | |
47092737 | 2032 | ))) |
a24770bc | 2033 | |
47092737 | 2034 | (forward-line 1)) ; End of while loop. Look at next line. |
a24770bc | 2035 | |
c4d7c00a | 2036 | (set-marker compilation-parsing-end (point)) |
a24770bc | 2037 | (setq compilation-error-list (nreverse compilation-error-list)) |
5b6858da SM |
2038 | ;; (message "Parsing error messages...done. %d found. %.0f%% of buffer seen." |
2039 | ;; compilation-num-errors-found | |
2040 | ;; (/ (* 100.0 (point)) (point-max))) | |
a24770bc RS |
2041 | (message "Parsing error messages...done."))) |
2042 | ||
2043 | (defun compile-collect-regexps (type this) | |
2044 | ;; Add elements to variable compilation-regexps that is bound in | |
2045 | ;; compilation-parse-errors. | |
2046 | (and (not (eq this t)) | |
02c1bd08 SM |
2047 | (dolist (el this) |
2048 | (push (cons (car el) (cons type (cdr el))) compilation-regexps)))) | |
a24770bc RS |
2049 | |
2050 | (defun compile-buffer-substring (index) | |
851231e9 | 2051 | "Get substring matched by INDEXth subexpression." |
a24770bc RS |
2052 | (if index |
2053 | (let ((beg (match-beginning index))) | |
2054 | (if beg (buffer-substring beg (match-end index)))))) | |
55dfd2c4 | 2055 | |
51501e54 RS |
2056 | ;; If directory DIR is a subdir of ORIG or of ORIG's parent, |
2057 | ;; return a relative name for it starting from ORIG or its parent. | |
2058 | ;; ORIG-EXPANDED is an expanded version of ORIG. | |
2059 | ;; PARENT-EXPANDED is an expanded version of ORIG's parent. | |
2060 | ;; Those two args could be computed here, but we run faster by | |
2061 | ;; having the caller compute them just once. | |
2062 | (defun compile-abbreviate-directory (dir orig orig-expanded parent-expanded) | |
cd494de4 RM |
2063 | ;; Apply canonical abbreviations to DIR first thing. |
2064 | ;; Those abbreviations are already done in the other arguments passed. | |
2065 | (setq dir (abbreviate-file-name dir)) | |
2066 | ||
1e0e614d RM |
2067 | ;; Check for a comint-file-name-prefix and prepend it if appropriate. |
2068 | ;; (This is very useful for compilation-minor-mode in an rlogin-mode | |
2069 | ;; buffer.) | |
2070 | (if (boundp 'comint-file-name-prefix) | |
2071 | (setq dir (concat comint-file-name-prefix dir))) | |
2072 | ||
51501e54 RS |
2073 | (if (and (> (length dir) (length orig-expanded)) |
2074 | (string= orig-expanded | |
2075 | (substring dir 0 (length orig-expanded)))) | |
2076 | (setq dir | |
2077 | (concat orig | |
2078 | (substring dir (length orig-expanded))))) | |
2079 | (if (and (> (length dir) (length parent-expanded)) | |
2080 | (string= parent-expanded | |
2081 | (substring dir 0 (length parent-expanded)))) | |
2082 | (setq dir | |
2083 | (concat (file-name-directory | |
2084 | (directory-file-name orig)) | |
2085 | (substring dir (length parent-expanded))))) | |
2086 | dir) | |
2087 | ||
f1ed9461 DL |
2088 | (add-to-list 'debug-ignored-errors "^No more errors\\( yet\\|\\)$") |
2089 | ||
4746118a | 2090 | (provide 'compile) |
fad160d5 | 2091 | |
ab5796a9 | 2092 | ;;; arch-tag: 12465727-7382-4f72-b234-79855a00dd8c |
fad160d5 | 2093 | ;;; compile.el ends here |