html indentation for css, html in emacs

1

1

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?

Mohammad Efazati

Posted 2011-04-18T17:40:42.447

Reputation: 296

If you have enough time to master yet another Emacs mode, try this - http://www.emacswiki.org/emacs/NxhtmlMode - it's the mode, that combines several web-development modes to create a web-development platform.

– Mirzhan Irkegulov – 2011-10-26T06:22:27.403

Answers

0

The text-indent CSS property specifies the amount of indentation (empty space) that is put before lines of text in a block. By default, this controls the indentation of only the first formatted line of the block

Akanksha patel

Posted 2011-04-18T17:40:42.447

Reputation: 1