You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Barrie Treloar <Ba...@camtech.com.au> on 2000/07/20 10:56:45 UTC

Ant + Emacs compilation mode (elisp code provided)

On 17 Jul 2000, Stefan Bodewig wrote:

> (add-hook 'compilation-mode-hook
>      '(lambda ()
>         (add-to-list 'compilation-error-regexp-alist
>                      '("^\\s-*\\[[^\\]]\\]\\s-*\\(.+\\):\\([0-9]+\\):\\([0-9]+\\):[0-9]+:[0-9]+:$" 1 2 3))))
> 
> Should work - more or less untested - doesn't it?

Nope :( Its been too long since I last hacked elisp and this took way
longer that it was supposed to :)  I've also dropped the column index
from my regular expression.

The other problem was that compilation-error-regexp-alist is buffer
local so the add-list modifies the global value and the local value
stays unchanged.  If you kill the compilation buffer then it will take
its value from the global one.  The only way I could figure out to
override the default is to load the compile module so I could access
the variable's value and make the modification there.

Hope this is of help, dump it into your ~/.emacs file.

;; Compilation Mode
;; to allow it to understand ant's output
;; (for regular expression help) http://www.delorie.com/gnu/docs/elisp-manual-20/elisp_546.html
(load "compile")
(setq compile-command "ant")
(add-to-list 'compilation-error-regexp-alist 
             '("^\\s-*\\[[^]]*\\]\\s-*\\(.+\\):\\([0-9]+\\):" 1 2))


Barrie
--
Barrie Treloar
____________________________________________________________________

  Barrie Treloar                      Phone: +61 8 8303 3300
  Senior Analyst/Programmer           Fax:   +61 8 8303 4403 
  Electronic Commerce Division        Email: barrie@camtech.com.au
  Camtech (SA) Pty Ltd                http://www.camtech.com.au
 --- Level 8, 10 Pulteney Street, Adelaide SA 5000, Australia. ---
____________________________________________________________________



Re: Ant + Emacs compilation mode (elisp code provided)

Posted by Barrie Treloar <Ba...@camtech.com.au>.
On 20 Jul 2000, Stefan Bodewig wrote:

> >>>>> "BT" == Barrie Treloar <Ba...@camtech.com.au> writes:
> 
>  BT> The other problem was that compilation-error-regexp-alist is
>  BT> buffer local so the add-list modifies the global value and the
>  BT> local value stays unchanged.
> 
> I thought this would be a transient XEmacs problem (I've already filed
> a bug report) because other people could not reproduce my
> problems. Why did you drop the column part?

Because the Javac task doesn't generate a column value and I couldn't
figure out how to make it the matching on the column part optional so
it still works if its not there :) 

You might be able to do it by adding \\(:\\([0-9]+\\)\\)?
So the regexp becomes:

             '("^\\s-*\\[[^]]*\\]\\s-*\\(.+\\):\\([0-9]+\\)\\(:\\([0-9]+\\)\\)?:" 1 2 4))

But since suns jdk doesn't generate the column value I can't test it.
If someone wants to add that in and repost I wont complain.

Barrie
--
Barrie Treloar
____________________________________________________________________

  Barrie Treloar                      Phone: +61 8 8303 3300
  Senior Analyst/Programmer           Fax:   +61 8 8303 4403 
  Electronic Commerce Division        Email: barrie@camtech.com.au
  Camtech (SA) Pty Ltd                http://www.camtech.com.au
 --- Level 8, 10 Pulteney Street, Adelaide SA 5000, Australia. ---
____________________________________________________________________



Re: Ant + Emacs compilation mode (elisp code provided)

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "BT" == Barrie Treloar <Ba...@camtech.com.au> writes:

 BT> The other problem was that compilation-error-regexp-alist is
 BT> buffer local so the add-list modifies the global value and the
 BT> local value stays unchanged.

I thought this would be a transient XEmacs problem (I've already filed
a bug report) because other people could not reproduce my
problems. Why did you drop the column part?

Thanks for the elisp part, I'm going to try it.

Stefan