Making Emacs understand ncc errors

Add this to your .emacs or equivalent to make Emacs' compilation-mode make proper links out of the Nemerle compiler's error messages:

(setq compilation-error-regexp-alist 
    (append compilation-error-regexp-alist 
            '(("^\\(.+\\):\\([0-9]+\\):\\([0-9]*\\):\\(?:[0-9]*\\):\\(?:[0-9]*\\):" 
            1 2 3))))

Update:

Or even better, using rx (thanks to this hint for reminding me about it):

(setq compilation-error-regexp-alist 
      (append compilation-error-regexp-alist 
              `((,(rx line-start 
                      (group (1+ (not (any ":"))))
                      ":" 
                      (group (1+ digit)) 
                      ":" 
                      (group (1+ digit)) 
                      ":" 
                      (*? digit) 
                      ":" 
                      (*? digit) 
                      ": ") 1 2 3))))

© Juri Pakaste 2023