template buffer not right for erb strings

Bug #579713 reported by Perry Smith
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
nXhtml
Fix Committed
Medium
Unassigned

Bug Description

I find that -%> leaves the -. I did not notice before but the <%= leaves the = as well.

Also, note that the <%= can close with -%> too.

I was going to make this a 3rd bug but put it here because I bet its related. (This is a repeat) If I change from one match pattern to another, hit tab, emacs throws an error. For examle, if I change <% doggy %> to <% doggy -%> and hit tab, emacs will throw an error. This seems to be true also if I change <% to <%= and then hit tab. I have debug-on-error set to t so I see it and most people probably don't.

Thanks for all your support!

Revision history for this message
Perry Smith (pedz) wrote :

Also note (might be connected, might not), the h3 tags and p tags are still being marked as invalid.

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

Hi Perry, thanks, this was good.

I have fixed the -%> problem. I am not sure I have fixed the error when you hit TAB, but at least it should not happen that often now.

The problem with the h3 and p tags is a hard one. I think I can't fix that reliably at the moment, please see FAQ #1078. (Hope that gives a link to the FAQ, not sure ... )

Please try the new beta 2.09 that I just uploaded.

Changed in nxhtml:
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
Perry Smith (pedz) wrote :

I keep making discoveries. One from your FAQ above.

If I do one of two things, things are working 99%. I can either set eruby-html-mumamo-mode or I can pick

nXhtml -> Tools -> XHTML Completion and Validation -> Validation Helpers (for php etc) -> Use Fictive XHTML Validation Header in Buffer

This sets nxhtml-validation-header-mode and now my tags validate. (if I do either one of those).

The other thing I discovered is under the XML menu, I can do Set Schema to HTML5. That may or may not be critical but answers one of my nagging questions which was in this partial buffer mode, which schema am I trying to validate against?

WIth this latest update (nxhtml-beta 2.09-100513-03_53_54.zip) the - signs are gone but you still have the = signs for the <%= xxxx %> lines (at the front of the line). That seems to be ok for the indentation in the examples I have but I bet that is going to bite us sometime.

The error when I go from -%> to %> is still there. That doesn't bother me much.

I'm still working / experimenting but this is looking really good. The fact I can do:

<p style='width: 40em;'>
  Enter a defect, APAR, PTF, Lpp name (e.g. bos.rte) or Fileset
  (e.g. bos.rte 5.3.0.30 -- with the space. The VRMF can be
  incomplete such as 5.3.8)
  <% form_tag swinfos_form_path do %>
    <div>
      <%= text_field_tag "item" %>
      <%= submit_tag nil, :class => "concat-fields" %>
    </div>
  <% end %>
</p>

And it indents the div and also indents the erb inside the div is what I've been looking for since I wrote php back in 2004.

Any advice about using the fictive header verses using html mode?

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

Hi Perry,

The <%= %> chunks are not really useful in the indentation buffer so I removed them from there now. Does that seem correct to you?

I can't reproduce the error when going from -%> to %>. Could you please give me a more precise recipe (using the latest nXhtml beta 2.09)?

Since 2004? Yes the indentation part is a bit hard to implement...

Fictive headers vs html-mode? It is a good question. I just tried to make the validation headers and the XML menu "Validation" entry cooperate a bit better. (And fixed a bug in choosing validation header.)

With this change you could actually use the nxml-mode (nxhtml-mode) based multi major mode versions without validation just as well as those based on html-mode.

However the cooperation between fictive validation headers and "Validation" is still maybe confusing. Here are my thoughts and how it works now:

- Turning off "Validation" removes the fictive validation header because they are of no use without validation. However I am not sure if doing that is right since you may want to turn on "Validation" again later.

- Turning on fictive validation headers turn on "Validation". That seems right to me.

Revision history for this message
Perry Smith (pedz) wrote :

The new Rails 3.0, almost everything will have <%= instead of <% so I think they are going to be able to affect indentation.

I didn't do enough PHP to really want it bad enough. I tried mmm-mode and various other things which didn't work for me. I finally just decided to live with what I had. The newer concept is "unobtrusive" javascript so that solves part of the problem (i.e. the javascript is javascript and the html is html with very little mixing of the two). With the erb files I've tended to just "grin and bear it". Last weekend, I thought perhaps the new(ish) emacs 23 might have the features needed to do mmm-mode right. Sounds like it has some but not everything judging from some of the comments and posts.

I'd like to keep this bug report on the <%=. I'll open a new bug report for the -%> to %> failure and provide a sample file and the stack trace back. Note that I have debug-on-error set to t so I am seeing all the errors. Most people do not have that set. With it not set, I see a message flash by (I think) but don't notice anything wrong. (Thats why it may not be worth fixing except things like that tend to raise back up later.)

My question about fictive headers verses html mode was more along the lines of which one of the two choices do most people use? I believe I'm going to trigger my own function with erb html files and call a wrapper function that sets fictive header mode after calling the eruby-nxhtml mode. I noticed sometimes for some reason, things get really slow but I haven't figured out when that happens.

Thank you again for your work.

Revision history for this message
Perry Smith (pedz) wrote :

Hi,

With nxhtml-beta 2.09-100513-18_03_33.zip I am not seeing the error when changing from %> to -%> and back again. If I see it pop up, I'll try and document it the best I can and open a new bug report.

This particular level does not enter the <%= as you said. That worries me long term.

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

Ok, I have changed <%= %> to be copied to the indentation help buffer again, but now without = at the beginning. I guess that is what you think is best.

So I am closing this now. Thanks for the help Perry.

Changed in nxhtml:
status: In Progress → Fix Committed
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.