I am using Emacs 25.3.1 under MS Windows 64-bit, Everything seems working fine except the web-mode. If I try to edit an HTML file there is no syntax highlighting, when mixing PHP and HTML only the PHP code fragments are colored, the HTML parts are in black/gray color scheme. My .emacs file looks like this under (package-initialize):

(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))

(setq web-mode-engines-alist '(("php" . "\\.html\\'")))

The last line was added, as it was required by fxbois, but it doesn't solve the issue. enter image description here

  • Maybe you are looking for web-mode-enable-element-content-fontification. There are many more options for web-mode. Try M-x customize-group RET web-mode RET. – Tobias May 3 '19 at 10:35

Your Answer

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

Browse other questions tagged or ask your own question.