php-mode-only when there is no closing ?>

Bug #610470 reported by nurikabe
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
nXhtml
Fix Committed
Wishlist
Unassigned

Bug Description

This is actually a feature request.

It would be nice if nxhtml was smart enough to know that a file with an opening "<?php" tag and no corresponding closing "?>" tag was a "pure" PHP file. nxhtml could then layout the page using php-mode exclusively.

Not sure if this would be applicable to other languages.

Revision history for this message
lborgman (lennart-borgman) wrote :

Hi nurikabe,

Yes, maybe it would be nice, but it is not easy since the user may type a ?> later and in that case a multi major mode will be needed. That can not be detected using only php-mode.

However what benefit would it be if only php-mode would be used? Maybe something should be changed in mumamo to take care of it.

Changed in nxhtml:
importance: Undecided → Wishlist
status: New → In Progress
Revision history for this message
nurikabe (nurikabe) wrote :

The benefit would be less overhead and simplified formatting. Chunk highlighting and all is wonderful when working on a multiple mode file, but not desirable when working on a pure php file.

Revision history for this message
Felix E. Klee (feklee) wrote :

I agree that this would be very useful.

Here is my suggestion:

It would be nice if there was an option so that in files with just one chunk, such as many PHP-code-only files, that chunk is treated as a depth 0 chunk.

Rationale: In PHP files without markup, I want a white background, and in HTML files as well. However, I still want sub-chunks to be visible by different background coloring.

Revision history for this message
lborgman (lennart-borgman) wrote :

It is x-max so I have just added this. ;-)

But I am not sure it is good. Please test it.

Revision history for this message
Yuval Hager (yhager) wrote :

I like this idea, and it works for me! Thanks!

Revision history for this message
lborgman (lennart-borgman) wrote :

Thanks for testing and telling me.

Changed in nxhtml:
status: In Progress → Fix Committed
Revision history for this message
nurikabe (nurikabe) wrote :

Works here as well. Thanks very much for this!

Revision history for this message
lborgman (lennart-borgman) wrote :

Thanks nurikabe.

Now the possibility is here and I wonder whether to make it the default or not. Could you please tell me more exactly what problems this solves? (The problems might be just bugs in nXhtml that I am not aware of.)

Revision history for this message
nurikabe (nurikabe) wrote :

To elaborate on my previous comment:

> The benefit would be less overhead and simplified formatting.

In other words, nXhtml can cause Emacs to become somewhat sluggish on large PHP files. This is not a problem if nXhtml is smart enough to turn itself off.

> Chunk highlighting and all is wonderful when working on a multiple mode file, but not desirable when working on a pure php file.

When I'm working in PHP-only files, the chunk highlighting is more of a distraction than a benefit. I'd prefer it to be off.

And of course there are still some latent indentation / point jumping bugs that I don't have to worry about if nXhtml is off.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.