In web-mode, when it comes to HTML file, press M-; will comment the selected region very well. But in PHP file, it does not work correctly, the following is the screenshot:enter image description here

Any more config work should be done? Thanks in advance.

  • Maybe a bug report or enhancement request to the web-mode maintainer is in order. – Drew Oct 5 '15 at 15:59
  • Did a stab myself, lucky me it works. Changed line 751 in web-mode.el like this: (defvar web-mode-comment-formats '(("java" . "/*") ("javascript" . "/*") ("php" . "//");Jasondf changed here, used to be /* )) Now M-; works in PHP file and php block in HTML file. Although I don't know if there is any side effects. – Jasondf Oct 7 '15 at 17:30
  • Great. Please consider sending your fix to the web-mode maintainer, for consideration to be applied to the code. – Drew Oct 7 '15 at 17:51
  • Well, that's a brutal stab to the source file, not sure he will like that. Already added my comment to the issue in github anyway... – Jasondf Oct 7 '15 at 19:20
  • @Drew there is a better solution in github issue link – Jasondf Oct 8 '15 at 3:14

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.