Function: js--maybe-goto-declaration-keyword-end
js--maybe-goto-declaration-keyword-end is a byte-compiled function
defined in js.el.gz.
Signature
(js--maybe-goto-declaration-keyword-end PARSE-STATUS)
Documentation
Helper function for js--proper-indentation.
Depending on the value of js-indent-first-init, move
point to the end of a variable declaration keyword so that
indentation is aligned to that column.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/js.el.gz
(defun js--maybe-goto-declaration-keyword-end (parse-status)
"Helper function for `js--proper-indentation'.
Depending on the value of `js-indent-first-init', move
point to the end of a variable declaration keyword so that
indentation is aligned to that column."
(cond
((eq js-indent-first-init t)
(when (looking-at js--declaration-keyword-re)
(goto-char (1+ (match-end 0)))))
((eq js-indent-first-init 'dynamic)
(let ((bracket (nth 1 parse-status))
declaration-keyword-end
at-closing-bracket-p
forward-sexp-function ; Use Lisp version.
comma-p)
(when (looking-at js--declaration-keyword-re)
(setq declaration-keyword-end (match-end 0))
(save-excursion
(goto-char bracket)
(setq at-closing-bracket-p
(condition-case nil
(progn
(forward-sexp)
t)
(error nil)))
(when at-closing-bracket-p
(while (forward-comment 1))
(setq comma-p (looking-at-p ","))))
(when comma-p
(goto-char (1+ declaration-keyword-end))))))))