diff options
author | Richard M. Stallman <rms@gnu.org> | 1996-03-01 20:13:42 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1996-03-01 20:13:42 +0000 |
commit | fa80bf081d0e8a3736f6d94d48198f1b3b4c4bff (patch) | |
tree | 9f3f696767fa85d7ac5c05808e138e66abb9bd4d /lisp/progmodes | |
parent | a3936d6ac87950245634f56e0e674e37f3e30e3b (diff) | |
download | emacs-fa80bf081d0e8a3736f6d94d48198f1b3b4c4bff.tar.gz |
(compilation-parse-errors):
Collapse //'s using command-line-normalize-file-name.
Diffstat (limited to 'lisp/progmodes')
-rw-r--r-- | lisp/progmodes/compile.el | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index b679f44f01a..13aad9173ae 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -1391,32 +1391,6 @@ See variable `compilation-parse-errors-function' for the interface it uses." (setq alist (car alist)) (error "compilation-parse-errors: impossible regexp match!")) - ;; Some compilers (e.g. Sun's java compiler, reportedly) - ;; produce bogus file names like "./bar//foo.c" for the file - ;; "bar/foo.c"; expand-file-name will collapse these into - ;; "/foo.c" and fail to find the appropriate file. So we look - ;; for doubled slashes in the file name and fix them up in the - ;; buffer. It is essential here to save the match-data not - ;; only because the `search-forward' overwrites it, but - ;; because the internally stored data returned by - ;; `match-beginning' and `match-end' is integer locations - ;; instead of markers; the deletions we do here make all the - ;; later position values incorrect. However, when we extract - ;; the positions with (match-data), we get a list of markers - ;; that do compensate properly for insertions and deletions - ;; automagically. - (let* ((data (match-data)) - ;; We extract from DATA here instead of just using - ;; `(match-end (nth 1 alist))' because we need a marker - ;; that will track the end of the file name properly - ;; after we delete some characters in the middle of it. - (end (nth (1+ (* 2 (nth 1 alist))) data))) - (save-excursion - (goto-char (1+ (nth (* 2 (nth 1 alist)) data))) - (while (search-forward "//" end t) - (delete-char -1))) - (store-match-data data)) - ;; Extract the file name and line number from the error message. (let ((beginning-of-match (match-beginning 0)) ;looking-at nukes (filename (buffer-substring (match-beginning (nth 1 alist)) @@ -1441,6 +1415,14 @@ See variable `compilation-parse-errors-function' for the interface it uses." ;; compile-abbreviate-directory). (file-name-absolute-p filename) (setq filename (concat comint-file-name-prefix filename))) + + ;; Some compilers (e.g. Sun's java compiler, reportedly) + ;; produce bogus file names like "./bar//foo.c" for the file + ;; "bar/foo.c"; expand-file-name will collapse these into + ;; "/foo.c" and fail to find the appropriate file. So we look + ;; for doubled slashes in the file name and fix them up in the + ;; buffer. + (setq filename (command-line-normalize-file-name filename)) (setq filename (cons filename (cons default-directory (nthcdr 4 alist)))) |