1

in javascript and html mode emacs cant make good indentation and all i want is make it better by hand but when use tab only use self indentation and not listen what i say :D

what can i do?

now

<html>
    <body>
      HTTP 404 ERROR !!
    </body>
</html>

what i want

<html>
    <body>
                                  HTTP 404 ERROR !!
    </body>
</html>

only example

Mohammad Efazati
  • 4,812
  • 2
  • 35
  • 50
  • Can you describe the problem more carefully and give an example? I just tried a toy html file in emacs and it indented it just fine. What isn't working for you? – drysdam Apr 12 '11 at 11:23
  • i want use tab more than one for example i want create new code --- see new update – Mohammad Efazati Apr 12 '11 at 11:24

2 Answers2

3

Some modes offer "bouncing" indentation, where TAB will toggle the indentation level between a few alternatives. An example for javascript is js2-mode. I'm not aware of a more general solution.

However, note that if TAB is getting intercepted by the major mode's keymap, you can still insert a literal TAB character using C-q TAB. That is probably all you need.

sanityinc
  • 15,002
  • 2
  • 49
  • 43
2

If you don't want TAB to do indentation, you can bind it to just insert tabs.

(add-hook 'html-mode-hook
   (lambda () (define-key html-mode-map (kbd "TAB") 'self-insert-command)))
Trey Jackson
  • 73,529
  • 11
  • 197
  • 229