Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have problem with emacs indentation in html and js mode . i want better mode or function for better indention

I also see Smart Tab and create code like this

(require 'smarttabs)
(define-key read-expression-map [tab] 'hippie-expand)
(define-key read-expression-map [backtab] 'unexpand)

(smart-tabs-advice js2-indent-line js2-basic-offset)
    (smart-tabs-advice python-indent-line-1 python-indent)
    (add-hook 'python-mode-hook
              (lambda ()
                (setq indent-tabs-mode t)
                (setq tab-width (default-value 'tab-width))))
(smart-tabs-advice html-indent-line html-basic-offset)

but there is problem too, in js2mode, html-mode, nxhtml mode i have many problem like this

<div>
  <table>
    <tr>
      <td>
        test
      </td>
    </tr>
  </table>
</div>
  • its all space and i want tab ( with specific size )
  • sometimes i want use tab and shift tab for more tab or less but doesn't work ... only this indentation is acceptable :D

or for javascript js2mode create somethings like this

function preview(img, selection) {
    var scaleX = 64 / (selection.width || 1);
    var scaleY = 64 / (selection.height || 1);
    $('#preview').css({ 
                          width: Math.round(scaleX * img.width) + 'px',
                          height: Math.round(scaleY * img.height) + 'px',
                          marginLeft: '-' + Math.round(scaleX * selection.x1) + 'px',
                          marginTop: '-' + Math.round(scaleY * selection.y1) + 'px' 
                      });
}

but i want this

function preview(img, selection) {
    var scaleX = 64 / (selection.width || 1);
    var scaleY = 64 / (selection.height || 1);
    $('#preview').css({
        width: Math.round(scaleX * img.width) + 'px',
        height: Math.round(scaleY * img.height) + 'px',
        marginLeft: '-' + Math.round(scaleX * selection.x1) + 'px',
        marginTop: '-' + Math.round(scaleY * selection.y1) + 'px'
    });
}

what i can do for this problem?

share|improve this question
    
If you have enough time to master yet another Emacs mode, try this - emacswiki.org/emacs/NxhtmlMode - it's the mode, that combines several web-development modes to create a web-development platform. –  sindikat Oct 26 '11 at 6:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.