Browse Source

Add Dirk's Perl script to the -emacs mode question.

Submitted by:	Dirk-Willem van Gulik <dirkx@apache.org>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269386 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 24 years ago
parent
commit
0992b41f80
2 changed files with 78 additions and 8 deletions
  1. +48
    -5
      webpage/docs/faq.html
  2. +30
    -3
      webpage/xdocs/faq.xml

+ 48
- 5
webpage/docs/faq.html View File

@@ -172,8 +172,8 @@
Is Ant supported by my IDE/Editor?
</a></li>
<li><a href="#emacs-mode">
Why doesn't (X)Emacs parse the error messages generated
by Ant correctly?
Why doesn't (X)Emacs/vi/MacOS X's project builder
parse the error messages generated by Ant correctly?
</a></li>
</ul>
</blockquote>
@@ -706,8 +706,8 @@ shell-prompt&gt; cat &lt; foo
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<strong>
Why doesn't (X)Emacs parse the error messages generated
by Ant correctly?
Why doesn't (X)Emacs/vi/MacOS X's project builder
parse the error messages generated by Ant correctly?
</strong>
</font>
</td></tr>
@@ -715,7 +715,8 @@ shell-prompt&gt; cat &lt; foo
<blockquote>
<p>Ant adds a "banner" with the name of the current
task in front of all messages - and there are no built-in
regular expressions in Emacs that would account for this.</p>
regular expressions in your Editor that would account for
this.</p>
<p>You can disable this banner by invoking Ant with the
<code>-emacs</code> switch. Alternatively you can add the
following snippet to your <code>.emacs</code> to make Emacs
@@ -738,6 +739,48 @@ shell-prompt&gt; cat &lt; foo
;; works for javac
'(&quot;^\\s-*\\[[^]]*\\]\\s-*\\(.+\\):\\([0-9]+\\):&quot; 1 2))
compilation-error-regexp-alist))
</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
<p>Yet another alternative that preserves most of Ant's
formatting is to pipe Ant's output through the following Perl
script by Dirk-Willem van Gulik:</p>
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>
#!/usr/bin/perl
#
# May 2001 dirkx@apache.org - remove any
# [foo] lines from the output; keeping
# spacing more or less there.
#
$|=1;
while(&lt;STDIN&gt;) {
if (s/^(\s+)\[(\w+)\]//) {
if ($2 ne $last) {
print &quot;$1\[$2\]&quot;;
$s = ' ' x length($2);
} else {
print &quot;$1 $s &quot;;
};
$last = $2;
};
print;
};
</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>


+ 30
- 3
webpage/xdocs/faq.xml View File

@@ -258,13 +258,14 @@ shell-prompt> cat < foo
</faq>

<faq id="emacs-mode">
<question>Why doesn&apos;t (X)Emacs parse the error messages generated
by Ant correctly?</question>
<question>Why doesn&apos;t (X)Emacs/vi/MacOS X's project builder
parse the error messages generated by Ant correctly?</question>
<answer>

<p>Ant adds a &quot;banner&quot; with the name of the current
task in front of all messages - and there are no built-in
regular expressions in Emacs that would account for this.</p>
regular expressions in your Editor that would account for
this.</p>

<p>You can disable this banner by invoking Ant with the
<code>-emacs</code> switch. Alternatively you can add the
@@ -282,6 +283,32 @@ shell-prompt> cat < foo
compilation-error-regexp-alist))
]]></source>

<p>Yet another alternative that preserves most of Ant's
formatting is to pipe Ant's output through the following Perl
script by Dirk-Willem van Gulik:</p>

<source><![CDATA[
#!/usr/bin/perl
#
# May 2001 dirkx@apache.org - remove any
# [foo] lines from the output; keeping
# spacing more or less there.
#
$|=1;
while(<STDIN>) {
if (s/^(\s+)\[(\w+)\]//) {
if ($2 ne $last) {
print "$1\[$2\]";
$s = ' ' x length($2);
} else {
print "$1 $s ";
};
$last = $2;
};
print;
};
]]></source>

</answer>
</faq>
</faqsection>


Loading…
Cancel
Save