0

I'm working with an old compiler that puts out error lines like this:

./code\driver.c(327): WARNING C4200: Other...

I need to fix a couple things:

  1. Fix the path from Wine/DOS mode to local: ./code\driver.c -> driver.c
  2. Rewrite "Entering directory ..." lines
  3. Rewrite the line info: driver.c(327): -> driver.c:327
  4. And keep everything after that intact

Anybody know a way to re-write compile output to be emacs compatible?

I ended up writing a Python script, but I wouldn't be surprised if there is something directly in emacs that can do all this.

| improve this question | | | | |
0

Is that output in the command line or in an emacs compilation buffer?

If it is in a compilation buffer in Emacs, then you just need to make this buffer writeable again and then you can do text replacement with a couple of regex. Its rather simple to stuff all that in a command.

i.e

(defun simple-cleanup-compile-buffer ()
  (interactive)        ;; mark as command, so it is callable via `M-x`
  (read-only-mode -1)  ;; make compile buffer writeable
  (goto-char 0)        ;; goto beginning of buffer
  (replace-regexp "\\([.A-z0-9]\\)\\\\\\([A-z0-9 ]\\)" "\\1/\\2")    ;; replace \ with /
  ;; more regexps here ...
  (read-only-mode 1)) 

Since you wrote that in phython, I guess you are able to figure out the other regexs yourself.

This site on Emacs Regexpressions might come in handy.


On the other hand, you could teach emacs how to interpret the compiler output.
Changing the variables compilation-error-regexp-alist and compilation-error-regexp-alist-alist could help.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.