diff options
| author | Roland McGrath | 1995-03-06 15:51:22 +0000 |
|---|---|---|
| committer | Roland McGrath | 1995-03-06 15:51:22 +0000 |
| commit | 20c1daecbc0dc4a0cc26fb38120c5e517dc46503 (patch) | |
| tree | 6aa6ecb64937ea3bed7327129135d9058c979bb2 | |
| parent | 70743ff1170222cecf36bb5533853ace0526635e (diff) | |
| download | emacs-20c1daecbc0dc4a0cc26fb38120c5e517dc46503.tar.gz emacs-20c1daecbc0dc4a0cc26fb38120c5e517dc46503.zip | |
(compilation-buffer-p): Fix braino in last change: switch to the buffer first.
(compilation-error-regexp-alist): Doc fix: optional cdrs give
string containing %s to produce the file name from the matched text.
(compilation-find-file): Reorder args: MARKER first, then FILENAME, DIR,
and new arg &rest FORMATS (as they appear in parsed the fileinfo lists).
Try each of the FORMATS in each directory tried.
(compilation-next-error-locus): Apply compilation-find-file to the FILEINFO
list.
(compilation-parse-errors): Instead of a cons (DIR . FILE), make a list
(FILE DIR [FORMATS...]) using the 4th cdr of the matching elt of
regexp-alist.
| -rw-r--r-- | lisp/progmodes/compile.el | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 3d879313d05..c6c14bd60be 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el | |||
| @@ -184,10 +184,13 @@ of[ \t]+\"?\\([^\":\n]+\\)\"?:" 3 2) | |||
| 184 | ("ning [0-9]+: \\([^,\" \n\t]+\\)[,:] \\(line \\)?\\([0-9]+\\):" 1 3) | 184 | ("ning [0-9]+: \\([^,\" \n\t]+\\)[,:] \\(line \\)?\\([0-9]+\\):" 1 3) |
| 185 | ) | 185 | ) |
| 186 | "Alist that specifies how to match errors in compiler output. | 186 | "Alist that specifies how to match errors in compiler output. |
| 187 | Each element has the form (REGEXP FILE-IDX LINE-IDX [COLUMN-IDX]). | 187 | Each elt has the form (REGEXP FILE-IDX LINE-IDX [COLUMN-IDX FILE-FORMAT...]) |
| 188 | If REGEXP matches, the FILE-IDX'th subexpression gives the file name, and | 188 | If REGEXP matches, the FILE-IDX'th subexpression gives the file name, and |
| 189 | the LINE-IDX'th subexpression gives the line number. If COLUMN-IDX is | 189 | the LINE-IDX'th subexpression gives the line number. If COLUMN-IDX is |
| 190 | given, the COLUMN-IDX'th subexpression gives the column number on that line.") | 190 | given, the COLUMN-IDX'th subexpression gives the column number on that line. |
| 191 | If any FILE-FORMAT is given, each is a format string to produce a file name to | ||
| 192 | try; %s in the string is replaced by the text matching the FILE-IDX'th | ||
| 193 | subexpression.") | ||
| 191 | 194 | ||
| 192 | (defvar compilation-read-command t | 195 | (defvar compilation-read-command t |
| 193 | "If not nil, M-x compile reads the compilation command to use. | 196 | "If not nil, M-x compile reads the compilation command to use. |
| @@ -586,7 +589,9 @@ Just inserts the text, but uses `insert-before-markers'." | |||
| 586 | errors)) | 589 | errors)) |
| 587 | 590 | ||
| 588 | (defsubst compilation-buffer-p (buffer) | 591 | (defsubst compilation-buffer-p (buffer) |
| 589 | (or compilation-minor-mode (eq major-mode 'compilation-mode))) | 592 | (save-excursion |
| 593 | (set-buffer buffer) | ||
| 594 | (or compilation-minor-mode (eq major-mode 'compilation-mode)))) | ||
| 590 | 595 | ||
| 591 | (defun compilation-next-error (n) | 596 | (defun compilation-next-error (n) |
| 592 | "Move point to the next error in the compilation buffer. | 597 | "Move point to the next error in the compilation buffer. |
| @@ -971,9 +976,8 @@ The current buffer should be the desired compilation output buffer." | |||
| 971 | ;; This error has a filename/lineno pair. | 976 | ;; This error has a filename/lineno pair. |
| 972 | ;; Find the file and turn it into a marker. | 977 | ;; Find the file and turn it into a marker. |
| 973 | (let* ((fileinfo (car (cdr next-error))) | 978 | (let* ((fileinfo (car (cdr next-error))) |
| 974 | (buffer (compilation-find-file (cdr fileinfo) | 979 | (buffer (apply 'compilation-find-file |
| 975 | (car fileinfo) | 980 | (car next-error) fileinfo))) |
| 976 | (car next-error)))) | ||
| 977 | (if (null buffer) | 981 | (if (null buffer) |
| 978 | ;; We can't find this error's file. | 982 | ;; We can't find this error's file. |
| 979 | ;; Remove all errors in the same file. | 983 | ;; Remove all errors in the same file. |
| @@ -1078,14 +1082,19 @@ Selects a window with point at SOURCE, with another window displaying ERROR." | |||
| 1078 | ;; current directory, which is passed in DIR. | 1082 | ;; current directory, which is passed in DIR. |
| 1079 | ;; If FILENAME is not found at all, ask the user where to find it. | 1083 | ;; If FILENAME is not found at all, ask the user where to find it. |
| 1080 | ;; Pop up the buffer containing MARKER and scroll to MARKER if we ask the user. | 1084 | ;; Pop up the buffer containing MARKER and scroll to MARKER if we ask the user. |
| 1081 | (defun compilation-find-file (filename dir marker) | 1085 | (defun compilation-find-file (marker filename dir &rest formats) |
| 1086 | (or formats (setq formats '("%s"))) | ||
| 1082 | (let ((dirs compilation-search-path) | 1087 | (let ((dirs compilation-search-path) |
| 1083 | result name) | 1088 | result thisdir fmts name) |
| 1084 | (while (and dirs (null result)) | 1089 | (while (and dirs (null result)) |
| 1085 | (setq name (expand-file-name filename (or (car dirs) dir)) | 1090 | (setq thisdir (or (car dirs) dir) |
| 1086 | result (and (file-exists-p name) | 1091 | fmts formats) |
| 1087 | (find-file-noselect name)) | 1092 | (while (and fmts (null result)) |
| 1088 | dirs (cdr dirs))) | 1093 | (setq name (expand-file-name (format (car fmts) filename) thisdir) |
| 1094 | result (and (file-exists-p name) | ||
| 1095 | (find-file-noselect name)) | ||
| 1096 | fmts (cdr fmts))) | ||
| 1097 | (setq dirs (cdr dirs))) | ||
| 1089 | (or result | 1098 | (or result |
| 1090 | ;; The file doesn't exist. | 1099 | ;; The file doesn't exist. |
| 1091 | ;; Ask the user where to find it. | 1100 | ;; Ask the user where to find it. |
| @@ -1319,7 +1328,9 @@ See variable `compilation-parse-errors-function' for the interface it uses." | |||
| 1319 | ;; compile-abbreviate-directory). | 1328 | ;; compile-abbreviate-directory). |
| 1320 | (file-name-absolute-p filename) | 1329 | (file-name-absolute-p filename) |
| 1321 | (setq filename (concat comint-file-name-prefix filename))) | 1330 | (setq filename (concat comint-file-name-prefix filename))) |
| 1322 | (setq filename (cons default-directory filename)) | 1331 | (setq filename (cons filename (cons default-directory |
| 1332 | (nthcdr 4 alist)))) | ||
| 1333 | |||
| 1323 | 1334 | ||
| 1324 | ;; Locate the erring file and line. | 1335 | ;; Locate the erring file and line. |
| 1325 | ;; Cons a new elt onto compilation-error-list, | 1336 | ;; Cons a new elt onto compilation-error-list, |