I want to modify csharp-mode.el so that it includes the appropriate error regex's (regexi?) for the .NET csc.exe compiler.
How should a well-behaved progmode do this?
I want to modify csharp-mode.el so that it includes the appropriate error regex's (regexi?) for the .NET csc.exe compiler.
How should a well-behaved progmode do this?
A well-behaved Emacs user should probably add the regexp to compilation-error-regexp-alist-alist
and provide the patch to Emacs so it'll get used by all in subsequent releases.
The variable defined in compile.el
and can be found via
M-x find-variable compilation-error-regexp-alist-alist RET
I don't think it makes sense for the csharp-mode major mode change the regexp. If anything, it should set the local value of compilation-error-regexp-alist
to contain the new symbol you added in the ...-alist-alist
variable.
That said, it could modify the ...-alist-alist
variable by just checking to see if the symbol c#
(or whatever you add) is a part of the list already, and add it if not. Note: the compilation-error-regexp-alist
is defined apriori, so you'll want to double check that variable's contents to ensure it also contains the c#
symbol.
Here's what I did inside csharp-mode:
(if (boundp 'compilation-error-regexp-alist-alist)
(progn
(add-to-list
'compilation-error-regexp-alist-alist
'(ms-csharp
"^[ \t]*\\([A-Za-z0-9_][^(]*\\.cs\\)(\\([0-9]+\\)[,]\\([0-9]+\\)) ?: \\(error\\|warning\\) CS[0-9]+:" 1 2 3))
(add-to-list
'compilation-error-regexp-alist
'ms-csharp)))