mumano crashes on using django template variables as part of tag attribute's value

Bug #692290 reported by Oleg Lomaka
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
nXhtml
Fix Committed
Medium
Unassigned

Bug Description

If I use django template variable as part of html tag's attribute's value, mumano crashes with following message:

mumamo-idle-set-major-mode: cb=1.html, err=(error Invalid search bound (wrong side of point))
or another
mumamo-fontify-region: Invalid search bound (wrong side of point)

I use 744 revision of nxhtml trunk, and emacs nightly build for 2010-12-19.

Few examples:
{% block content %}
  <script type="text/javascript" src="{{ STATIC_URL }}1.js" ></script>
                                      ^^^^^^^^^^^^^^^^^
{% endblock %}

another example
<img src="{{ STATIC_FILE }}1.jpg" ></img>
          ^^^^^^^^^^^^^^^^^

On this error, emacs buffer became completely uneditable and only I can do is to save the document and open in another editor.

Also I've attach screenshot to picture the issue.

Tags: django mumamo
Revision history for this message
Oleg Lomaka (olomix) wrote :
description: updated
description: updated
Oleg Lomaka (olomix)
tags: added: django mumamo
Revision history for this message
lborgman (lennart-borgman) wrote :

Thanks Oleg, very useful examples. I think this catched a simple oversight in the code. Can you please try the new beta 2.09?

Revision history for this message
Oleg Lomaka (olomix) wrote :

Thank you for your help. The patch resolved the first example, but didn't resolve the second.

Now in case of this code "<img src="{{ STATIC_FILE }}1.jpg" ></img>" it generates following error "Making parse-sexp-lookup-properties buffer-local while locally let-bound!"

I've attached a screenshot.

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

I have tried to take care of the error message (this is actually just cosmetic in this case). However I am not sure what problem you have now. Can you please explain? (And perhaps update nXhtml beta again so we are not miscommunicating.)

Revision history for this message
Oleg Lomaka (olomix) wrote :

Ok, updated to r746.

Opened file with following content:
<img src="{{ STATIC_FILE }}1.jpg" />
<p>some text</p>

in *Messages* got this error:
(mumamo-major-mode-from-modespec): Couldn't find an available major mode for spec django-variable-mode

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

That should not happen. There is something wrong here. Can you please in the file buffer where you have this django code do

  M-: (emacs-Q-nxthml buffer-file-name)

That should start a new Emacs with just nXhtml loaded. Do you still see this error message in this new Emacs instance?

Revision history for this message
Oleg Lomaka (olomix) wrote :

After clean start, I don't see those error message, but the mode still doesn't work.

What did I do:
1. Start new emacs with such .emacs
(add-to-list 'load-path "~/.emacs.d/")
(load "~/.emacs.d/nxhtml-trunk/autostart.el")
(add-to-list 'auto-mode-alist '("\\.html$" . django-nxhtml-mumamo-mode))
In emacs.d only nxhtml-trunk
2. Run emacs-Q-nxhtml
3. Opened ~/3.html in new emacs instance with following content
{% block content %}
  <img src="{{ STATIC_URL }}1.jpg" />
  <p>some text</p>
{% endblock %}
4. Switched mode to django-nxhtml-mumamo-mode

Got the mode "nXhtml/django-nxhtml Invalid" when cursor placed somewhere inside {% block content %} tag except {{ STATIC_URL }} variable. When cursor outside {% block content %} the mode is "MuMaMo border/django-nxhtml". When the cursor inside {{ STATIC_URL }}, the mode is "Django variable/django-nxhtml"

The screenshot attached.

If it whould be helpful, here is *Messages*

For information about GNU Emacs and the GNU system, type C-h C-a.
Nxml/Nxhtml Autostart.el loading ...
Loading /Users/alek/.emacs.d/nxhtml-trunk/etc/schema/schema-path-patch.el (source)...done
... loading web-autoload
Loading /Users/alek/.emacs.d/nxhtml-trunk/util/ourcomments-widgets.el (source)...
Making mumamo-bug-3467-w14 local to *temp* while let-bound!
Tested for Bug 3467 => PASSED
Loading /Users/alek/.emacs.d/nxhtml-trunk/util/ourcomments-widgets.el (source)...done
... loading web-autoload
Loading /Users/alek/.emacs.d/nxhtml-trunk/web-autoload.el (source)...done
... nXhtml loading 1.4 seconds elapsed ...
Loading /Users/alek/.emacs.d/nxhtml-trunk/nxhtml-loaddefs.el (source)...done
... nXhtml loading 1.6 seconds elapsed ...
Turn on `nxhtml-menu-mode' unconditionally
... nXhtml loading 2.1 seconds elapsed ...
Loading vc-bzr...done
xhtml-loader.rnc was ok
(No changes need to be saved)
... nXhtml loading 2.1 seconds elapsed ...
Loading /Users/alek/.emacs.d/nxhtml-trunk/nxhtml/nxhtml-autoload.el (source)...
majmodpri-apply-priorities running ... (done)
majmodpri-apply-priorities running ... (done)
Loading /Users/alek/.emacs.d/nxhtml-trunk/nxhtml/nxhtml-autoload.el (source)...done
... nXhtml loading 2.3 seconds elapsed ...
=== Loaded at nxhtml/autostart.el end:
(feature 'html-imenu)=t
(feature 'html-pagetoc)=t
(feature 'html-quote)=t
(feature 'html-site)=t
(feature 'html-toc)=t
(feature 'html-upl)=t
(feature 'inlimg)=t
(feature 'mumamo)=t
(feature 'nxhtml-menu)=t
(feature 'nxhtml-mode)=t
(feature 'rngalt)=t
(feature 'tidy-xhtml)=t
(feature 'xhtml-help)=t
Nxml/Nxhtml Autostart.el loaded in 2.6 seconds
Using schema ~/Applications/Emacs.app/Contents/Resources/etc/schema/xhtml.rnc
Making completion list... [2 times]
Using vacuous schema
Using schema ~/Applications/Emacs.app/Contents/Resources/etc/schema/xhtml.rnc
Using vacuous schema [2 times]
Error in menu-bar-update-hook: (error This buffer cannot use `imenu-default-create-index-function')
Using schema ~/Applications/Emacs.app/Contents/Resources/etc/schema/xhtml.rnc
Unknown element [2 times]
byte-code: Beginning of buffer [7 times]
byte-code: End of buffer
byte-code: Beginning of buffer [9 times]
Mark set

Changed in nxhtml:
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
lborgman (lennart-borgman) wrote :

Thanks, this was a missing autoload. Should be fixed now in the latest beta 2.09.

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.