Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

syntax colouring sporadic / failing under Emacs24.1 #13

Closed
jasonm23 opened this Issue Jul 16, 2012 · 20 comments

Comments

Projects
None yet
3 participants

Some example screenshots...



Expecting Haml, Ruby, JavaScript and CSS highlighting.

Contributor

dgutov commented Jul 16, 2012

#6 fixes Ruby highlighting, dgutov/haml-mode@a481bc723f515531efea73e0290baf79856177eb -- JavaScript one.
CSS just works, I think.

Thanks @dgutov, mostly I'd really like HAML highlighting first of all ;)

Contributor

dgutov commented Jul 16, 2012

On 16.07.2012 18:42, Jason wrote:

mostly I'd really like HAML highlighting first of all ;)

With both patches applied, it works okay for me, too.

@dgutov not for me unfortunately, any ideas?

If I move to an unhighlighted haml element and move it (tab indent select, etc.) then it does hightlight, however things like second attributes e.g. %img(src="path/file.png" alt="some image of some sort") the alt attribute won't colorize, even after moving the element.

So basically, when I load a Haml file, they look like...

after both of the patches are applied.

FYI if I turn on ruby-mode the symbols are highlighted like this (obviously the ID's look like comments.

An example of :javascript and :css filter blocks, failing.

Contributor

dgutov commented Jul 17, 2012

Have you recompiled haml-mode (or removed the .elc file) after applying the patches?
To make sure the patches are applied properly, you can also try my fork.

Let's try debugging. First, do M-x toggle-debug-on-error to see the full backtrace.
Then select some piece of buffer that doesn't highlight properly, press M-: (eval-expression), and evaluate the following: (font-lock-fontify-region (region-beginning) (region-end)). It should either highlight the region, or show the error.

I've been using it uncompiled, but I've put your fork in there instead and it's working much better, so a big thank you for that, but there are still a few problems.

For example, just before the :javascript block here and the subsequent resumption of HAML ... which arbitrarily resumes highlighting properly?!

About 3am here now, so I'll try the debugging in the morning.

Ah well, couldn't really go to bed in the middle of this, so I tried a few eval / debug on individual cursor points within the un-coloured region, with no errors (the colouring shows up after the individual evals, which is irritating, although consistent with what's happened before.)

However I tried selecting the whole region and a backtrace is thrown... the cursor is located directly at the end of the word :javascript

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
+(2 nil)
(funcall fn (+ 2 (match-beginning 2)) (match-end 2))
(progn (funcall fn (+ 2 (match-beginning 2)) (match-end 2)))
(if (re-search-forward (haml-nested-regexp (concat ":" filter-name)) limit t) (progn (funcall fn (+ 2 (match-beginning 2)) (match-end 2))))
(when (re-search-forward (haml-nested-regexp (concat ":" filter-name)) limit t) (funcall fn (+ 2 (match-beginning 2)) (match-end 2)))
haml-handle-filter("javascript" 3782 (lambda (beg end) (apply (quote haml-fontify-region) (append (list beg end) fontify-region-args))))
haml-fontify-filter-region("javascript" 3782 (("^#[ ](?:error|warning)[ ]+(.+)" 1 font-lock-warning-face prepend) ("^#[ ](?:import|include)[ ](<[^>"\n]>?)" 1 font-lock-string-face prepend) ("^#[ ]define[ ]+([[:alpha:]][[:alnum:]$])(" (1 font-lock-function-name-face prepend) ((lambda (limit) (re-search-forward "(?:([[:alpha:]][[:alnum:]])[,]?)" (or (save-excursion (re-search-forward ")" limit t)) limit) t)) nil nil (1 font-lock-variable-name-face prepend))) ("^#[ ](?:elif|if)>" ("<(defined)>[ ](?([[:alpha:]][[:alnum:]])?" nil nil (1 font-lock-builtin-face prepend) (2 font-lock-variable-name-face prepend t))) ("^(#[ ](?:define|e(?:l(?:if|se)|ndif|rror)|file|i(?:f(?:n?def)?|mport|nclude)|line|pragma|undef|warning))>[ !]([[:alpha:]][[:alnum:]])?" (1 font-lock-preprocessor-face prepend) (2 font-lock-variable-name-face nil t)) "_<import_>" ("^\s-function\s-+([a-zA-Z$](?:\s|\sw))" 1 font-lock-function-name-face) ("^\s-([a-zA-Z_$](?:\s_|\sw))\s-:\s-function_>" 1 font-lock-function-name-face) ("_<(abstract|break|c(?:a(?:se|tch)|lass|on(?:st|tinue))|d(?:e(?:bugger|fault|lete)|o)|e(?:lse|num|x(?:port|tends))|f(?:inal(?:ly)?|or|unction)|goto|i(?:mp(?:lements|ort)|n(?:stanceof|terface)|[fn])|let|n(?:ative|ew)|p(?:ackage|r(?:ivate|otected)|ublic)|return|s(?:tatic|uper|witch|ynchronized)|t(?:hrows?|r(?:ansient|y)|ypeof)|v(?:ar|o(?:id|latile))|w(?:hile|ith)|yield)_>" 1 font-lock-keyword-face) ("_<for\>" "\s-+(each)_>" nil nil (1 font-lock-keyword-face)) ("_<(b(?:oolean|yte)|char|double|float|int|long|short|void)_>" . font-lock-type-face) ("_<(Infinity|NaN|arguments|false|null|t(?:his|rue)|undefined)_>" . font-lock-constant-face) (".(prototype)_>" (1 font-lock-constant-face)) (js--class-decl-matcher "([a-zA-Z_$](?:\s_|\sw))(?:.|.$)" (goto-char (match-beginning 1)) nil (1 font-lock-type-face)) (js--class-decl-matcher "([a-zA-Z_$](?:\s_|\sw))(?:.|.$)" (if (match-beginning 2) (progn (setq js--tmp-location (match-end 2)) (goto-char js--tmp-location) (insert "=") (goto-char (match-beginning 2))) (setq js--tmp-location nil) (goto-char (point-at-eol))) (when js--tmp-location (save-excursion (goto-char js--tmp-location) (delete-char 1))) (1 font-lock-type-face)) (js--class-decl-matcher (2 font-lock-type-face nil t)) (#[(limit) "\302�>\205��\303\304 \305#\207" [js-enabled-frameworks limit dojo re-search-forward "^\s-dojo.declare\s-("([a-zA-Z_$](?:\s_|\sw)(?:.[a-zA-Z$](?:\s_|\sw)))(?:"\s-,\s-([a-zA-Z_$](?:\s_|\sw)(?:.[a-zA-Z$](?:\s_|\sw))))?" t] 4] (1 font-lock-type-face t) (2 font-lock-type-face nil t)) (#[(limit) "\302�>\205��\303\304 \305#\207" [js-enabled-frameworks limit dojo re-search-forward "^\s-dojo.declare\s-("([a-zA-Z_$](?:\s_|\sw)(?:.[a-zA-Z$](?:\s_|\sw)))"\s-,\s-[" t] 4] "[[,]\s-([a-zA-Z$](?:\s_|\sw)(?:.[a-zA-Z$](?:\s_|\sw)))\s-(?:].$)?" (backward-char) (end-of-line) (1 font-lock-type-face)) (#[(limit) "\302�>\205��\303\304 \305#\207" [js-enabled-frameworks limit dojo re-search-forward "^\s-[a-zA-Z$](?:\s_|\sw)(?:.[a-zA-Z$](?:\s_|\sw))\s-[],]" t] 4] "([a-zA-Z$](?:\s_|\sw)(?:.[a-zA-Z$](?:\s_|\sw)))\s-(?:].$)?" (if (save-excursion (backward-char) (js--inside-dojo-class-list-p)) (forward-symbol -1) (end-of-line)) (end-of-line) (1 font-lock-type-face)) ("_<(const|var|let)_>|_<(b(?:oolean|yte)|char|double|float|int|long|short|void)_>" (js--variable-decl-matcher nil nil nil)) ("_<new_>\s-+([a-zA-Z_$](?:\s_|\sw)(?:.[a-zA-Z$](?:\s_|\sw)))" (1 font-lock-type-face)) ("_<instanceof_>\s-+([a-zA-Z_$](?:\s_|\sw)(?:.[a-zA-Z$](?:\s_|\sw)))" (1 font-lock-type-face)) ("_<function_>(\s-+[a-zA-Z_$](?:\s_|\sw))?\s-(\s-[a-zA-Z$]" ("([a-zA-Z_$](?:\s_|\sw))(\s-).)?" (backward-char) (end-of-line) (1 font-lock-variable-name-face))) ("^\s-[a-zA-Z_$](?:\s_|\sw)\s-[,)]" ("[a-zA-Z_$](?:\s_|\sw)_" (if (save-excursion (backward-char) (js--inside-param-list-p)) (forward-symbol -1) (end-of-line)) (end-of-line) (0 font-lock-variable-name-face)))) #^[nil #^[(0) nil syntax-table
#^^[3 0 (1) (1) (1) (1) (1) (1) (1) (1) (1) (0) (0) (1) (0) (0) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (0) (1) (7) (1) (2) (2) (3) (1) (4 . 41) (5 . 40) (3) (3) (1) (3) (1) (3) ...] #^^[1 0 #^^[2 0
#^^[3 0 (1) (1) (1) (1) (1) (1) (1) (1) (1) (0) (0) (1) (0) (0) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (0) (1) (7) (1) (2) (2) (3) (1) (4 . 41) (5 . 40) (3) (3) (1) (3) (1) (3) ...]
#^^[3 128 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (1) (1) (3) (3) (3) (2) (3) (1) (3) (3) (3) (4 . 187) (3) (3) (3) (3) ...]
#^^3 256 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) ... (2)
#^^3 640 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) ...
#^^3 896 (2) (2) (2) (2) (3) (3) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) ... (2) (2)
#^^3 1408 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) ... (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2)
#^^[3 3584 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (3) ...]
#^^[3 3712 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (3) ...]
#^^[3 3840 (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (2) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (2) (1) (1) (1) (1) (1) (1) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) ...]
#^^[3 3968 (2) (2) (2) (2) (2) (1) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) ...]] #^^[2 4096 (2) (2) (2) (2) (2) (2)
#^^3 4864 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) ... (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2)] #^^[2 8192
#^^[3 8192 (0) (0) (0) (0) (0) (0) (0) (0) (0) (0) (0) (0) (1) (1) (1) (1) (3) (3) (3) (3) (3) (3) (3) (1) (1) (1) (1) (1) (1) (1) (1) (1) (3) (3) (3) (3) (3) (3) (3) (3) (1) (1) (1) (1) (1) (1) (1) (1) ...]
#^^[3 8320 (2) (3) (3) (3) (3) (2) (2) (2) (2) (2) (2) (2) (2) (4 . 8334) (5 . 8333) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (3) (2) (2) (2) ...]
#^^[3 8448 (2) (2) (2) (3) (2) (2) (2) (2) (2) (3) (2) (2) (2) (2) (2) (2) (2) (2) (2) (3) (2) (2) (1) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (3) (3) (2) (2) (2) (3) (2) (2) (2) (2) (3) (2) (2) (2) (2) ...]
#^^3 8576 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) ... (1)
#^^[3 8960 (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (4 . 9002) (5 . 9001) (1) (1) (1) (1) (1) ...]
#^^[3 9088 (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) ...]
#^^[3 9216 (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) ...]
#^^[3 9344 (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) ...]
#^^[3 9472 (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) ...]
#^^[3 9600 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (3) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (3) (3) (2) (3) (3) (3) (3) (3) (3) (3) (2) (2) (2) (2) (2) (2) ...]
#^^3 9728 (2) (2) (2) (2) (2) (3) (3) (2) (2) (2) (2) (2) (2) (2) (3) (3) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (3) (2) (3) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) ...
#^^[3 9984 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) ...]
#^^3 10112 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) ... (2) (2)
#^^3 10624 (2) (2) (2) (4 . 10628) (5 . 10627) (4 . 10630) (5 . 10629) (4 . 10632) (5 . 10631) (4 . 10634) (5 . 10633) (4 . 10636) (5 . 10635) (4 . 10638) (5 . 10637) (4 . 10640) (5 . 10639) (4 . 10642) (5 . 10641) (4 . 10644) (5 . 10643) (4 . 10646) (5 . 10645) (4 . 10648) (5 . 10647) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) ... (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2)] #^^[2 12288
#^^[3 12288 (3) (3) (3) (3) (2) (3) (3) (3) (4 . 12297) (5 . 12296) (4 . 12299) (5 . 12298) (4 . 12301) (5 . 12300) (4 . 12303) (5 . 12302) (4 . 12305) (5 . 12304) (3) (3) (4 . 12309) (5 . 12308) (4 . 12311) (5 . 12310) (4 . 12313) (5 . 12312) (4 . 12315) (5 . 12314) (3) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) ...]
#^^3 12416 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (3) (3) (3) (3) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) ... (2)
#^^3 12800 (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (2) (2) (2) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (2) (2) (2) (2) (2) (2) ... (2)
#^^3 13184 (3) (3) (3) (3) (3) (2) (2) (2) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) ... (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2)] #^^[2 16384 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2)
#^^3 20096 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) ... (2)](2) (2) (2) (2) (2) #^^[2 40960 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2)
#^^3 43648 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) ... (2) (2) (2) (2) (2) (2) (2) (2) (2)](2) (2) (2) (2) #^^[2 61440 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2)
#^^3 64768 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) ...
#^^3 65024 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) ...
#^^[3 65280 (2) (3) (2) (3) (3) (3) (3) (2) (4 . 65289) (5 . 65288) (3) (3) (3) (2) (3) (3) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (3) (3) (3) (3) (3) (3) (3) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) ...]
#^^[3 65408 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) ...]]](2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) #^^[1 1114112 #^^[2 1114112 (3)
#^^3 1114240 (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) ... (2) (2)
#^^[3 1114752 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) ...]
#^^3 1114880 (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) ... (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2)](2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2)](2) (2) #^^[1 1310720 #^^[2 1310720 (3)
#^^3 1310848 (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) ... (2) (2)
#^^3 1311360 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) ... (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2)](2) (2) (2) (2) (2) (2) (2) #^^[2 1343488 (3) (3)
#^^3 1343744 (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) ... (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2)](2) (2) (2) (2) (2) (2) (2)](2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) #^^[1 2555904 (2) (2) (2) (2) (2) (2) (2) (2) (2) #^^[2 2592768 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2)
#^^[3 2596736 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) ...]] #^^[2 2596864
#^^3 2596864 (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) ...
#^^3 2597120 (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) ...
#^^[3 2597376 (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) ...]
#^^3 2597504 (3) (3) (3) (3) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) (3) ... (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2)](2) (2) (2) (2) (2)](2) (2) (2) (2) (2) (2) ...] syntax-table
#^^[3 0 nil nil nil nil nil nil nil nil nil nil (2097164) nil nil (2097164) nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil (3) (1) (1) (7) nil nil (393217) (1) nil (1) nil (2818049) ...] #^^[1 0 #^^[2 0
#^^[3 0 nil nil nil nil nil nil nil nil nil nil (2097164) nil nil (2097164) nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil (3) (1) (1) (7) nil nil (393217) (1) nil (1) nil (2818049) ...]
#^^[3 128 nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil (1) nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil ...] nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil] nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil] nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil ...] nil)
(progn (haml-fontify-filter-region "javascript" limit keywords syntax-table nil))
(if keywords (progn (haml-fontify-filter-region "javascript" limit keywords syntax-table nil)))
(when keywords (haml-fontify-filter-region "javascript" limit keywords syntax-table nil))
(let ((keywords (or (and (featurep (quote js)) js--font-lock-keywords-3) (and (featurep (quote javascript-mode)) js-font-lock-keywords-3))) (syntax-table (or (and (featurep (quote js)) js-mode-syntax-table) (and (featurep (quote javascript-mode)) javascript-mode-syntax-table)))) (when (and (boundp (quote js--quick-match-re)) (null js--quick-match-re)) (js--update-quick-match-re)) (when keywords (haml-fontify-filter-region "javascript" limit keywords syntax-table nil)))
haml-highlight-js-filter-block(3782)
font-lock-fontify-keywords-region(1 3782 nil)
font-lock-default-fontify-region(1 3782 nil)
font-lock-fontify-region(1 3782)
eval((font-lock-fontify-region (region-beginning) (region-end)) nil)
eval-expression((font-lock-fontify-region (region-beginning) (region-end)) nil)
call-interactively(eval-expression nil nil)

Contributor

dgutov commented Jul 17, 2012

Looks like a problem with some regexp.
If you post a small example of buffer exhibiting this problem to a gist or pastebin, I'll look into it later.

https://gist.github.com/3130755 there you go, line 68 is where it goes wrong. you can match up with the image here (a couple lines length difference to remove some NDA stuff.)

Contributor

dgutov commented Jul 18, 2012

So, this was because of the space you have after :javascript.
The above commit fixed that, but the filter instruction itself isn't highlighted as long as the block contains the // options comment. Not sure about the reason, could be intentional.

That's nice, I can just run a whitespace-cleanup and see it fix.

Of course this isn't a great solution for catching errors / or even just "sloppiness" like this one.

This haml file has come from a designer, and of course haml doesn't care about the trailing space, so ultimately the highlighter shouldn't care about it either.

Possibly some sort of error flagging similar to nxml mode would be nice, but borking and skipping the surrounding lines isn't very good.

Mind you, if it's going to raise an error at a trailing space, it really should have a major melt down over mixed spaces and tabs, but it will happily ignore those.

Of course these are just a few thoughts, I can certainly deal with your fork of haml-mode.el, and I'm really happy about how well it's working now. Thank you very much,

Contributor

dgutov commented Jul 18, 2012

Like I said, the trailing whitespace error is fixed with the last commit.

Ahh, missed that last commit message. I was fixing it myself for a bit there...

A bit of a test on the // options comment

but that's down to javascript mode / js-mode I suppose.

@jasonm23 jasonm23 closed this Jul 18, 2012

Contributor

dgutov commented Jul 18, 2012

that's down to javascript mode / js-mode I suppose

Not really, js-mode itself recognizes comments just fine, so this is a problem in haml-mode.

By the way, I'd rather you reopened this issue, that would increase the odds of it being fixed eventually in the canonical repository (here).

@jasonm23 jasonm23 reopened this Jul 18, 2012

Right, that would explain why markdown mode isn't font-locking as I'd expect.

I also noticed that js comments are parsing single quotes as if they're in code.

purcell added a commit to purcell/haml-mode that referenced this issue Nov 19, 2012

Collaborator

purcell commented Nov 20, 2012

Fixed now in master.

@purcell purcell closed this Nov 20, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment