When i indent javascript code (inside html - web mode) that has no semicolons in it, the next statements are indented right with two extra spaces,

 function processTemplates(){
   var tmpldata = $( "#suiteSummaryTemplate" ).tmpl( tempData );
   $(tmpldata).appendTo( "#example" )
     //$( "#example" ).html(tmpldata)
     var logSummTmplStr = $( "#logSummaryTemplate" ).tmpl( logSummaryData )
     $(logSummTmplStr).appendTo( "#logs_table" )

After adding semicolons to a line, it works properly like,

  var tmpldata = $( "#suiteSummaryTemplate" ).tmpl( tempData );
  $(tmpldata).appendTo( "#example" )

In javascript-mode, when i place the same code in a js file (after removing the script tag), it works properly.

How can i achieve this correct indentation without forcing the user to use semicolons everywhere?

  • M-x report-emacs-bug? – PythonNut Jun 9 '15 at 3:07
  • I tried to reproduce your problem and couldn't. Try opening emacs with emacs -q and see if it is still reproducible. It seems like you use a combination of newline and indent-relative but I don't know for sure. – caisah Jun 9 '15 at 12:20
  • hi caisah, this error is seen in javascript code embedded inside html in web mode. in javascript mode, it works good... sorry for the wrong inputs, man... – Madhavan Jun 11 '15 at 15:01
  • 1
    I don't really know what to make of this: github.com/fxbois/web-mode/issues/503 might be a wont-fix – Jordon Biondo Jun 11 '15 at 15:43
  • 1
    @MadhavanKumar Seems like a known issue, may want to bring more attention to it on github. – Jordon Biondo Jun 11 '15 at 15:44

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.