we use web-mode (freemarker engine) to edit source files that contain freemarker directives and a lot of SQL.

Editing in web-mode (freemarker engine) works fine.

It would be very helpful if we could switch syntax highlighting from web-mode (freemarker) to SQL for open buffers. Is that possible?

Thanks for any suggestions.


  • Is web-mode a major mode (in which case it conflicts with sql-mode)? If so, you can always try copying the definition of font-lock-keywords for sql-mode and use it with web-mode. See how sql-mode adds its font-locking, and try using the same code with web-mode. – Drew Aug 13 '15 at 21:34
  • 1
    I'm having a bit of trouble determining what you're trying to achieve. Do you want to extend web-mode in some way, or do you want to replace it wholesale? – PythonNut Aug 13 '15 at 23:38

I found a solution. I added

(add-hook 'sql-mode-hook 'sql-highlight-postgres-keywords) 

to my .emacs.

Now I can change between modes by M-x sql-mode and M-x web-mode.

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.