Function: js-indent-line

js-indent-line is an interactive and byte-compiled function defined in js.el.gz.

Signature

(js-indent-line)

Documentation

Indent the current line as JavaScript.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/js.el.gz
(defun js-indent-line ()
  "Indent the current line as JavaScript."
  (interactive)
  (let* ((parse-status
          (save-excursion (syntax-ppss (line-beginning-position))))
         (offset (- (point) (save-excursion (back-to-indentation) (point)))))
    (unless (nth 3 parse-status)
      (indent-line-to (js--proper-indentation parse-status))
      (when (> offset 0) (forward-char offset)))))