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?

  • 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. – Mirzhan Irkegulov Oct 26 '11 at 6:22
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.