annotate lisp/packages/compile.el @ 216:43306a74e31c

Added tag r20-4b6 for changeset 1f0dabaa0855
author cvs
date Mon, 13 Aug 2007 10:07:42 +0200
parents 78f53ef88e17
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; compile.el --- run compiler as inferior of Emacs, parse error messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
3 ;; Copyright (C) 1985, 86, 87, 93, 94, 1995, 1996 Free Software Foundation, Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; Author: Roland McGrath <roland@prep.ai.mit.edu>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; Maintainer: FSF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; Keywords: tools, processes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;; along with XEmacs; see the file COPYING. If not, write to the Free
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
24 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
25 ;; 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
27 ;;; Synched up with: FSF 19.34, with a lot of divergence.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;; This package provides the compile and grep facilities documented in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;; the Emacs user's manual.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
36 (defgroup compilation nil
189
489f57a838ef Import from CVS: tag r20-3b21
cvs
parents: 120
diff changeset
37 "Run compiler as inferior of Emacs, parse error messages."
489f57a838ef Import from CVS: tag r20-3b21
cvs
parents: 120
diff changeset
38 :group 'programming
489f57a838ef Import from CVS: tag r20-3b21
cvs
parents: 120
diff changeset
39 :group 'tools
489f57a838ef Import from CVS: tag r20-3b21
cvs
parents: 120
diff changeset
40 :group 'processes)
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
41
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;;;###autoload
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
44 (defcustom compilation-mode-hook nil
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
45 "*List of hook functions run by `compilation-mode' (see `run-hooks')."
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
46 :type 'hook
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
47 :group 'compilation)
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
48
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
49 ;;;###autoload
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
50 (defcustom compilation-window-height nil
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
51 "*Number of lines in a compilation window. If nil, use Emacs default."
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
52 :type '(choice (const nil)
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
53 integer)
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
54 :group 'compilation)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
56 ;; XEmacs change
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (defvar compilation-error-list 'invalid ; only valid buffer-local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 "List of error message descriptors for visiting erring functions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 Each error descriptor is a cons (or nil). Its car is a marker pointing to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 an error message. If its cdr is a marker, it points to the text of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 line the message is about. If its cdr is a cons, it is a list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 \(\(DIRECTORY . FILE\) LINE [COLUMN]\). Or its cdr may be nil if that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 error is not interesting.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 The value may be t instead of a list; this means that the buffer of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 error messages should be reparsed the next time the list of errors is wanted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 Some other commands (like `diff') use this list to control the error
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
69 message tracking facilities; if you change its structure, you should make
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 sure you also change those packages. Perhaps it is better not to change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 it at all.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (defvar compilation-old-error-list nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 "Value of `compilation-error-list' after errors were parsed.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (defvar compilation-parse-errors-function 'compilation-parse-errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 "Function to call to parse error messages from a compilation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 It takes args LIMIT-SEARCH and FIND-AT-LEAST.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 If LIMIT-SEARCH is non-nil, don't bother parsing past that location.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 If FIND-AT-LEAST is non-nil, don't bother parsing after finding that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 many new errors.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 It should read in the source files which have errors and set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 `compilation-error-list' to a list with an element for each error message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 found. See that variable for more info.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 ;;;###autoload
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
87 (defcustom compilation-buffer-name-function nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 "Function to compute the name of a compilation buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 The function receives one argument, the name of the major mode of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 compilation buffer. It should return a string.
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
91 nil means compute the name with `(concat \"*\" (downcase major-mode) \"*\")'."
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
92 :type 'function
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
93 :group 'compilation)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 ;;;###autoload
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
96 (defcustom compilation-finish-function nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 "*Function to call when a compilation process finishes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 It is called with two arguments: the compilation buffer, and a string
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
99 describing how the process finished."
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
100 :type 'function
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
101 :group 'compilation)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (defvar compilation-last-buffer nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 "The most recent compilation buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 A buffer becomes most recent when its compilation is started
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 or when it is used with \\[next-error] or \\[compile-goto-error].")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (defvar compilation-in-progress nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 "List of compilation processes now running.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (or (assq 'compilation-in-progress minor-mode-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (setq minor-mode-alist (cons '(compilation-in-progress " Compiling")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 minor-mode-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
114 ;; XEmacs change
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
115 (defcustom compilation-always-signal-completion nil
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
116 "*Always give an audible signal upon compilation completion.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 By default that signal is only given if the bottom of the compilation
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
118 buffer is not visible in its window."
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
119 :type 'boolean
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
120 :group 'compilation)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (defvar compilation-parsing-end nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 "Position of end of buffer when last error messages were parsed.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (defvar compilation-error-message "No more errors"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 "Message to print when no more matches are found.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (defvar compilation-num-errors-found)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
130 (defun compilation-build-compilation-error-regexp-alist ()
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
131 "Set the regular expressions used for parsing compiler
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
132 errors based on the compilers listed in the variable
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
133 `compilation-error-regexp-systems-list'. Updates the
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
134 variable `compilation-error-regexp-alist'."
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
135 (interactive)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
136 (setq compilation-error-regexp-alist
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
137 (apply 'append
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
138 (mapcar
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
139 '(lambda (elt)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
140 (if (or (not (consp compilation-error-regexp-systems-list))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
141 (and (consp (car elt))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
142 (intersection (car elt)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
143 compilation-error-regexp-systems-list))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
144 (memq (car elt) compilation-error-regexp-systems-list))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
145 (cdr elt)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
146 nil))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
147 compilation-error-regexp-alist-alist))))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
148
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
149 (defvar compilation-error-regexp-alist-alist
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 '(
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 ;; NOTE! See also grep-regexp-alist, below.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 ;; 4.3BSD grep, cc, lint pass 1:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 ;; /usr/src/foo/foo.c(8): warning: w may be used before set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 ;; or GNU utilities:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 ;; foo.c:8: error message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 ;; or HP-UX 7.0 fc:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 ;; foo.f :16 some horrible error message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 ;; or GNU utilities with column (GNAT 1.82):
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 ;; foo.adb:2:1: Unit name does not match file name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 ;; We'll insist that the number be followed by a colon or closing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 ;; paren, because otherwise this matches just about anything
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 ;; containing a number with spaces around it.
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
165 ((4bsd gnu)
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
166 ("\
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
167 \\([a-zA-Z]?:?[^:( \t\n]+\\)[:(][ \t]*\\([0-9]+\\)\\([) \t]\\|\
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 :\\([^0-9\n]\\|\\([0-9]+:\\)\\)\\)" 1 2 5)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
169 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
171 ;; Microsoft C/C++:
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
172 ;; keyboard.c(537) : warning C4005: 'min' : macro redefinition
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
173 ;; d:\tmp\test.c(23) : error C2143: syntax error : missing ';' before 'if'
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
174 (msft
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
175 ("\\(\\([a-zA-Z]:\\)?[^:( \t\n-]+\\)[:(][ \t]*\\([0-9]+\\)[:) \t]" 1 3)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
176 )
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
177
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 ;; Borland C++:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 ;; Error ping.c 15: Unable to open include file 'sys/types.h'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 ;; Warning ping.c 68: Call to function 'func' with no prototype
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
181 (borland
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
182 ("\\(Error\\|Warning\\) \\([a-zA-Z]?:?[^:( \t\n]+\\)\
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 \\([0-9]+\\)\\([) \t]\\|:[^0-9\n]\\)" 2 3)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
184 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 ;; 4.3BSD lint pass 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 ;; strcmp: variable # of args. llib-lc(359) :: /usr/src/foo/foo.c(8)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
188 (4bsd
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
189 ("[^\n]*[ \t:]\\([a-zA-Z]?:?[^:( \t\n]+\\)[:(](+[ \t]*\\([0-9]+\\))[:) \t]*$"
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
190 1 2)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
191 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 ;; 4.3BSD lint pass 3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 ;; bloofle defined( /users/wolfgang/foo.c(4) ), but never used
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 ;; This used to be
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
196 ;; ("[ \t(]+\\([a-zA-Z]?:?[^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]+" 1 2)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 ;; which is regexp Impressionism - it matches almost anything!
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
198 (4bsd
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
199 ("[^\n]*([ \t]*\\([a-zA-Z]?:?[^:( \t\n]+\\)[:(][ \t]*\\([0-9]+\\))" 1 2)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
200 )
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
201
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
202 ;; MIPS lint pass<n>; looks good for SunPro lint also
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
203 ;; TrimMask (255) in solomon.c may be indistinguishable from TrimMasks (93) in solomon.c due to truncation
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
204 (mips
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
205 ("[^ \n]+ (\\([0-9]+\\)) in \\([^ \n]+\\)" 2 1)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
206 ;; name defined but never used: LinInt in cmap_calc.c(199)
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
207 ("[^\n]*in \\([^(\n]+\\)(\\([0-9]+\\))$" 1 2)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
208 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 ;; Ultrix 3.0 f77:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 ;; fort: Severe: addstf.f, line 82: Missing operator or delimiter symbol
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 ;; Some SGI cc version:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 ;; cfe: Warning 835: foo.c, line 2: something
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
214 ((sgi ultrix)
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
215 ("\\(cfe\\|fort\\): [^:\n]*: \\([^ \n]*\\), line \\([0-9]+\\):" 2 3)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
216 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 ;; Error on line 3 of t.f: Execution error unclassifiable statement
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 ;; Unknown who does this:
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
219 ;; Line 45 of "foo.c": bloofle undefined
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 ;; Absoft FORTRAN 77 Compiler 3.1.3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 ;; error on line 19 of fplot.f: spelling error?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 ;; warning on line 17 of fplot.f: data type is undefined for variable d
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
223 (of
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
224 ("\\(\\|[^\n]* on \\)[Ll]ine[ \t]+\\([0-9]+\\)[ \t]+\
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
225 of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
226 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 ;; Apollo cc, 4.3BSD fc:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 ;; "foo.f", line 3: Error: syntax error near end of statement
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 ;; IBM RS6000:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 ;; "vvouch.c", line 19.5: 1506-046 (S) Syntax error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 ;; Unknown compiler:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 ;; File "foobar.ml", lines 5-8, characters 20-155: blah blah
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 ;; Microtec mcc68k:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 ;; "foo.c", line 32 pos 1; (E) syntax error; unexpected symbol: "lossage"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 ;; GNAT (as of July 94):
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 ;; "foo.adb", line 2(11): warning: file name does not match ...
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
238 ;; IBM AIX xlc compiler:
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
239 ;; "src/swapping.c", line 30.34: 1506-342 (W) "/*" detected in comment.
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
240 (comma
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
241 ("[^\n]*\"\\([^,\" \n\t]+\\)\", lines? \
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
242 \\([0-9]+\\)\\([\(.]\\([0-9]+\\)\)?\\)?[:., (-]" 1 2 4)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
243 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 ;; MIPS RISC CC - the one distributed with Ultrix:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 ;; ccom: Error: foo.c, line 2: syntax error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 ;; DEC AXP OSF/1 cc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 ;; /usr/lib/cmplrs/cc/cfe: Error: foo.c: 1: blah blah
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
249 ((mips ultrix)
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
250 ("[^\n]*rror: \\([^,\" \n\t]+\\)[,:] \\(line \\)?\\([0-9]+\\):" 1 3)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
251 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 ;; IBM AIX PS/2 C version 1.1:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 ;; ****** Error number 140 in line 8 of file errors.c ******
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
255 (aix
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
256 ("[^\n]*in line \\([0-9]+\\) of file \\([^ \n]+[^. \n]\\)\\.? " 2 1)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
257 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 ;; IBM AIX lint is too painful to do right this way. File name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 ;; prefixes entire sections rather than being on each line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 ;; Lucid Compiler, lcc 3.x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 ;; E, file.cc(35,52) Illegal operation on pointers
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
263 (lcc
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
264 ("[EW], \\([^(\n]*\\)(\\([0-9]+\\),[ \t]*\\([0-9]+\\)" 1 2 3)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
265 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 ;; GNU messages with program name and optional column number.
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
268 (gnu
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
269 ("[a-zA-Z]?:?[^0-9 \n\t:]+:[ \t]*\\([^ \n\t:]+\\):\
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 \\([0-9]+\\):\\(\\([0-9]+\\)[: \t]\\)?" 1 2 4)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
271 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
273 ;; GNU messages with program name and optional column number
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
274 ;; and a severity letter after that. nsgmls makes them.
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
275 (gnu
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
276 ("[^0-9 \n\t:]+:[ \t]*\\([^ \n\t:]+\\):\
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
277 \\([0-9]+\\):\\(\\([0-9]+\\):\\)?[A-Za-z]:" 1 2 4)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
278 )
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
279
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 ;; jwz:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 ;; IRIX 5.2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 ;; cfe: Warning 712: foo.c, line 2: illegal combination of pointer and ...
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
283 (sgi
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
284 ("[^\n]* \\([^ \n,\"]+\\), line \\([0-9]+\\):" 1 2)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
285 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 ;; IRIX 5.2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 ;; cfe: Warning 600: xfe.c: 170: Not in a conditional directive while ...
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
288 (sgi
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
289 ("[^\n]*: \\([^ \n,\"]+\\): \\([0-9]+\\):" 1 2)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
290 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 ;; Cray C compiler error messages
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
293 (cray
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
294 ("\\(cc\\| cft\\)-[0-9]+ c\\(c\\|f77\\): ERROR \\([^,\n]+, \\)* File = \\([^,\n]+\\), Line = \\([0-9]+\\)" 4 5)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
295 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 ;; IBM C/C++ Tools 2.01:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 ;; foo.c(2:0) : informational EDC0804: Function foo is not referenced.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 ;; foo.c(3:8) : warning EDC0833: Implicit return statement encountered.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 ;; foo.c(5:5) : error EDC0350: Syntax error.
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
301 (ibm
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
302 ("\\([^( \n\t]+\\)(\\([0-9]+\\):\\([0-9]+\\)) : " 1 2 3)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
303 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 ;; Sun ada (VADS, Solaris):
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 ;; /home3/xdhar/rcds_rc/main.a, line 361, char 6:syntax error: "," inserted
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
307 (ada
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
308 ("\\([^, \n\t]+\\), line \\([0-9]+\\), char \\([0-9]+\\)[:., \(-]" 1 2 3)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 )
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
310 )
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
311 "Alist of (system regexp-alist) for building
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
312 `compilation-error-regexp-alist'. SYSTEM is either a system identifier,
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
313 or a list of system identifiers. See the variable
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
314 `compilation-error-regexp-systems-list'")
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
315
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
316 (defvar compilation-error-regexp-alist nil
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
317 "Alist that specifies how to match errors in compiler output.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 Each elt has the form (REGEXP FILE-IDX LINE-IDX [COLUMN-IDX FILE-FORMAT...])
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
319 If REGEXP matches constrained to the beginning of the line, the
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
320 FILE-IDX'th subexpression gives the file name, and the LINE-IDX'th
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
321 subexpression gives the line number. If COLUMN-IDX is given, the
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
322 COLUMN-IDX'th subexpression gives the column number on that line. If
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
323 any FILE-FORMAT is given, each is a format string to produce a file name
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
324 to try; %s in the string is replaced by the text matching the
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
325 FILE-IDX'th subexpression. Note previously REGEXP was not constrained
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
326 to the beginning of the line, so old patterns without leading `^' or `\\n'
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
327 may now require a leading `.*'.
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
328
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
329 Note that this now gets set by the function
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
330 `compilation-build-compilation-error-regexp-alist' using the
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
331 value of the variable `compilation-error-regexp-alist-alist'")
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
332
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
333 (defcustom compilation-error-regexp-systems-list 'all
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
334 "*This is either the symbol `all', or a list of systems for which
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
335 compilation error regexps should be included in
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
336 `compilation-error-regexp-alist'. You must run the function
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
337 `compilation-build-compilation-error-regexp-alist' after changing
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
338 the value of this variable for the change to take effect.
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
339
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
340 The list of known systems is:
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
341 gnu: but of course
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
342 lcc: Lucid compilers
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
343 ada: Ada compilers
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
344 of: Using tool that says line xx of foo.c
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
345 comma: Using tool that says \"foo.c\", line 12
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
346 4bsd: Using 4bsd
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
347 msft: Using microsoft
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
348 borland: Using Borland
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
349 mips: Using Mips
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
350 sgi: Using SGI
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
351 cray: Using Cray
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
352 ibm: IBM C compilers
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
353 aix: the operating system
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
354 ultrix: the operating system
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
355
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
356 See also the variable `compilation-error-regexp-alist-alist'."
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
357 :type '(choice (const all)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
358 (set :menu-tag "Pick"
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
359 (const gnu) (const lcc) (const ada)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
360 (const of) (const comma) (const 4bsd)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
361 (const msft) (const borland) (const mips)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
362 (const sgi) (const cray) (const ibm)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
363 (const aix) (const ultrix)))
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
364 :set (lambda (symbol value)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
365 (set-default symbol value)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
366 (compilation-build-compilation-error-regexp-alist))
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
367 :group 'compilation)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
368
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
369 (compilation-build-compilation-error-regexp-alist)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
371 (defcustom compilation-read-command t
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
372 "*If not nil, M-x compile reads the compilation command to use.
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
373 Otherwise, M-x compile just uses the value of `compile-command'."
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
374 :type 'boolean
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
375 :group 'compilation)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
377 (defcustom compilation-ask-about-save t
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
378 "*If not nil, M-x compile asks which buffers to save before compiling.
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
379 Otherwise, it saves all modified buffers without asking."
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
380 :type 'boolean
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
381 :group 'compilation)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (defvar grep-regexp-alist
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
384 '(("^\\([a-zA-Z]?:?[^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]" 1 2))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 "Regexp used to match grep hits. See `compilation-error-regexp-alist'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
387 (defcustom grep-command "grep -n "
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
388 "*Last grep command used in \\[grep]; default for next grep."
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
389 :type 'string
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
390 :group 'compilation)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 ;;;###autoload
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
393 (defcustom compilation-search-path '(nil)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 "*List of directories to search for source files named in error messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 Elements should be directory names, not file names of directories.
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
396 nil as an element means to try the default directory."
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
397 :type '(repeat (choice (const :tag "Default" nil)
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
398 directory))
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
399 :group 'compilation)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
401 (defcustom compile-command "make -k "
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
402 "*Last shell command used to do a compilation; default for next compilation.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 Sometimes it is useful for files to supply local values for this variable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 You might also use mode hooks to specify it in certain modes, like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 (setq c-mode-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 '(lambda () (or (file-exists-p \"makefile\") (file-exists-p \"Makefile\")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 (progn (make-local-variable 'compile-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (setq compile-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 (concat \"make -k \"
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
412 buffer-file-name))))))"
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
413 :type 'string
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
414 :group 'compilation)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 (defvar compilation-enter-directory-regexp
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
417 "[^\n]*: Entering directory `\\([^\n]*\\)'$"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 "Regular expression matching lines that indicate a new current directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 This must contain one \\(, \\) pair around the directory name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 The default value matches lines printed by the `-w' option of GNU Make.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (defvar compilation-leave-directory-regexp
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
424 "[^\n]*: Leaving directory `\\([^\n]*\\)'$"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 "Regular expression matching lines that indicate restoring current directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 This may contain one \\(, \\) pair around the name of the directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 being moved from. If it does not, the last directory entered \(by a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 line matching `compilation-enter-directory-regexp'\) is assumed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 The default value matches lines printed by the `-w' option of GNU Make.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 (defvar compilation-directory-stack nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 "Stack of previous directories for `compilation-leave-directory-regexp'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 The head element is the directory the compilation was started in.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 (defvar compilation-exit-message-function nil "\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 If non-nil, called when a compilation process dies to return a status message.
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
438 This should be a function of three arguments: process status, exit status,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
439 and exit message; it returns a cons (MESSAGE . MODELINE) of the strings to
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
440 write into the compilation buffer, and to put in its mode line.")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 ;; History of compile commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 (defvar compile-history nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 ;; History of grep commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 (defvar grep-history nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
447 ;; XEmacs
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
448 (defvar compilation-font-lock-keywords (purecopy
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 '("^[-_.\"A-Za-z0-9/+]+\\(:\\|, line \\)[0-9]+: \\([wW]arning:\\).*$" .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 font-lock-keyword-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 '("^[-_.\"A-Za-z0-9/+]+\\(: *\\|, line \\)[0-9]+:.*$" . font-lock-function-name-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 '("^[^:\n]+-[a-zA-Z][^:\n]+$" . font-lock-doc-string-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 '("\\(^[-_.\"A-Za-z0-9/+]+\\)\\(: *\\|, line \\)[0-9]+" 1 font-lock-string-face t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 '("^[-_.\"A-Za-z0-9/+]+\\(: *[0-9]+\\|, line [0-9]+\\)" 1 bold t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 "Additional expressions to highlight in Compilation mode.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 ;FSF's version. Ours looks better.
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
460 ;(defvar compilation-mode-font-lock-keywords
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 ; ;; This regexp needs a bit of rewriting. What is the third grouping for?
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
462 ; '(("^\\([a-zA-Z]?:?[^ \n:]*:\\([0-9]+:\\)+\\)\\(.*\\)$"
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
463 ; 1 font-lock-function-name-face))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
464 ;;; ("^\\([^\n:]*:\\([0-9]+:\\)+\\)\\(.*\\)$" 0 font-lock-keyword-face keep)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
465
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
466 ;; XEmacs change
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 (put 'compilation-mode 'font-lock-defaults
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 '(compilation-font-lock-keywords t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 193
diff changeset
470 (defcustom compilation-mouse-motion-initiate-parsing nil
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
471 "*Should mouse motion over the compilation buffer initiate parsing?
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
472 When set to a non-nil value, mouse motion over the compilation/grep
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
473 buffer may initiate parsing of the error messages or grep hits.
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
474 When this is nil, errors and grep matches will no longer be
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
475 highlighted until they have been parsed, but may still be selected
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
476 with the center mouse button. This will then initiate parsing
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
477 and jump to the corresponding source line."
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
478 :type 'boolean
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 116
diff changeset
479 :group 'compilation)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (defun compile (command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 "Compile the program including the current buffer. Default: run `make'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 Runs COMMAND, a shell command, in a separate process asynchronously
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 with output going to the buffer `*compilation*'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 You can then use the command \\[next-error] to find the next error message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 and move to the source code that caused it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 Interactively, prompts for the command if `compilation-read-command' is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 non-nil; otherwise uses `compile-command'. With prefix arg, always prompts.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 To run more than one compilation at once, start one and rename the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 \`*compilation*' buffer to some other name with \\[rename-buffer].
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 Then start the next one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 The name used for the buffer is actually whatever is returned by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 the function in `compilation-buffer-name-function', so you can set that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 to a function that generates a unique name."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 (if (or compilation-read-command current-prefix-arg)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
502 ;; XEmacs change
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 (list (read-shell-command "Compile command: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 compile-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 ;; #### minibuffer code should do this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 (if (equal (car compile-history)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 compile-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 '(compile-history . 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 'compile-history)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 (list compile-command)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 (setq compile-command command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 (save-some-buffers (not compilation-ask-about-save) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 (compile-internal compile-command "No more errors"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 ;;; run compile with the default command line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 (defun recompile ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 "Re-compile the program including the current buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 (save-some-buffers (not compilation-ask-about-save) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 (compile-internal compile-command "No more errors"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 ;; The system null device. (Should reference NULL_DEVICE from C.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 (defvar grep-null-device "/dev/null" "The system null device.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 (defun grep (command-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 "Run grep, with user-specified args, and collect output in a buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 While grep runs asynchronously, you can use the \\[next-error] command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 to find the text that grep hits refer to.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 This command uses a special history list for its arguments, so you can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 easily repeat a grep command."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 (interactive
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
534 ;; XEmacs change
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 (list (read-shell-command "Run grep (like this): "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 grep-command 'grep-history)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 (let ((buf (compile-internal (concat command-args " " grep-null-device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 "No more grep hits" "grep"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 ;; Give it a simpler regexp to match.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 nil grep-regexp-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 (set-buffer buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 (set (make-local-variable 'compilation-exit-message-function)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
544 ;; XEmacs change
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 (lambda (proc msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 (let ((code (process-exit-status proc)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 (if (eq (process-status proc) 'exit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 (cond ((zerop code)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 '("finished (matches found)\n" . "matched"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 ((= code 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 '("finished with no matches found\n" . "no match"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 (cons msg code)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 (cons msg code))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 (defun compile-internal (command error-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 &optional name-of-mode parser regexp-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 name-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 "Run compilation command COMMAND (low level interface).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 ERROR-MESSAGE is a string to print if the user asks to see another error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 and there are no more errors. Third argument NAME-OF-MODE is the name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 to display as the major mode in the compilation buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 Fourth arg PARSER is the error parser function (nil means the default). Fifth
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 arg REGEXP-ALIST is the error message regexp alist to use (nil means the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 default). Sixth arg NAME-FUNCTION is a function called to name the buffer (nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 means the default). The defaults for these variables are the global values of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 \`compilation-parse-errors-function', `compilation-error-regexp-alist', and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 \`compilation-buffer-name-function', respectively.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 Returns the compilation buffer created."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 (let (outbuf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (or name-of-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 (setq name-of-mode "Compilation"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 (setq outbuf
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 (get-buffer-create
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 (funcall (or name-function compilation-buffer-name-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 (function (lambda (mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 (concat "*" (downcase mode) "*"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 name-of-mode)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 (set-buffer outbuf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 (let ((comp-proc (get-buffer-process (current-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 (if comp-proc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 (if (or (not (eq (process-status comp-proc) 'run))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 (yes-or-no-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 (format "A %s process is running; kill it? "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 name-of-mode)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 (interrupt-process comp-proc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 (sit-for 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 (delete-process comp-proc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 (error nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 (error "Cannot have two processes in `%s' at once"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 (buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 ;; In case the compilation buffer is current, make sure we get the global
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 ;; values of compilation-error-regexp-alist, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 (kill-all-local-variables))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 (let ((regexp-alist (or regexp-alist compilation-error-regexp-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 (parser (or parser compilation-parse-errors-function))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 (thisdir default-directory)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
604 ;; XEmacs change
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 (buffer-save (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 outwin)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
607
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
608 ;; XEmacs change
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 ;; Pop up the compilation buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 (setq outwin (display-buffer outbuf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 ;; Clear out the compilation buffer and make it writable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 ;; Change its default-directory to the directory where the compilation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 ;; will happen, and insert a `cd' command to indicate this.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 (set-buffer outbuf)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
618
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 (setq buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 (buffer-disable-undo (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 (buffer-enable-undo (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 (setq default-directory thisdir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 (insert "cd " thisdir "\n" command "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 (set-buffer-modified-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
627 ;; XEmacs change
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 ;; set it so the window will scroll to show compile output
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 (select-window outwin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 (goto-char (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
633 ;; XEmacs change
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 (compilation-mode name-of-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 ;; (setq buffer-read-only t) ;;; Non-ergonomic.
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
636 ;; XEmacs change
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 (set (make-local-variable 'compile-command) command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 (set (make-local-variable 'compilation-parse-errors-function) parser)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 (set (make-local-variable 'compilation-error-message) error-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 (set (make-local-variable 'compilation-error-regexp-alist) regexp-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 (setq default-directory thisdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 compilation-directory-stack (list default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 (set-window-start outwin (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 (setq mode-name name-of-mode)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
645 ;; XEmacs change
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 ; (or (eq outwin (selected-window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 ; (set-window-point outwin (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 (compilation-set-window-height outwin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 ;; Start the compilation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 (if (fboundp 'start-process)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 (let* ((process-environment (cons "EMACS=t" process-environment))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 (proc (start-process-shell-command (downcase mode-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 outbuf
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 command)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 (set-process-sentinel proc 'compilation-sentinel)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 (set-process-filter proc 'compilation-filter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 (set-marker (process-mark proc) (point) outbuf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 (setq compilation-in-progress
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 (cons proc compilation-in-progress)))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
660 ;; No asynchronous processes available.
193
f53b5ca2e663 Import from CVS: tag r20-3b23
cvs
parents: 189
diff changeset
661 (display-message
f53b5ca2e663 Import from CVS: tag r20-3b23
cvs
parents: 189
diff changeset
662 'progress
f53b5ca2e663 Import from CVS: tag r20-3b23
cvs
parents: 189
diff changeset
663 (format "Executing `%s'..." command))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
664 ; FSF
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
665 ; (setq mode-line-process ":run")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
666 ; (force-mode-line-update)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
667 (sit-for 0) ;; Force redisplay
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 (let ((status (call-process shell-file-name nil outbuf nil "-c"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 command))))
193
f53b5ca2e663 Import from CVS: tag r20-3b23
cvs
parents: 189
diff changeset
670 (display-message
f53b5ca2e663 Import from CVS: tag r20-3b23
cvs
parents: 189
diff changeset
671 'progress
f53b5ca2e663 Import from CVS: tag r20-3b23
cvs
parents: 189
diff changeset
672 (format "Executing `%s'...done" command))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 (set-buffer buffer-save)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 ;; Make it so the next C-x ` will use this buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 (setq compilation-last-buffer outbuf)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 ;; Set the height of WINDOW according to compilation-window-height.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 (defun compilation-set-window-height (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 (and compilation-window-height
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 (= (window-width window) (frame-width (window-frame window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 ;; If window is alone in its frame, aside from a minibuffer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 ;; don't change its height.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 (not (eq window (frame-root-window (window-frame window))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 ;; This save-excursion prevents us from changing the current buffer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 ;; which might not be the same as the selected window's buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 (let ((w (selected-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 (select-window window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 (enlarge-window (- compilation-window-height
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 (window-height))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 (select-window w))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 (defvar compilation-minor-mode-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 (let ((map (make-sparse-keymap)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 (set-keymap-name map 'compilation-minor-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 (define-key map "\C-c\C-c" 'compile-goto-error)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 (define-key map "\C-m" 'compile-goto-error)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 (define-key map "\C-c\C-k" 'kill-compilation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 (define-key map "\M-n" 'compilation-next-error)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 (define-key map "\M-p" 'compilation-previous-error)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 (define-key map "\M-{" 'compilation-previous-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 (define-key map "\M-}" 'compilation-next-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 "Keymap for `compilation-minor-mode'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 (defvar compilation-mode-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 (let ((map (make-sparse-keymap)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 (set-keymap-parents map (list compilation-minor-mode-map))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 (set-keymap-name map 'compilation-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 (define-key map " " 'scroll-up)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 (define-key map "\^?" 'scroll-down)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 (define-key map 'button2 'compile-mouse-goto-error)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 "Keymap for compilation log buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 `compilation-minor-mode-map' is a parent of this.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 ;;; XEmacs menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 (defun compilation-errors-exist-p (&optional buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 "Whether we are in a state where the `next-error' command will work,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 that is, whether there exist (or may exist) error targets in the *compile*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 or *grep* buffers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 (or buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 (setq buffer (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 (compilation-find-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 (error nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 (and buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 (compilation-buffer-p buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 ;; Has errors on the list, or needs to be parsed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 ;; But don't parse it now!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 (or (not (null compilation-error-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 (< compilation-parsing-end (point-max))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 (defvar Compilation-mode-popup-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 '("Compilation Mode Commands"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 :filter compile-menu-filter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 ["Compile..." compile t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 ["Recompile" recompile t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 ["Kill Compilation" kill-compilation (get-buffer-process (current-buffer))]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 "---"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 ["Goto Error" compile-goto-error (compilation-errors-exist-p)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 ["Next Error" next-error (compilation-errors-exist-p)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 ["Previous Error" previous-error (compilation-errors-exist-p)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 ["First Error" first-error (compilation-errors-exist-p)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 (defvar Compilation-mode-menubar-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 (cons "Compile" (cdr Compilation-mode-popup-menu)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 (defvar grep-mode-popup-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 '("Grep Mode Commands"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 :filter grep-menu-filter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 ["Grep..." grep t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 ["Repeat Grep" recompile t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 ["Kill Grep" kill-compilation (get-buffer-process (current-buffer))]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 "---"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 ["Goto Match" compile-goto-error (default-value 'compilation-error-list)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 ["Next Match" next-error (default-value 'compilation-error-list)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 ["Previous Match" previous-error (default-value 'compilation-error-list)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 ["First Match" first-error (default-value 'compilation-error-list)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 (defvar grep-mode-menubar-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 (cons "Grep" (cdr grep-mode-popup-menu)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 (defun compile-menu-filter-1 (menu history-list item-name command-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 (let ((submenu (mapcar #'(lambda (string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 (vector string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 (list command-name string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 history-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 (existing (assoc item-name menu)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 (if existing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 (setcdr existing submenu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 (nconc menu (list (cons item-name submenu))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 (defun compile-menu-filter (menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 (compile-menu-filter-1 menu compile-history "Compile History" 'compile))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 (defun grep-menu-filter (menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 (compile-menu-filter-1 menu grep-history "Grep History" 'grep))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 (defun compilation-mode (&optional name-of-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 "Major mode for compilation log buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 \\<compilation-mode-map>To visit the source for a line-numbered error,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 move point to the error message line and type \\[compile-goto-error],
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 or click on the line with \\[compile-mouse-goto-error].
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 There is a menu of commands on \\[compile-popup-menu].
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 To kill the compilation, type \\[kill-compilation].
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 Runs `compilation-mode-hook' with `run-hooks' (which see)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 (kill-all-local-variables)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 (use-local-map compilation-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 (setq major-mode 'compilation-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 mode-name "Compilation")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 (compilation-setup)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 (font-lock-set-defaults)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 (if (not name-of-mode) nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 (let ((sym (intern (concat name-of-mode "-mode-popup-menu"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 (if (boundp sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 (setq mode-popup-menu (symbol-value sym))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 (if (featurep 'menubar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 ;; make a local copy of the menubar, so our modes don't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 ;; change the global menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 (set-buffer-menubar current-menubar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 (let ((sym (intern (concat name-of-mode "-mode-menubar-menu"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 (if (boundp sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 (add-submenu nil (symbol-value sym)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 (run-hooks 'compilation-mode-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 ;; XEmacs addition, hacked by Mly
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 (defun compilation-mode-motion-hook (event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 (mode-motion-highlight-internal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 #'beginning-of-line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 #'(lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 (let* ((p (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 (e (progn (end-of-line) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 (l (progn
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
829 (if (and compilation-mouse-motion-initiate-parsing
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
830 (or (eq compilation-error-list 't)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
831 (>= p compilation-parsing-end)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 ;; #### Does it suck too badly to have mouse-movement
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 ;; #### over a buffer parse errors in that buffer??
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 (compile-reinitialize-errors nil p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 (if (and compilation-error-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 (<= (car (car compilation-error-list)) p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 ;; Perhaps save time by only searching tail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 compilation-error-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 compilation-old-error-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 (if (catch 'found
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 (while l
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 (let ((x (marker-position (car (car l)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 (cond ((< x p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 (setq l (cdr l)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 ((<= x e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 (throw 'found t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 (throw 'found nil)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 (goto-char e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 (goto-char p))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 ;; Prepare the buffer for the compilation parsing commands to work.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 (defun compilation-setup ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 ;; Make the buffer's mode line show process state.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 (setq mode-line-process '(":%s"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 (set (make-local-variable 'compilation-error-list) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 (set (make-local-variable 'compilation-old-error-list) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 (set (make-local-variable 'compilation-parsing-end) 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 (set (make-local-variable 'compilation-directory-stack) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 (setq compilation-last-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 ;; XEmacs change: highlight lines, install menubar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 (require 'mode-motion)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 (setq mode-motion-hook 'compilation-mode-motion-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 (make-local-variable 'mouse-track-click-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 (add-hook 'mouse-track-click-hook 'compile-mouse-maybe-goto-error)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 (defvar compilation-minor-mode nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 "Non-nil when in compilation-minor-mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 In this minor mode, all the error-parsing commands of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 Compilation major mode are available.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 (make-variable-buffer-local 'compilation-minor-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 (or (assq 'compilation-minor-mode minor-mode-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 (setq minor-mode-alist (cons '(compilation-minor-mode " Compilation")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 minor-mode-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 (or (assq 'compilation-minor-mode minor-mode-map-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 (setq minor-mode-map-alist (cons (cons 'compilation-minor-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 compilation-minor-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 minor-mode-map-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 (defun compilation-minor-mode (&optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 "Toggle compilation minor mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 With arg, turn compilation mode on if and only if arg is positive.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 See `compilation-mode'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 ! \\{compilation-mode-map}"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 (if (setq compilation-minor-mode (if (null arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 (null compilation-minor-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 (> (prefix-numeric-value arg) 0)))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
894 (progn
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
895 (compilation-setup)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
896 (run-hooks 'compilation-minor-mode-hook))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
897
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
898 ;; Write msg in the current buffer and hack its mode-line-process.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
899 (defun compilation-handle-exit (process-status exit-status msg)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
900 (let ((buffer-read-only nil)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
901 (status (if compilation-exit-message-function
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
902 (funcall compilation-exit-message-function
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
903 process-status exit-status msg)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
904 (cons msg exit-status)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
905 (omax (point-max))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
906 (opoint (point)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
907 ;; Record where we put the message, so we can ignore it
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
908 ;; later on.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
909 (goto-char omax)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
910 (insert ?\n mode-name " " (car status))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
911 (forward-char -1)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
912 (insert " at " (substring (current-time-string) 0 19))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
913 (forward-char 1)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
914 (setq mode-line-process (format ":%s [%s]" process-status (cdr status)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
915 ;; Force mode line redisplay soon.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
916 (force-mode-line-update)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
917 (if (and opoint (< opoint omax))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
918 (goto-char opoint))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
919 (if compilation-finish-function
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
920 (funcall compilation-finish-function (current-buffer) msg))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 ;; Called when compilation process changes state.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 (defun compilation-sentinel (proc msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 "Sentinel for compilation buffers."
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
925 ;; XEmacs change
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 (let* ((buffer (process-buffer proc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 (window (get-buffer-window buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 (if (memq (process-status proc) '(signal exit))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 (if (null (buffer-name buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 ;; buffer killed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 (set-process-buffer proc nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 (let ((obuf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 omax opoint estatus)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 ;; save-excursion isn't the right thing if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 ;; process-buffer is current-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 ;; Write something in the compilation buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 ;; and hack its mode line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 (let ((buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 (status (if compilation-exit-message-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 (funcall compilation-exit-message-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 proc msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 (cons msg (process-exit-status proc)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 (setq omax (point-max)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 opoint (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 (goto-char omax)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 ;; Record where we put the message, so we can ignore it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 ;; later on.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 (insert ?\n mode-name " " (car status))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 (insert " at " (substring (current-time-string) 0 19))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 (forward-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 (setq mode-line-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 (concat ":"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 (symbol-name (process-status proc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 (if (zerop (process-exit-status proc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 " OK"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 (setq estatus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 (format " [exit-status %d]"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 (process-exit-status proc))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 ;; XEmacs - tedium should let you know when it's ended...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 (if (and (not compilation-always-signal-completion)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 (pos-visible-in-window-p (point-max) window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 nil ; assume that the user will see it...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 (ding t 'ready)
193
f53b5ca2e663 Import from CVS: tag r20-3b23
cvs
parents: 189
diff changeset
971 (display-message
f53b5ca2e663 Import from CVS: tag r20-3b23
cvs
parents: 189
diff changeset
972 'progress
f53b5ca2e663 Import from CVS: tag r20-3b23
cvs
parents: 189
diff changeset
973 (format "Compilation process completed%s."
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 (or estatus " successfully")
193
f53b5ca2e663 Import from CVS: tag r20-3b23
cvs
parents: 189
diff changeset
975 )))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 ;; Since the buffer and mode line will show that the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 ;; process is dead, we can delete it now. Otherwise it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 ;; will stay around until M-x list-processes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 (delete-process proc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 ;; Force mode line redisplay soon.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 (redraw-modeline))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 (if (and opoint (< opoint omax))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 (goto-char opoint))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 (if compilation-finish-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 (funcall compilation-finish-function buffer msg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 (set-buffer obuf))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 (setq compilation-in-progress (delq proc compilation-in-progress))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 ))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 (defun compilation-filter (proc string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 "Process filter for compilation buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 Just inserts the text, but uses `insert-before-markers'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 (if (buffer-name (process-buffer proc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 (set-buffer (process-buffer proc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 (let ((buffer-read-only nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 (goto-char (process-mark proc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 (insert-before-markers string)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1000 (run-hooks 'compilation-filter-hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 (set-marker (process-mark proc) (point)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 ;; Return the cdr of compilation-old-error-list for the error containing point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 (defun compile-error-at-point ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 (compile-reinitialize-errors nil (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 (let ((errors compilation-old-error-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 (while (and errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 (> (point) (car (car errors))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 (setq errors (cdr errors)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 errors))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1012 (defsubst compilation-buffer-p (buffer)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 (or compilation-minor-mode (eq major-mode 'compilation-mode))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 (defun compilation-next-error (n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 "Move point to the next error in the compilation buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 Does NOT find the source line like \\[next-error]."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 (or (compilation-buffer-p (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 (error "Not in a compilation buffer."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 (setq compilation-last-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 (let ((errors (compile-error-at-point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 ;; Move to the error after the one containing point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 (goto-char (car (if (< n 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 (let ((i 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 (e compilation-old-error-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 ;; See how many cdrs away ERRORS is from the start.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 (while (not (eq e errors))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 (setq i (1+ i)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 e (cdr e)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 (if (> (- n) i)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 (error "Moved back past first error")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 (nth (+ i n) compilation-old-error-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 (let ((compilation-error-list (cdr errors)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 (compile-reinitialize-errors nil nil n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 (if compilation-error-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 (nth (1- n) compilation-error-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 (error "Moved past last error"))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 (defun compilation-previous-error (n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 "Move point to the previous error in the compilation buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 Does NOT find the source line like \\[next-error]."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 (compilation-next-error (- n)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 ;; Given an elt of `compilation-error-list', return an object representing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 ;; the referenced file which is equal to (but not necessarily eq to) what
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 ;; this function would return for another error in the same file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 (defsubst compilation-error-filedata (data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 (setq data (cdr data))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 (if (markerp data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 (marker-buffer data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 (car data)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 ;; Return a string describing a value from compilation-error-filedata.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 ;; This value is not necessarily useful as a file name, but should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 ;; indicative to the user of what file's errors are being referred to.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 (defsubst compilation-error-filedata-file-name (filedata)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 (if (bufferp filedata)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 (buffer-file-name filedata)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 (car filedata)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 (defun compilation-next-file (n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 "Move point to the next error for a different file than the current one."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071 (or (compilation-buffer-p (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 (error "Not in a compilation buffer."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 (setq compilation-last-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 (let ((reversed (< n 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 errors filedata)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 (if (not reversed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 (setq errors (or (compile-error-at-point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 (error "Moved past last error")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 ;; Get a reversed list of the errors up through the one containing point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 (compile-reinitialize-errors nil (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 (setq errors (reverse compilation-old-error-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 n (- n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 ;; Ignore errors after point. (car ERRORS) will be the error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 ;; containing point, (cadr ERRORS) the one before it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 (while (and errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 (< (point) (car (car errors))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 (setq errors (cdr errors))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 (while (> n 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 (setq filedata (compilation-error-filedata (car errors)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 ;; Skip past the following errors for this file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 (while (equal filedata
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 (compilation-error-filedata
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 (car (or errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 (if reversed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 (error "%s the first erring file"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 (compilation-error-filedata-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 filedata))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 (let ((compilation-error-list nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 ;; Parse some more.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 (compile-reinitialize-errors nil nil 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 (setq errors compilation-error-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 (error "%s is the last erring file"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 (compilation-error-filedata-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 filedata))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 (setq errors (cdr errors)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 (setq n (1- n)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 ;; Move to the following error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 (goto-char (car (car (or errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 (if reversed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 (error "This is the first erring file")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 (let ((compilation-error-list nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120 ;; Parse the last one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 (compile-reinitialize-errors nil nil 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 compilation-error-list))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 (defun compilation-previous-file (n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 "Move point to the previous error for a different file than the current one."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127 (compilation-next-file (- n)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 (defun kill-compilation ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131 "Kill the process made by the \\[compile] command."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 (let ((buffer (compilation-find-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 (if (get-buffer-process buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 (interrupt-process (get-buffer-process buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 (error "The compilation process is not running."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 ;; Parse any new errors in the compilation buffer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 ;; or reparse from the beginning if the user has asked for that.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 (defun compile-reinitialize-errors (reparse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 &optional limit-search find-at-least)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 ;; XEmacs change: Below we made a change to possibly change the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 ;; selected window. If we don't save and restore the old window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 ;; then if we get an error such as 'no more errors' we'll end up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 ;; in the compilation buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 (set-buffer compilation-last-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 ;; If we are out of errors, or if user says "reparse",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151 ;; discard the info we have, to force reparsing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 (if (or (eq compilation-error-list t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 reparse)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 (compilation-forget-errors))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 (if (and compilation-error-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156 (or (not limit-search)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157 (> compilation-parsing-end limit-search))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 (or (not find-at-least)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159 (>= (length compilation-error-list) find-at-least)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 ;; Since compilation-error-list is non-nil, it points to a specific
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 ;; error the user wanted. So don't move it around.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164 ;; XEmacs change: if the compilation buffer is already visible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 ;; in a window, use that instead of thrashing the display.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 (let ((w (get-buffer-window compilation-last-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167 (if w
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168 (select-window w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 (switch-to-buffer compilation-last-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1171 ;; This was here for a long time (before my rewrite); why? --roland
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1172 ;;(switch-to-buffer compilation-last-buffer)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 (set-buffer-modified-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 (if (< compilation-parsing-end (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175 ;; compilation-error-list might be non-nil if we have a non-nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 ;; LIMIT-SEARCH or FIND-AT-LEAST arg. In that case its value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 ;; records the current position in the error list, and we must
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178 ;; preserve that after reparsing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 (let ((error-list-pos compilation-error-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180 (funcall compilation-parse-errors-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181 limit-search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182 (and find-at-least
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 ;; We only need enough new parsed errors to reach
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184 ;; FIND-AT-LEAST errors past the current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 ;; position.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 (- find-at-least (length compilation-error-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187 ;; Remember the entire list for compilation-forget-errors. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 ;; this is an incremental parse, append to previous list. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189 ;; we are parsing anew, compilation-forget-errors cleared
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190 ;; compilation-old-error-list above.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191 (setq compilation-old-error-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 (nconc compilation-old-error-list compilation-error-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 (if error-list-pos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 ;; We started in the middle of an existing list of parsed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 ;; errors before parsing more; restore that position.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196 (setq compilation-error-list error-list-pos))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197 ))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1199 ;; XEmacs addition
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1200 ;; FSF has added this by 19.34, but it is highly complex, why? -sb
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1201 (defun compile-mouse-goto-error (event)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1202 "Visit the source for the error under the mouse.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1203 Use this command in a compilation log buffer."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1204 (interactive "e")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1205 (mouse-set-point event)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1206 (beginning-of-line)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1207 (compile-goto-error))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1208
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1209 (defun compile-goto-error (&optional argp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1210 "Visit the source for the error message point is on.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1211 Use this command in a compilation log buffer. Sets the mark at point there.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 \\[universal-argument] as a prefix arg means to reparse the buffer's error messages first;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213 other kinds of prefix arguments are ignored."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215 (or (compilation-buffer-p (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216 (error "Not in a compilation buffer."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217 (setq compilation-last-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1218 (compile-reinitialize-errors (consp argp) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220 ;; Move to bol; the marker for the error on this line will point there.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1222
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223 ;; Move compilation-error-list to the elt of compilation-old-error-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224 ;; we want.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 (setq compilation-error-list compilation-old-error-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1226 (while (and compilation-error-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227 (> (point) (car (car compilation-error-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1228 (setq compilation-error-list (cdr compilation-error-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230 ;; Move to another window, so that next-error's window changes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231 ;; result in the desired setup.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 (or (one-window-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 (other-window -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235 ;; other-window changed the selected buffer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236 ;; but we didn't want to do that.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237 (set-buffer compilation-last-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 (push-mark)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240 (next-error 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242 ;; XEmacs addition
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 (defun compile-mouse-maybe-goto-error (event &optional click-count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244 (interactive "e")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 (if (equal (event-button event) 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 (let ((buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247 (point (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248 (config (current-window-configuration)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 (compile-mouse-goto-error event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 (set-window-configuration config)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256 (goto-char point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257 nil)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 ;; Return a compilation buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 ;; If the current buffer is a compilation buffer, return it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 ;; If compilation-last-buffer is set to a live buffer, use that.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 ;; Otherwise, look for a compilation buffer and signal an error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263 ;; if there are none.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264 (defun compilation-find-buffer (&optional other-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265 (if (and (not other-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266 (compilation-buffer-p (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267 ;; The current buffer is a compilation buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 (current-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 (if (and compilation-last-buffer (buffer-name compilation-last-buffer)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1270 (compilation-buffer-p compilation-last-buffer)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 (or (not other-buffer) (not (eq compilation-last-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 (current-buffer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 compilation-last-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 (let ((buffers (buffer-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 (while (and buffers (or (not (compilation-buffer-p (car buffers)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 (and other-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277 (eq (car buffers) (current-buffer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 (setq buffers (cdr buffers)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 (if buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 (car buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 (or (and other-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 (compilation-buffer-p (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283 ;; The current buffer is a compilation buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 (if other-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 (message "This is the only compilation buffer."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 (error "No compilation started!")))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 (defun next-error (&optional argp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 "Visit next compilation error message and corresponding source code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 This operates on the output from the \\[compile] command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 If all preparsed error messages have been processed,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 the error message buffer is checked for new ones.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 A prefix arg specifies how many error messages to move;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 negative means move back to previous error messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299 Just C-u as a prefix means reparse the error message buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 and start at the first error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302 \\[next-error] normally applies to the most recent compilation started,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303 but as long as you are in the middle of parsing errors from one compilation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 output buffer, you stay with that compilation output buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1305
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306 Use \\[next-error] in a compilation output buffer to switch to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1307 processing errors from that compilation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309 See variables `compilation-parse-errors-function' and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310 \`compilation-error-regexp-alist' for customization ideas."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312 (setq compilation-last-buffer (compilation-find-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313 (compilation-goto-locus (compilation-next-error-locus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314 ;; We want to pass a number here only if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315 ;; we got a numeric prefix arg, not just C-u.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316 (and (not (consp argp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 (prefix-numeric-value argp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1318 (consp argp))))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1319 ;;;###autoload (define-key ctl-x-map "`" 'next-error)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1320
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321 ;; XEmacs change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323 (defun previous-error (&optional argp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 "Visit previous compilation error message and corresponding source code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 This operates on the output from the \\[compile] command."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327 (next-error (cond ((null argp) -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328 ((numberp argp) (- argp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329 (t argp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1330
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332 (defun first-error ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 "Reparse the error message buffer and start at the first error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334 Visit corresponding source code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335 This operates on the output from the \\[compile] command."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337 (next-error '(4)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1339 (defun compilation-next-error-locus (&optional move reparse silent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340 "Visit next compilation error and return locus in corresponding source code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1341 This operates on the output from the \\[compile] command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342 If all preparsed error messages have been processed,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343 the error message buffer is checked for new ones.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1344
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1345 Returns a cons (ERROR . SOURCE) of two markers: ERROR is a marker at the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1346 location of the error message in the compilation buffer, and SOURCE is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347 marker at the location in the source code indicated by the error message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349 Optional first arg MOVE says how many error messages to move forwards (or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1350 backwards, if negative); default is 1. Optional second arg REPARSE, if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351 non-nil, says to reparse the error message buffer and reset to the first
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1352 error (plus MOVE - 1). If optional third argument SILENT is non-nil, return
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353 nil instead of raising an error if there are no more errors.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1355 The current buffer should be the desired compilation output buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356 (or move (setq move 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1357 (compile-reinitialize-errors reparse nil (and (not reparse)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358 (if (< move 1) 0 (1- move))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359 (let (next-errors next-error)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360 (catch 'no-next-error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362 (set-buffer compilation-last-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363 ;; compilation-error-list points to the "current" error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 (setq next-errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365 (if (> move 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 (nthcdr (1- move)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367 compilation-error-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 ;; Zero or negative arg; we need to move back in the list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369 (let ((n (1- move))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370 (i 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371 (e compilation-old-error-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372 ;; See how many cdrs away the current error is from the start.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1373 (while (not (eq e compilation-error-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374 (setq i (1+ i)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1375 e (cdr e)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1376 (if (> (- n) i)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377 (error "Moved back past first error")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378 (nthcdr (+ i n) compilation-old-error-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379 next-error (car next-errors))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380 (while
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381 (if (null next-error)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383 (and move (/= move 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384 (error (if (> move 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385 "Moved past last error"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386 "Moved back past first error")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387 ;; Forget existing error messages if compilation has finished.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388 ;;; XEmacs change by Barry Warsaw.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389 ;;; Without this, if you get a "no more errors" error, then you can't do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390 ;;; previous-error or goto-error until you kill the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391 ; (if (not (and (get-buffer-process (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392 ; (eq (process-status
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393 ; (get-buffer-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1394 ; (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1395 ; 'run)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396 ; (compilation-forget-errors))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397 (if silent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398 (throw 'no-next-error nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399 (error (concat compilation-error-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 (and (get-buffer-process (current-buffer))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1401 (eq (process-status
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1402 (get-buffer-process
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403 (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404 'run)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1405 " yet")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406 (setq compilation-error-list (cdr next-errors))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407 (if (null (cdr next-error))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408 ;; This error is boring. Go to the next.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409 t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410 (or (markerp (cdr next-error))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411 ;; This error has a filename/lineno pair.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1412 ;; Find the file and turn it into a marker.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413 (let* ((fileinfo (car (cdr next-error)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414 (cbuf (current-buffer)) ;XEmacs addition
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415 (buffer (apply 'compilation-find-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1416 (car next-error) fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417 (if (null buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418 ;; We can't find this error's file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1419 ;; Remove all errors in the same file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1420 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1421 (setq next-errors compilation-old-error-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1422 (while next-errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1423 (and (consp (cdr (car next-errors)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1424 (equal (car (cdr (car next-errors)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1425 fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1426 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1427 (set-marker (car (car next-errors)) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1428 (setcdr (car next-errors) nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1429 (setq next-errors (cdr next-errors)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1430 ;; Look for the next error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432 ;; We found the file. Get a marker for this error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1433 ;; compilation-old-error-list is a buffer-local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1434 ;; variable, so we must be careful to extract its value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435 ;; before switching to the source file buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436 (let ((errors compilation-old-error-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1437 (last-line (nth 1 (cdr next-error)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438 (column (nth 2 (cdr next-error))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1439 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1441 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1443 (goto-line last-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1444 (if (and column (> column 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1445 ;; Columns in error msgs are 1-origin.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446 (move-to-column (1- column))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1447 (beginning-of-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1448 (setcdr next-error (point-marker))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1449 ;; Make all the other error messages referring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1450 ;; to the same file have markers into the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451 (while errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1452 (and (consp (cdr (car errors)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1453 (equal (car (cdr (car errors))) fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1454 (let* ((this (nth 1 (cdr (car errors))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1455 (column (nth 2 (cdr (car errors))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456 (lines (- this last-line)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1457 (if (eq selective-display t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1458 ;; When selective-display is t,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1459 ;; each C-m is a line boundary,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1460 ;; as well as each newline.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1461 (if (< lines 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1462 (re-search-backward "[\n\C-m]"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1463 nil 'end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1464 (- lines))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1465 (re-search-forward "[\n\C-m]"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1466 nil 'end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1467 lines))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1468 (forward-line lines))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469 (if (and column (> column 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470 (move-to-column (1- column))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471 (beginning-of-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472 (setq last-line this)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473 (setcdr (car errors) (point-marker))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474 (setq errors (cdr errors)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1475 ;; XEmacs addition
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476 (set-buffer cbuf)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477 ;; If we didn't get a marker for this error, or this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1478 ;; marker's buffer was killed, go on to the next one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1479 (or (not (markerp (cdr next-error)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1480 (not (marker-buffer (cdr next-error))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481 (setq next-errors compilation-error-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482 next-error (car next-errors)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484 ;; XEmacs -- move this inside save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1485 ;; Skip over multiple error messages for the same source location,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1486 ;; so the next C-x ` won't go to an error in the same place.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1487 (while (and compilation-error-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1488 (equal (cdr (car compilation-error-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1489 (cdr next-error)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1490 (setq compilation-error-list (cdr compilation-error-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1493 ;; XEmacs change: If a new window has to be displayed, select the other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494 ;; window to avoid swapping the position of the compilation error buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1495 (and next-error (get-buffer-window (marker-buffer (car next-error)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1496 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1497 (select-window (get-buffer-window (marker-buffer (car next-error))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498 (other-window -1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1499
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500 ;; We now have a marker for the position of the error source code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1501 ;; NEXT-ERROR is a cons (ERROR . SOURCE) of two markers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502 next-error))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504 (defun compilation-goto-locus (next-error)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505 "Jump to an error locus returned by `compilation-next-error-locus'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1506 Takes one argument, a cons (ERROR . SOURCE) of two markers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1507 Selects a window with point at SOURCE, with another window displaying ERROR."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1508 ;; XEmacs: this code is horrendous, and makes windows do all sorts of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1509 ;; weird things when you're using separate frames for the compilation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1510 ;; and source buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1511 ; (if (and (window-dedicated-p (selected-window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1512 ; (eq (selected-window) (frame-root-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1513 ; (switch-to-buffer-other-frame (marker-buffer (cdr next-error)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1514 ; (switch-to-buffer (marker-buffer (cdr next-error))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1515 ; (goto-char (cdr next-error))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1516 ; ;; If narrowing got in the way of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1517 ; ;; going to the right place, widen.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1518 ; (or (= (point) (marker-position (cdr next-error)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1519 ; (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1520 ; (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1521 ; (goto-char (cdr next-error))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1522 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1523 ; ;; Show compilation buffer in other window, scrolled to this error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1524 ; (let* ((pop-up-windows t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1525 ; (w (or (get-buffer-window (marker-buffer (car next-error)) 'visible)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1526 ; (display-buffer (marker-buffer (car next-error))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1527 ; (set-window-point w (car next-error))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1528 ; (set-window-start w (car next-error))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1529 ; (compilation-set-window-height w)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1530
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1531 (let* ((pop-up-windows t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1532 (compilation-buffer (marker-buffer (car next-error)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1533 (source-buffer (marker-buffer (cdr next-error)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1534 ;; make sure compilation buffer is visible ...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1535 (compilation-window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1536 ;; Use an existing window if it is in a visible frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1537 (or (get-buffer-window compilation-buffer 'visible)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1538 ;; Pop up a window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1539 (display-buffer compilation-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1540
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1541 ;; now, make the compilation buffer **STAY WHERE IT IS** and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1542 ;; make sure the source buffer is visible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1543
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1544 (select-window compilation-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1545 (pop-to-buffer source-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1546
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1547 ;; now put things aright in the compilation window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1548 (set-window-point compilation-window (car next-error))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1549 (set-window-start compilation-window (car next-error))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1550 (compilation-set-window-height compilation-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1551
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1552 ;; now put things aright in the source window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1553
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1554 (set-buffer source-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1555 (goto-char (cdr next-error))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1556 ;; If narrowing got in the way of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1557 ;; going to the right place, widen.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1558 (or (= (point) (marker-position (cdr next-error)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1559 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1560 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1561 (goto-char (cdr next-error))))))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1562
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1563
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1564 ;; Find a buffer for file FILENAME.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1565 ;; Search the directories in compilation-search-path.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1566 ;; A nil in compilation-search-path means to try the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1567 ;; current directory, which is passed in DIR.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1568 ;; If FILENAME is not found at all, ask the user where to find it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1569 ;; Pop up the buffer containing MARKER and scroll to MARKER if we ask the user.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1570 (defun compilation-find-file (marker filename dir &rest formats)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1571 (or formats (setq formats '("%s")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1572 (let ((dirs compilation-search-path)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1573 buffer thisdir fmts name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1574 (if (file-name-absolute-p filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1575 ;; The file name is absolute. Use its explicit directory as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1576 ;; the first in the search path, and strip it from FILENAME.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1577 (setq filename (abbreviate-file-name (expand-file-name filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1578 dirs (cons (file-name-directory filename) dirs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1579 filename (file-name-nondirectory filename)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1580 ;; Now search the path.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1581 (while (and dirs (null buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1582 (setq thisdir (or (car dirs) dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1583 fmts formats)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1584 ;; For each directory, try each format string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1585 (while (and fmts (null buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1586 (setq name (expand-file-name (format (car fmts) filename) thisdir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1587 buffer (and (file-exists-p name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1588 (find-file-noselect name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1589 fmts (cdr fmts)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1590 (setq dirs (cdr dirs)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1591 (or buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1592 ;; The file doesn't exist.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1593 ;; Ask the user where to find it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1594 ;; If he hits C-g, then the next time he does
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1595 ;; next-error, he'll skip past it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1596 (let* ((pop-up-windows t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1597 (w (display-buffer (marker-buffer marker))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1598 (set-window-point w marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1599 (set-window-start w marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1600 (let ((name (expand-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1601 (read-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1602 (format "Find this error in: (default %s) "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1603 filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1604 dir filename t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1605 (if (file-directory-p name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1606 (setq name (expand-file-name filename name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1607 (and (file-exists-p name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1608 (find-file-noselect name)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1609
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1610 ;; Set compilation-error-list to nil, and unchain the markers that point to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1611 ;; error messages and their text, so that they no longer slow down gap motion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1612 ;; This would happen anyway at the next garbage collection, but it is better to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1613 ;; do it right away.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1614 (defun compilation-forget-errors ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1615 (while compilation-old-error-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1616 (let ((next-error (car compilation-old-error-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1617 (set-marker (car next-error) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1618 (if (markerp (cdr next-error))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1619 (set-marker (cdr next-error) nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1620 (setq compilation-old-error-list (cdr compilation-old-error-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1621 (setq compilation-error-list nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1622 compilation-directory-stack nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1623 compilation-parsing-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1624
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1625
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1626 (defun count-regexp-groupings (regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1627 "Return the number of \\( ... \\) groupings in REGEXP (a string)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1628 (let ((groupings 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1629 (len (length regexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1630 (i 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1631 c)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1632 (while (< i len)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1633 (setq c (aref regexp i)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1634 i (1+ i))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1635 (cond ((= c ?\[)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1636 ;; Find the end of this [...].
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1637 (while (and (< i len)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1638 (not (= (aref regexp i) ?\])))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1639 (setq i (1+ i))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1640 ((= c ?\\)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1641 (if (< i len)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1642 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1643 (setq c (aref regexp i)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1644 i (1+ i))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1645 (if (= c ?\))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1646 ;; We found the end of a grouping,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1647 ;; so bump our counter.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1648 (setq groupings (1+ groupings))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1649 groupings))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1650
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1651 (defun compilation-parse-errors (limit-search find-at-least)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1652 "Parse the current buffer as grep, cc or lint error messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1653 See variable `compilation-parse-errors-function' for the interface it uses."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1654 (setq compilation-error-list nil)
193
f53b5ca2e663 Import from CVS: tag r20-3b23
cvs
parents: 189
diff changeset
1655 (display-message 'progress "Parsing error messages...")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1656 (let (;;text-buffer -- unused
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1657 orig orig-expanded parent-expanded
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1658 regexp enter-group leave-group error-group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1659 alist subexpr error-regexp-groups
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1660 (found-desired nil)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
1661 (compilation-num-errors-found 0)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
1662 (message-freq (max 1 (/ (count-lines (point-min) (point-max)) 50))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1663
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1664 ;; Don't reparse messages already seen at last parse.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1665 (goto-char compilation-parsing-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1666 ;; Don't parse the first two lines as error messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1667 ;; This matters for grep.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1668 (if (bobp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1669 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1670 (forward-line 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1671 ;; Move back so point is before the newline.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1672 ;; This matters because some error regexps use \n instead of ^
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1673 ;; to be faster.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1674 (forward-char -1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1675
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1676 ;; Compile all the regexps we want to search for into one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1677 (setq regexp (concat "\\(" compilation-enter-directory-regexp "\\)\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1678 "\\(" compilation-leave-directory-regexp "\\)\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1679 "\\(" (mapconcat (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1680 (lambda (elt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1681 (concat "\\(" (car elt) "\\)")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1682 compilation-error-regexp-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1683 "\\|") "\\)"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1684
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1685 ;; Find out how many \(...\) groupings are in each of the regexps, and set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1686 ;; *-GROUP to the grouping containing each constituent regexp (whose
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1687 ;; subgroups will come immediately thereafter) of the big regexp we have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1688 ;; just constructed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1689 (setq enter-group 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1690 leave-group (+ enter-group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1691 (count-regexp-groupings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1692 compilation-enter-directory-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1693 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1694 error-group (+ leave-group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1695 (count-regexp-groupings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1696 compilation-leave-directory-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1697 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1698
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1699 ;; Compile an alist (IDX FILE LINE [COL]), where IDX is the number of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1700 ;; the subexpression for an entire error-regexp, and FILE and LINE (and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1701 ;; possibly COL) are the numbers for the subexpressions giving the file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1702 ;; name and line number (and possibly column number).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1703 (setq alist (or compilation-error-regexp-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1704 (error "compilation-error-regexp-alist is empty!"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1705 subexpr (1+ error-group))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1706 (while alist
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1707 (setq error-regexp-groups
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1708 (cons (list subexpr
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1709 (+ subexpr (nth 1 (car alist)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1710 (+ subexpr (nth 2 (car alist)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1711 ;;#### This is buggy in FSFmacs
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1712 (let ((col (nth 3 (car alist))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1713 (and col
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1714 (+ subexpr col))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1715 error-regexp-groups))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1716 (setq subexpr (+ subexpr 1 (count-regexp-groupings (car (car alist)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1717 (setq alist (cdr alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1718
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1719 ;; Set up now the expanded, abbreviated directory variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1720 ;; that compile-abbreviate-directory will need, so we can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1721 ;; compute them just once here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1722 (setq orig (abbreviate-file-name default-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1723 orig-expanded (abbreviate-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1724 (file-truename default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1725 parent-expanded (abbreviate-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1726 (expand-file-name "../" orig-expanded)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1727
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1728 (while (and (not found-desired)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1729 ;; We don't just pass LIMIT-SEARCH to re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1730 ;; because we want to find matches containing LIMIT-SEARCH
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1731 ;; but which extend past it.
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
1732 ;; Instead of using re-search-forward,
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
1733 ;; we use this loop which tries only at each line.
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
1734 (progn
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
1735 (while (and (not (eobp))
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
1736 (not (looking-at regexp)))
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
1737 (forward-line 1))
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
1738 (not (eobp))))
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
1739
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
1740 ;; Move to the end of the match we just found.
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 82
diff changeset
1741 (goto-char (match-end 0))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1742
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1743 ;; Figure out which constituent regexp matched.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1744 (cond ((match-beginning enter-group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1745 ;; The match was the enter-directory regexp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1746 (let ((dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1747 (file-name-as-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1748 (expand-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1749 (buffer-substring (match-beginning (+ enter-group 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1750 (match-end (+ enter-group 1)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1751 ;; The directory name in the "entering" message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1752 ;; is a truename. Try to convert it to a form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1753 ;; like what the user typed in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1754 (setq dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1755 (compile-abbreviate-directory dir orig orig-expanded
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1756 parent-expanded))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1757 (setq compilation-directory-stack
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1758 (cons dir compilation-directory-stack))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1759 (and (file-directory-p dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1760 (setq default-directory dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1761
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1762 (and limit-search (>= (point) limit-search)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1763 ;; The user wanted a specific error, and we're past it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1764 ;; We do this check here (and in the leave-group case)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1765 ;; rather than at the end of the loop because if the last
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1766 ;; thing seen is an error message, we must carefully
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1767 ;; discard the last error when it is the first in a new
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1768 ;; file (see below in the error-group case).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1769 (setq found-desired t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1770
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1771 ((match-beginning leave-group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1772 ;; The match was the leave-directory regexp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1773 (let ((beg (match-beginning (+ leave-group 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1774 (stack compilation-directory-stack))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1775 (if beg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1776 (let ((dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1777 (file-name-as-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1778 (expand-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1779 (buffer-substring beg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1780 (match-end (+ leave-group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1781 1)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1782 ;; The directory name in the "leaving" message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1783 ;; is a truename. Try to convert it to a form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1784 ;; like what the user typed in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1785 (setq dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1786 (compile-abbreviate-directory dir orig orig-expanded
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1787 parent-expanded))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1788 (while (and stack
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1789 (not (string-equal (car stack) dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1790 (setq stack (cdr stack)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1791 (setq compilation-directory-stack (cdr stack))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1792 (setq stack (car compilation-directory-stack))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1793 (if stack
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1794 (setq default-directory stack))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1795 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1796
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1797 (and limit-search (>= (point) limit-search)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1798 ;; The user wanted a specific error, and we're past it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1799 ;; We do this check here (and in the enter-group case)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1800 ;; rather than at the end of the loop because if the last
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1801 ;; thing seen is an error message, we must carefully
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1802 ;; discard the last error when it is the first in a new
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1803 ;; file (see below in the error-group case).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1804 (setq found-desired t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1805
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1806 ((match-beginning error-group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1807 ;; The match was the composite error regexp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1808 ;; Find out which individual regexp matched.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1809 (setq alist error-regexp-groups)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1810 (while (and alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1811 (null (match-beginning (car (car alist)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1812 (setq alist (cdr alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1813 (if alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1814 (setq alist (car alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1815 (error "compilation-parse-errors: impossible regexp match!"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1816
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1817 ;; Extract the file name and line number from the error message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1818 (let ((beginning-of-match (match-beginning 0)) ;looking-at nukes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1819 (filename (buffer-substring (match-beginning (nth 1 alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1820 (match-end (nth 1 alist))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1821 (linenum (string-to-int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1822 (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1823 (match-beginning (nth 2 alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1824 (match-end (nth 2 alist)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1825 (column (and (nth 3 alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1826 (match-beginning (nth 3 alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1827 (string-to-int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1828 (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1829 (match-beginning (nth 3 alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1830 (match-end (nth 3 alist)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1831
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1832 ;; Check for a comint-file-name-prefix and prepend it if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1833 ;; appropriate. (This is very useful for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1834 ;; compilation-minor-mode in an rlogin-mode buffer.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1835 (and (boundp 'comint-file-name-prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1836 ;; If the file name is relative, default-directory will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1837 ;; already contain the comint-file-name-prefix (done by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1838 ;; compile-abbreviate-directory).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1839 (file-name-absolute-p filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1840 (setq filename (concat comint-file-name-prefix filename)))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1841
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1842 ;; Some compilers (e.g. Sun's java compiler, reportedly)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1843 ;; produce bogus file names like "./bar//foo.c" for the file
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1844 ;; "bar/foo.c"; expand-file-name will collapse these into
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1845 ;; "/foo.c" and fail to find the appropriate file. So we look
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1846 ;; for doubled slashes in the file name and fix them up in the
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1847 ;; buffer.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1848 (when (fboundp 'command-line-normalize-file-name)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1849 (setq filename (command-line-normalize-file-name filename)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1850 (setq filename (cons filename (cons default-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1851 (nthcdr 4 alist))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1852
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1853
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1854 ;; Locate the erring file and line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1855 ;; Cons a new elt onto compilation-error-list,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1856 ;; giving a marker for the current compilation buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1857 ;; location, and the file and line number of the error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1858 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1859 ;; Save as the start of the error the beginning of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1860 ;; line containing the match unless the match starts at a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1861 ;; newline, in which case the beginning of the next line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1862 (goto-char beginning-of-match)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1863 (forward-line (if (eolp) 1 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1864 (let ((this (cons (point-marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1865 (list filename linenum column))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1866 ;; Don't add the same source line more than once.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1867 (if (equal (cdr this) (cdr (car compilation-error-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1868 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1869 (setq compilation-error-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1870 (cons this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1871 compilation-error-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1872 (setq compilation-num-errors-found
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1873 (1+ compilation-num-errors-found)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1874 (and (or (and find-at-least (> compilation-num-errors-found
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1875 find-at-least))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1876 (and limit-search (>= (point) limit-search)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1877 ;; We have found as many new errors as the user wants,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1878 ;; or past the buffer position he indicated. We
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1879 ;; continue to parse until we have seen all the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1880 ;; consecutive errors in the same file, so the error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1881 ;; positions will be recorded as markers in this buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1882 ;; that might change.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1883 (cdr compilation-error-list) ; Must check at least two.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1884 (not (equal (car (cdr (nth 0 compilation-error-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1885 (car (cdr (nth 1 compilation-error-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1886 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1887 ;; Discard the error just parsed, so that the next
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1888 ;; parsing run can get it and the following errors in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1889 ;; the same file all at once. If we didn't do this, we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1890 ;; would have the same problem we are trying to avoid
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1891 ;; with the test above, just delayed until the next run!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1892 (setq compilation-error-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1893 (cdr compilation-error-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1894 (goto-char beginning-of-match)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1895 (setq found-desired t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1896 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1897 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1898 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1899 (error "compilation-parse-errors: known groups didn't match!")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1900
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
1901 (when (= (% compilation-num-errors-found message-freq) 0)
193
f53b5ca2e663 Import from CVS: tag r20-3b23
cvs
parents: 189
diff changeset
1902 (display-message
f53b5ca2e663 Import from CVS: tag r20-3b23
cvs
parents: 189
diff changeset
1903 'progress
f53b5ca2e663 Import from CVS: tag r20-3b23
cvs
parents: 189
diff changeset
1904 (format "Parsing error messages...%d (%.0f%% of buffer)"
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
1905 compilation-num-errors-found
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
1906 ;; Use floating-point because (* 100 (point)) frequently
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
1907 ;; exceeds the range of Emacs Lisp integers.
193
f53b5ca2e663 Import from CVS: tag r20-3b23
cvs
parents: 189
diff changeset
1908 (/ (* 100.0 (point)) (point-max)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1909
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
1910 ;;; This is broken - it foils the logic above which is supposed to ensure
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
1911 ;;; that all errors for the current file are found before we quit.
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
1912 ; (and limit-search (>= (point) limit-search)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
1913 ; ;; The user wanted a specific error, and we're past it.
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
1914 ; (setq found-desired t))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 88
diff changeset
1915 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1916 (setq compilation-parsing-end (if found-desired
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1917 (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1918 ;; We have searched the whole buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1919 (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1920 (setq compilation-error-list (nreverse compilation-error-list))
193
f53b5ca2e663 Import from CVS: tag r20-3b23
cvs
parents: 189
diff changeset
1921 (display-message 'progress "Parsing error messages...done"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1922
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1923 ;; If directory DIR is a subdir of ORIG or of ORIG's parent,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1924 ;; return a relative name for it starting from ORIG or its parent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1925 ;; ORIG-EXPANDED is an expanded version of ORIG.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1926 ;; PARENT-EXPANDED is an expanded version of ORIG's parent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1927 ;; Those two args could be computed here, but we run faster by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1928 ;; having the caller compute them just once.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1929 (defun compile-abbreviate-directory (dir orig orig-expanded parent-expanded)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1930 ;; Apply canonical abbreviations to DIR first thing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1931 ;; Those abbreviations are already done in the other arguments passed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1932 (setq dir (abbreviate-file-name dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1933
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1934 ;; Check for a comint-file-name-prefix and prepend it if appropriate.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1935 ;; (This is very useful for compilation-minor-mode in an rlogin-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1936 ;; buffer.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1937 (if (boundp 'comint-file-name-prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1938 (setq dir (concat comint-file-name-prefix dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1939
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1940 (if (and (> (length dir) (length orig-expanded))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1941 (string= orig-expanded
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1942 (substring dir 0 (length orig-expanded))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1943 (setq dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1944 (concat orig
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1945 (substring dir (length orig-expanded)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1946 (if (and (> (length dir) (length parent-expanded))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1947 (string= parent-expanded
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1948 (substring dir 0 (length parent-expanded))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1949 (setq dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1950 (concat (file-name-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1951 (directory-file-name orig))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1952 (substring dir (length parent-expanded)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1953 dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1954
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1955 (provide 'compile)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1956
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1957 ;;; compile.el ends here