Mercurial > emacs
comparison lisp/progmodes/compile.el @ 1133:f36b965cfeb0
entered into RCS
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 14 Sep 1992 01:33:12 +0000 |
parents | 8e0a8faed93a |
children | 539564299c1f |
comparison
equal
deleted
inserted
replaced
1132:4cfdd782a158 | 1133:f36b965cfeb0 |
---|---|
57 `compilation-error-list' to a list with an element for each error message | 57 `compilation-error-list' to a list with an element for each error message |
58 found. See that variable for more info.") | 58 found. See that variable for more info.") |
59 | 59 |
60 ;;;###autoload | 60 ;;;###autoload |
61 (defvar compilation-buffer-name-function nil | 61 (defvar compilation-buffer-name-function nil |
62 "*Function to call with one argument, the name of the major mode of the | 62 "Function to compute the name of a compilation buffer. |
63 compilation buffer, to give the buffer a name. It should return a string. | 63 The function receives one argument, the name of the major mode of the |
64 If nil, the name \"*compilation*\" is used for compilation buffers, | 64 compilation buffer. It should return a string. |
65 and the name \"*grep*\" is used for grep buffers. | 65 nil means compute the name with `(concat \"*\" (downcase major-mode) \"*\")'.") |
66 \(Actually, the name (concat \"*\" (downcase major-mode) \"*\") is used.)") | |
67 | 66 |
68 ;;;###autoload | 67 ;;;###autoload |
69 (defvar compilation-finish-function nil | 68 (defvar compilation-finish-function nil |
70 "*Function to call when a compilation process finishes. | 69 "*Function to call when a compilation process finishes. |
71 It is called with two arguments: the compilation buffer, and a string | 70 It is called with two arguments: the compilation buffer, and a string |
72 describing how the process finished.") | 71 describing how the process finished.") |
73 | 72 |
74 (defvar compilation-last-buffer nil | 73 (defvar compilation-last-buffer nil |
75 "The buffer in which the last compilation was started, | 74 "The most recent compilation buffer. |
76 or which was used by the last \\[next-error] or \\[compile-goto-error].") | 75 A buffer becomes most recent when its compilation is started |
76 or when it is used with \\[next-error] or \\[compile-goto-error].") | |
77 | 77 |
78 (defvar compilation-in-progress nil | 78 (defvar compilation-in-progress nil |
79 "List of compilation processes now running.") | 79 "List of compilation processes now running.") |
80 (or (assq 'compilation-in-progress minor-mode-alist) | 80 (or (assq 'compilation-in-progress minor-mode-alist) |
81 (setq minor-mode-alist (cons '(compilation-in-progress " Compiling") | 81 (setq minor-mode-alist (cons '(compilation-in-progress " Compiling") |
83 | 83 |
84 (defvar compilation-parsing-end nil | 84 (defvar compilation-parsing-end nil |
85 "Position of end of buffer when last error messages were parsed.") | 85 "Position of end of buffer when last error messages were parsed.") |
86 | 86 |
87 (defvar compilation-error-message "No more errors" | 87 (defvar compilation-error-message "No more errors" |
88 "Message to print when no more matches for `compilation-error-regexp-alist' | 88 "Message to print when no more matches are found.") |
89 are found.") | 89 |
90 (defvar compilation-num-errors-found) | |
90 | 91 |
91 (defvar compilation-error-regexp-alist | 92 (defvar compilation-error-regexp-alist |
92 '( | 93 '( |
93 ;; NOTE! This first one is repeated in grep-regexp-alist, below. | 94 ;; NOTE! This first one is repeated in grep-regexp-alist, below. |
94 ;; 4.3BSD grep, cc, lint pass 1: | 95 ;; 4.3BSD grep, cc, lint pass 1: |
117 ;; ****** Error number 140 in line 8 of file errors.c ****** | 118 ;; ****** Error number 140 in line 8 of file errors.c ****** |
118 ("in line \\([0-9]+\\) of file \\([^ \n]+[^. \n]\\)\\.? " 2 1) | 119 ("in line \\([0-9]+\\) of file \\([^ \n]+[^. \n]\\)\\.? " 2 1) |
119 ;; IBM AIX lint is too painful to do right this way. File name | 120 ;; IBM AIX lint is too painful to do right this way. File name |
120 ;; prefixes entire sections rather than being on each line. | 121 ;; prefixes entire sections rather than being on each line. |
121 ) | 122 ) |
122 "Alist (REGEXP FILE-IDX LINE-IDX) of regular expressions to match errors in | 123 "Alist that specifies how to match errors in compiler output. |
123 compilation. If REGEXP matches, the FILE-IDX'th subexpression gives the file | 124 Each element has the form (REGEXP FILE-IDX LINE-IDX). |
125 If REGEXP matches, the FILE-IDX'th subexpression gives the file | |
124 name, and the LINE-IDX'th subexpression gives the line number.") | 126 name, and the LINE-IDX'th subexpression gives the line number.") |
125 | 127 |
126 (defvar grep-regexp-alist | 128 (defvar grep-regexp-alist |
127 '(("^\\([^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]" 1 2)) | 129 '(("^\\([^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]" 1 2)) |
128 "Regexp used to match grep hits. See `compilation-error-regexp-alist'.") | 130 "Regexp used to match grep hits. See `compilation-error-regexp-alist'.") |
146 (concat \"make -k \" | 148 (concat \"make -k \" |
147 buffer-file-name))))))") | 149 buffer-file-name))))))") |
148 | 150 |
149 (defconst compilation-enter-directory-regexp | 151 (defconst compilation-enter-directory-regexp |
150 ": Entering directory `\\(.*\\)'$" | 152 ": Entering directory `\\(.*\\)'$" |
151 "Regular expression for a line in the compilation log that | 153 "Regular expression matching lines that indicate a new current directory. |
152 changes the current directory. This must contain one \\(, \\) pair | 154 This must contain one \\(, \\) pair around the directory name. |
153 around the directory name. | |
154 | 155 |
155 The default value matches lines printed by the `-w' option of GNU Make.") | 156 The default value matches lines printed by the `-w' option of GNU Make.") |
156 | 157 |
157 (defconst compilation-leave-directory-regexp | 158 (defconst compilation-leave-directory-regexp |
158 ": Leaving directory `\\(.*\\)'$" | 159 ": Leaving directory `\\(.*\\)'$" |
159 "Regular expression for a line in the compilation log that | 160 "Regular expression matching lines that indicate restoring current directory. |
160 changes the current directory to a previous value. This may | 161 This may contain one \\(, \\) pair around the name of the directory |
161 contain one \\(, \\) pair around the name of the directory | 162 being moved from. If it does not, the last directory entered \(by a |
162 being moved from. If it does not, the last directory entered | 163 line matching `compilation-enter-directory-regexp'\) is assumed. |
163 \(by a line matching `compilation-enter-directory-regexp'\) is assumed. | |
164 | 164 |
165 The default value matches lines printed by the `-w' option of GNU Make.") | 165 The default value matches lines printed by the `-w' option of GNU Make.") |
166 | 166 |
167 (defvar compilation-directory-stack nil | 167 (defvar compilation-directory-stack nil |
168 "Stack of directories entered by lines matching | 168 "Stack of previous directories for `compilation-leave-directory-regexp'. |
169 \`compilation-enter-directory-regexp' and not yet left by lines matching | 169 The head element is the directory the compilation was started in.") |
170 \`compilation-leave-directory-regexp'. The head element is the directory | |
171 the compilation was started in.") | |
172 | 170 |
173 ;; History of compile commands. | 171 ;; History of compile commands. |
174 (defvar compile-history nil) | 172 (defvar compile-history nil) |
175 ;; History of grep commands. | 173 ;; History of grep commands. |
176 (defvar grep-history nil) | 174 (defvar grep-history nil) |
380 (delete-process proc) | 378 (delete-process proc) |
381 ;; Force mode line redisplay soon. | 379 ;; Force mode line redisplay soon. |
382 (set-buffer-modified-p (buffer-modified-p)) | 380 (set-buffer-modified-p (buffer-modified-p)) |
383 (setq buffer-read-only t) ;I think is this wrong --roland | 381 (setq buffer-read-only t) ;I think is this wrong --roland |
384 (if (and opoint (< opoint omax)) | 382 (if (and opoint (< opoint omax)) |
385 (goto-char opoint))) | 383 (goto-char opoint)) |
386 (set-buffer obuf)) | 384 (if compilation-finish-function |
387 (if compilation-finish-function | 385 (funcall compilation-finish-function buffer msg))) |
388 (funcall compilation-finish-function buffer msg)) | 386 (set-buffer obuf)))) |
389 )) | |
390 (setq compilation-in-progress (delq proc compilation-in-progress)) | 387 (setq compilation-in-progress (delq proc compilation-in-progress)) |
391 )))) | 388 )))) |
392 | |
393 | 389 |
394 ;; Return the cdr of compilation-old-error-list for the error containing point. | 390 ;; Return the cdr of compilation-old-error-list for the error containing point. |
395 (defun compile-error-at-point () | 391 (defun compile-error-at-point () |
396 (compile-reinitialize-errors nil (point)) | 392 (compile-reinitialize-errors nil (point)) |
397 (let ((errors compilation-old-error-list)) | 393 (let ((errors compilation-old-error-list)) |
827 (message "Parsing error messages...") | 823 (message "Parsing error messages...") |
828 (let (text-buffer | 824 (let (text-buffer |
829 regexp enter-group leave-group error-group | 825 regexp enter-group leave-group error-group |
830 alist subexpr error-regexp-groups | 826 alist subexpr error-regexp-groups |
831 (found-desired nil) | 827 (found-desired nil) |
832 (nfound 0)) | 828 (compilation-num-errors-found 0)) |
833 | 829 |
834 ;; Don't reparse messages already seen at last parse. | 830 ;; Don't reparse messages already seen at last parse. |
835 (goto-char compilation-parsing-end) | 831 (goto-char compilation-parsing-end) |
836 ;; Don't parse the first two lines as error messages. | 832 ;; Don't parse the first two lines as error messages. |
837 ;; This matters for grep. | 833 ;; This matters for grep. |
944 (beginning-of-line 1) | 940 (beginning-of-line 1) |
945 (setq compilation-error-list | 941 (setq compilation-error-list |
946 (cons (cons (point-marker) | 942 (cons (cons (point-marker) |
947 (cons filename linenum)) | 943 (cons filename linenum)) |
948 compilation-error-list)))) | 944 compilation-error-list)))) |
949 (setq nfound (1+ nfound)) | 945 (setq compilation-num-errors-found (1+ compilation-num-errors-found)) |
950 (and find-at-least (>= nfound find-at-least) | 946 (and find-at-least (>= compilation-num-errors-found find-at-least) |
951 ;; We have found as many new errors as the user wants. | 947 ;; We have found as many new errors as the user wants. |
952 (setq found-desired t))) | 948 (setq found-desired t))) |
953 (t | 949 (t |
954 (error "compilation-parse-errors: impossible regexp match!"))) | 950 (error "compilation-parse-errors: impossible regexp match!"))) |
955 | 951 |
956 (message "Parsing error messages...%d (%d%% of buffer)" | 952 (message "Parsing error messages...%d (%d%% of buffer)" |
957 nfound | 953 compilation-num-errors-found |
958 (/ (* 100 (point)) (point-max))) | 954 (/ (* 100 (point)) (point-max))) |
959 | 955 |
960 (and limit-search (>= (point) limit-search) | 956 (and limit-search (>= (point) limit-search) |
961 ;; The user wanted a specific error, and we're past it. | 957 ;; The user wanted a specific error, and we're past it. |
962 (setq found-desired t))) | 958 (setq found-desired t))) |