jsx / jsx-mode.el

Emacs major mode for JSX, an altJS
72 stars 13 forks source link

Auto indention of closing braces #2

Open nyuichi opened 12 years ago

nyuichi commented 12 years ago

A closing brace should be indented automatically as soon as I insert it in a single line as well as c/c++-mode or other modes. With current version of jsx-mode.el, closing braces remain the position they are inserted in.

abicky commented 12 years ago

I'll implement some input support features including the feature you want in version 0.2. Could you write the following code in your init.el temporarily? This code will realize the feature.

(defun jsx-mode-init ()
  (define-key jsx-mode-map (kbd "}")
    (lambda (arg)
      (interactive "*P")
      (self-insert-command (prefix-numeric-value arg))
      (indent-according-to-mode))))
(add-hook 'jsx-mode-hook 'jsx-mode-init)