Question

I'm working on a program mode, which has various different calls to assemblers, programmers and other external programs. My cunning plan was to handle all of these with the compile function, passing an explicit compile-command that depends on which program is being run.

This sort of seems to work and now I want to add specific error regexps for the different external programs. One option would be to alter compilation-error-regexp-alist-alist, keyed on my major mode and then add my major mode to compilation-error-regexp-alist.

What I'd prefer to do, though, is something like the following:

(let ((compilation-error-regexp-alist
       (cons <my-regexp-and-numbers> compilation-error-regexp-alist))
  (compile <my-compile-command>))

What's weird is that this binding doesn't seem to affect the way the compilation buffer gets parsed / marked up. If I manually push <my-regexp-and-numbers> onto the front of compilation-error-regexp-alist and then call (compilation-mode t) on the buffer, everything gets fontified as expected (so I haven't got the regexp wrong). However, sticking the call to (compilation-mode t) inside a let form as above doesn't affect anything.

I realise this fails miserably as an easy-to-reproduce test case. If no-one has any ideas, I'll try to hack out an example, but I'm hoping that someone will go "Ah, yes! That's because doesn't get evaluated then, but rather at " or the like...

Was it helpful?

Solution

My guess is that the variable is set for the command but somehow is not passed to compile buffer.

Try your method and view the value of the variable (C-h v) inside the compile buffer for confirmation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top