Jump from compiler error to file location in Emacs

I wrote some elisp code to be able to jump in emacs from an Inform 7 compiler error to the code location. This is not straight forward because ni mutilates the file paths in various ways:

  • A file path can get line wrapped if it contains spaces.
  • The wrapping can also introduce additional spaces.
  • Parts of the path can get converted to lower case.

At least Inform 9.3 (6M62) does this. I did not check yet if this is fixed in Inform 10. Anyway, the code below handles all of this and should usually be able to recover the original file path. If someone finds this useful, please let me know if you try this out and discover cases where it does not work.


  (concat "(\\(?1:/[^\"]+?\\)"         ;; file name
          ", line "                    ;; seperator
          "\\(?2:[[:digit:]]+\\))")    ;; line number
   (lambda ()
      (car (file-expand-wildcards
            (let ((case-fold-search nil))
               (lambda (x) (concat "[" (upcase x) x  "]"))
               (replace-regexp-in-string "[\n\t ]+" " " (match-string-no-properties 1))))))))