[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: compilation mode enhancement (compile.el): hook to process filenames
From: |
Gerd Moellmann |
Subject: |
Re: compilation mode enhancement (compile.el): hook to process filenames |
Date: |
25 Oct 2001 09:52:58 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.1.50 |
"Gary Oberbrunner" <garyo@genarts.com> writes:
> Without this patch, users have to redefine compilation-parse-errors, which
> is possible because there's a variable to switch that function to another
> one, but since compilation-parse-errors is a very long and involved
> function, you basically have to duplicate it if you want to modify it, which
> is not good for maintainability. Hence I think this patch is practical and
> useful.
Thanks, Gary. Here is what I've installed:
*** compile.el 2001/10/25 07:40:43 1.241
--- compile.el 2001/10/25 07:45:52
***************
*** 1,6 ****
;;; compile.el --- run compiler as inferior of Emacs, parse error messages
! ;; Copyright (C) 1985, 86, 87, 93, 94, 95, 96, 97, 98, 1999, 2001 Free
Software Foundation, Inc.
;; Author: Roland McGrath <roland@gnu.org>
;; Maintainer: FSF
--- 1,7 ----
;;; compile.el --- run compiler as inferior of Emacs, parse error messages
! ;; Copyright (C) 1985, 86, 87, 93, 94, 95, 96, 97, 98, 1999, 2001
! ;; Free Software Foundation, Inc.
;; Author: Roland McGrath <roland@gnu.org>
;; Maintainer: FSF
***************
*** 133,138 ****
--- 134,144 ----
`compilation-error-list' to a list with an element for each error message
found. See that variable for more info.")
+ (defvar compilation-parse-errors-filename-function nil
+ "Function to call to post-process filenames while parsing error messages.
+ It takes one arg FILENAME which is the name of a file as found
+ in the compilation output, and should return a transformed file name.")
+
;;;###autoload
(defvar compilation-process-setup-function nil
"*Function to call to customize the compilation process.
***************
*** 1943,1948 ****
--- 1949,1961 ----
(file-name-absolute-p filename)
(setq filename
(concat comint-file-name-prefix filename)))
+
+ ;; If compilation-parse-errors-filename-function is
+ ;; defined, use it to process the filename.
+ (when compilation-parse-errors-filename-function
+ (setq filename
+ (funcall compilation-parse-errors-filename-function
+ filename)))
;; Some compilers (e.g. Sun's java compiler, reportedly)
;; produce bogus file names like "./bar//foo.c" for file