0

As I'm typing into my buffer in js2-mode, the syntax is not being updated and all my new code is plain white. Additionally, existing text keeps its original color. For example, when I uncomment some commented code, the color is still darkened as if it were still a comment.

I can refresh my buffer via C-x C-v RET or refresh the mode via M-x js2-mode RET, which updates the highlighting, but this is annoying. Any suggestions?

Additionally, syntax errors that are shown in the mini buffer do not go away unless I refresh the buffer or mode as well.

After enabling M-x toggle-debug-on-error, here is the output of my *Messages* buffer:

Debug on Error enabled globally
Saving file /home/lucas/class/nodeschool/how-to-npm/web-sockets.js...
Wrote /home/lucas/class/nodeschool/how-to-npm/web-sockets.js
Saving file /home/lucas/class/nodeschool/how-to-npm/web-sockets.js...
Wrote /home/lucas/class/nodeschool/how-to-npm/web-sockets.js
Saving file /home/lucas/class/nodeschool/how-to-npm/web-sockets.js...
Wrote /home/lucas/class/nodeschool/how-to-npm/web-sockets.js

Any suggestions about what might be going wrong?

  • Please attempt to reproduce fontification failure with debug-on-error enabled (M-x toggle-debug-on-error). Attach backtrace to your message if you get one. – mpontus Mar 29 '15 at 11:16
  • Check the Messages buffer, it may contain messages about errors during jit-lock. – Stefan Mar 29 '15 at 14:31
  • @Stefan I am led to believe that js2-mode does not use jit-lock. I can't find the post I read, but it's floating out there somewhere. – PythonNut Mar 29 '15 at 23:27
  • I updated my questions. Any suggestions would be appreciated. – modulitos Apr 1 '15 at 7:08
  • @Lucas Enable debug-on-error, then evaluate (js2-reparse t) in the buffer. If you see a backtrace, post an issue. – Dmitry Apr 1 '15 at 17:17
0

I don't think my questions has enough information to diagnose the problem, but in case someone runs across the same issue, here is how I resolved it:

I had (js2-minor-mode) in my hook, although I am using the major mode js2-mode. When I toggle js2-minor-mode followed by a buffer reload, the parsing error resolves whenever js2-minor-mode is disabled. So the solution is to disable js2-minor-mode, or remove it from my hook. I'm not sure why a js2-minor-mode even exists?

This is a little confusing because there are lots of packages/modes involved with running a Javascript IDE, but I only have a basic understanding of Emacs. If someone can post a more thorough explanation of what's going on, I would gladly accept their answer.

Here is the output of my major and minor modes after the correction, from running C-h m:

Enabled minor modes: Ac-Js2 Auto-Complete Auto-Composition
Auto-Compression Auto-Encryption Blink-Cursor Column-Number
Desktop-Save Electric-Indent Erc-Autojoin Erc-Button Erc-Fill
Erc-Irccontrols Erc-List Erc-Match Erc-Menu Erc-Move-To-Prompt
Erc-Netsplit Erc-Networks Erc-Noncommands Erc-Pcomplete Erc-Readonly
Erc-Ring Erc-Stamp Erc-Track Evil Evil-Local File-Name-Shadow
Font-Lock Global-Auto-Complete Global-Font-Lock Global-Hl-Line
Global-Undo-Tree Global-Visual-Line Line-Number Linum Menu-Bar
Mouse-Wheel Show-Paren Size-Indication Subword Tooltip Transient-Mark
Undo-Tree Yas Yas-Global

(Information about these minor modes follows the major mode info.)

Javascript-IDE mode defined in `js2-mode.el':
Major mode for editing JavaScript code.

In addition to any hooks its parent mode `prog-mode' might have run,
this mode runs the hook `js2-mode-hook', as the final step
during initialization.
  • 1
    js2-minor-mode exists to be used with js-mode. – Dmitry Apr 7 '15 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.