You are viewing a plain text version of this content. The canonical link for it is here.
Posted to asp@perl.apache.org by "Philip <test>" <pm...@aaanime.net> on 2001/06/24 23:30:59 UTC

[bugs] emacs mode for ASP

On Sun, 17 Jun 2001, Joshua Chamas wrote:

> You can get mmm-mode here: http://mmm-mode.sourceforge.net/

I've been playing around with this emacs mode for ASP, but I'm running
into some imperfections.

Sometimes when I'm inside <% %>, emacs still thinks I'm in HTML mode. See
attached mmm.gif. This seems to happen with new <% %> blocks that I type
in. If I exit emacs and reopen the file, it behaves correctly.

Automatic indenting also seems to be somewhat off. I just typed in some
code and it ends up like this:

<%
    my $template = HTML::Template->new(filename => 'test.tmpl');
$template->param(
                 HOME => $ENV{HOME},
                 PATH => $ENV{PATH},
                 );
print $template->output;
%>

instead of what I would have expected (subsequent lines being indented
like the first "my $template" line, and also the hash declaration being
indented more efficiently):

<%
    my $template = HTML::Template->new(filename => 'test.tmpl');
    $template->param(
        HOME => $ENV{HOME},
        PATH => $ENV{PATH},
    );
    print $template->output;
%>

If I write this code in pure perl mode, I don't experience the problem of
the first line being indented differently, but I do experience the problem
with the hash declaration.

Also, it seems to have problems recognizing whether a quote character is
inside or outside of the HTML section. For example, the following file:

'
<%

%>

If I put my cursor between the <% %> and press TAB, it will say "In a
string which starts with a '.", but that's not true because the ' was in
the HTML section, not the perl section.

It also does not preserve perl indentation across multiple <% %> sections.
For example:

<%
    if (1) {
%>
<%
}
%>

It did not indent the closing } bracket to line up with the beginning of
the "if" statement.

-Philip Mak (pmak@aaanime.net)

Re: [bugs] emacs mode for ASP

Posted by Joshua Chamas <jo...@chamas.com>.
"Philip " wrote:
> 
> On Sun, 17 Jun 2001, Joshua Chamas wrote:
> 
> > You can get mmm-mode here: http://mmm-mode.sourceforge.net/
> 
> I've been playing around with this emacs mode for ASP, but I'm running
> into some imperfections.
> 

I believe most of these are known / documented 
deficiencies with mmm-mode mixed with perl, which comes
up with Embperl & Mason modes too.

The "fix" for the indentation problem with the 
first perl line is to add a semicolon to the 
beginning of it:

<%;
perl block
%>

This helps perl indent better.

Another thing you pointed out where you have to reopen 
the file in emacs to have new <% %> blocks identified is 
a result that mmm-mode only parses upon emacs buffer 
initialization.  In the sample emacs config file 
I have:

(global-set-key "\M-p"  'mmm-parse-buffer)

You can then use this to hit ESC-p real fast to reparse
the buffer you are in after you have built a new <% %> block.
Future versions of mmm-mode might reparse on the fly, but
that seems like its a TODO item.

--Josh

_________________________________________________________________
Joshua Chamas                           Chamas Enterprises Inc.
NodeWorks <- Web Link Checking          Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org