aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/progmodes/compile.el66
1 files changed, 43 insertions, 23 deletions
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 684d741ae1f..2cff0b8772d 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -153,11 +153,16 @@ of[ \t]+\"?\\([^\"\n]+\\)\"?:" 3 2)
153 ;; IBM AIX lint is too painful to do right this way. File name 153 ;; IBM AIX lint is too painful to do right this way. File name
154 ;; prefixes entire sections rather than being on each line. 154 ;; prefixes entire sections rather than being on each line.
155 155
156 ;; Lucid Compiler, lcc 3.x
157 ;; E, file.cc(35,52) Illegal operation on pointers
158 ("[A-Z], \\([^(]*\\)(\\([0-9]+\\),[ \t]*\\([0-9]+\\)" 1 2 3)
159
156 ) 160 )
157 "Alist that specifies how to match errors in compiler output. 161 "Alist that specifies how to match errors in compiler output.
158Each element has the form (REGEXP FILE-IDX LINE-IDX). 162Each element has the form (REGEXP FILE-IDX LINE-IDX [COLUMN-IDX]).
159If REGEXP matches, the FILE-IDX'th subexpression gives the file 163If REGEXP matches, the FILE-IDX'th subexpression gives the file name, and
160name, and the LINE-IDX'th subexpression gives the line number.") 164the LINE-IDX'th subexpression gives the line number. If COLUMN-IDX is
165given, the COLUMN-IDX'th subexpression gives the column number on that line."
161 166
162(defvar compilation-read-command t 167(defvar compilation-read-command t
163 "If not nil, M-x compile reads the compilation command to use. 168 "If not nil, M-x compile reads the compilation command to use.
@@ -835,23 +840,29 @@ See variables `compilation-parse-errors-function' and
835 ;; variable, so we must be careful to extract its value 840 ;; variable, so we must be careful to extract its value
836 ;; before switching to the source file buffer. 841 ;; before switching to the source file buffer.
837 (let ((errors compilation-old-error-list) 842 (let ((errors compilation-old-error-list)
838 (last-line (cdr (cdr next-error)))) 843 (last-line (nth 1 (cdr next-error)))
844 (column (nth 2 (cdr next-error))))
839 (set-buffer buffer) 845 (set-buffer buffer)
840 (save-excursion 846 (save-excursion
841 (save-restriction 847 (save-restriction
842 (widen) 848 (widen)
843 (goto-line last-line) 849 (goto-line last-line)
844 (beginning-of-line) 850 (if column
851 (move-to-column column)
852 (beginning-of-line))
845 (setcdr next-error (point-marker)) 853 (setcdr next-error (point-marker))
846 ;; Make all the other error messages referring 854 ;; Make all the other error messages referring
847 ;; to the same file have markers into the buffer. 855 ;; to the same file have markers into the buffer.
848 (while errors 856 (while errors
849 (and (consp (cdr (car errors))) 857 (and (consp (cdr (car errors)))
850 (equal (car (cdr (car errors))) fileinfo) 858 (equal (car (cdr (car errors))) fileinfo)
851 (let ((this (cdr (cdr (car errors)))) 859 (let* ((this (nth 1 (cdr (car errors))))
852 (lines (- (cdr (cdr (car errors))) 860 (column (nth 2 (cdr (car errors))))
853 last-line))) 861 (lines (- this last-line)))
854 (if (eq selective-display t) 862 (if (eq selective-display t)
863 ;; When selective-display is t,
864 ;; each C-m is a line boundary,
865 ;; as well as each newline.
855 (if (< lines 0) 866 (if (< lines 0)
856 (re-search-backward "[\n\C-m]" 867 (re-search-backward "[\n\C-m]"
857 nil 'end 868 nil 'end
@@ -860,6 +871,8 @@ See variables `compilation-parse-errors-function' and
860 nil 'end 871 nil 'end
861 lines)) 872 lines))
862 (forward-line lines)) 873 (forward-line lines))
874 (if column
875 (move-to-column column))
863 (setq last-line this) 876 (setq last-line this)
864 (setcdr (car errors) (point-marker)))) 877 (setcdr (car errors) (point-marker))))
865 (setq errors (cdr errors))))))))) 878 (setq errors (cdr errors)))))))))
@@ -1014,17 +1027,21 @@ See variable `compilation-parse-errors-function' for the interface it uses."
1014 compilation-leave-directory-regexp) 1027 compilation-leave-directory-regexp)
1015 1)) 1028 1))
1016 1029
1017 ;; Compile an alist (IDX FILE LINE), where IDX is the number of the 1030 ;; Compile an alist (IDX FILE LINE [COL]), where IDX is the number of
1018 ;; subexpression for an entire error-regexp, and FILE and LINE are the 1031 ;; the subexpression for an entire error-regexp, and FILE and LINE (and
1019 ;; numbers for the subexpressions giving the file name and line number. 1032 ;; possibly COL) are the numbers for the subexpressions giving the file
1033 ;; name and line number (and possibly column number).
1020 (setq alist (or compilation-error-regexp-alist 1034 (setq alist (or compilation-error-regexp-alist
1021 (error "compilation-error-regexp-alist is empty!")) 1035 (error "compilation-error-regexp-alist is empty!"))
1022 subexpr (1+ error-group)) 1036 subexpr (1+ error-group))
1023 (while alist 1037 (while alist
1024 (setq error-regexp-groups (cons (list subexpr 1038 (setq error-regexp-groups
1025 (+ subexpr (nth 1 (car alist))) 1039 (cons (list subexpr
1026 (+ subexpr (nth 2 (car alist)))) 1040 (+ subexpr (nth 1 (car alist)))
1027 error-regexp-groups)) 1041 (+ subexpr (nth 2 (car alist)))
1042 (and (nth 2 (car alist))
1043 (+ subexpr (nth 2 (car alist)))))
1044 error-regexp-groups))
1028 (setq subexpr (+ subexpr 1 (count-regexp-groupings (car (car alist))))) 1045 (setq subexpr (+ subexpr 1 (count-regexp-groupings (car (car alist)))))
1029 (setq alist (cdr alist))) 1046 (setq alist (cdr alist)))
1030 1047
@@ -1116,13 +1133,16 @@ See variable `compilation-parse-errors-function' for the interface it uses."
1116 (let ((beginning-of-match (match-beginning 0)) ;looking-at nukes 1133 (let ((beginning-of-match (match-beginning 0)) ;looking-at nukes
1117 (filename (buffer-substring (match-beginning (nth 1 alist)) 1134 (filename (buffer-substring (match-beginning (nth 1 alist))
1118 (match-end (nth 1 alist)))) 1135 (match-end (nth 1 alist))))
1119 (linenum (save-restriction 1136 (linenum (string-to-int
1120 (narrow-to-region 1137 (buffer-substring
1121 (match-beginning (nth 2 alist)) 1138 (match-beginning (nth 2 alist))
1122 (match-end (nth 2 alist))) 1139 (match-end (nth 2 alist)))))
1123 (goto-char (point-min)) 1140 (column (and (nth 3 alist)
1124 (if (looking-at "[0-9]") 1141 (string-to-int
1125 (read (current-buffer)))))) 1142 (buffer-substring
1143 (match-beginning (nth 3 alist))
1144 (match-end (nth 3 alist)))))))
1145
1126 ;; Check for a comint-file-name-prefix and prepend it if 1146 ;; Check for a comint-file-name-prefix and prepend it if
1127 ;; appropriate. (This is very useful for 1147 ;; appropriate. (This is very useful for
1128 ;; compilation-minor-mode in an rlogin-mode buffer.) 1148 ;; compilation-minor-mode in an rlogin-mode buffer.)
@@ -1141,7 +1161,7 @@ See variable `compilation-parse-errors-function' for the interface it uses."
1141 (save-excursion 1161 (save-excursion
1142 (beginning-of-line 1) 1162 (beginning-of-line 1)
1143 (let ((this (cons (point-marker) 1163 (let ((this (cons (point-marker)
1144 (cons filename linenum)))) 1164 (cons filename linenum column))))
1145 ;; Don't add the same source line more than once. 1165 ;; Don't add the same source line more than once.
1146 (if (equal (cdr this) (cdr (car compilation-error-list))) 1166 (if (equal (cdr this) (cdr (car compilation-error-list)))
1147 nil 1167 nil