Function: c-electric-continued-statement
c-electric-continued-statement is a byte-compiled function defined in
cc-cmds.el.gz.
Signature
(c-electric-continued-statement)
Documentation
Reindent the current line if appropriate.
This function is used to reindent the line after a keyword which
continues an earlier statement is typed, e.g. an "else" or the
"while" in a do-while block.
The line is reindented if there is nothing but whitespace before the
keyword on the line, the keyword is not inserted inside a literal, and
c-electric-flag and c-syntactic-indentation are both non-nil.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cc-cmds.el.gz
(defun c-electric-continued-statement ()
"Reindent the current line if appropriate.
This function is used to reindent the line after a keyword which
continues an earlier statement is typed, e.g. an \"else\" or the
\"while\" in a do-while block.
The line is reindented if there is nothing but whitespace before the
keyword on the line, the keyword is not inserted inside a literal, and
`c-electric-flag' and `c-syntactic-indentation' are both non-nil."
(let (;; shut this up
(c-echo-syntactic-information-p nil))
(when (c-save-buffer-state ()
(and c-electric-flag
c-syntactic-indentation
(not (eq (c-last-command-char) ?_))
(= (save-excursion
(skip-syntax-backward "w")
(point))
(c-point 'boi))
(not (c-in-literal (c-point 'bod)))))
;; Have to temporarily insert a space so that
;; c-guess-basic-syntax recognizes the keyword. Follow the
;; space with a nonspace to avoid messing up any whitespace
;; sensitive meddling that might be done, e.g. by
;; `c-backslash-region'.
(insert-and-inherit " x")
(unwind-protect
(indent-according-to-mode)
(delete-char -2)))))