Function: c-indent-one-line-block
c-indent-one-line-block is a byte-compiled function defined in
cc-align.el.gz.
Signature
(c-indent-one-line-block LANGELEM)
Documentation
Indent a one line block c-basic-offset extra.
E.g.:
if (n > 0) if (n > 0)
{m+=n; n=0;} <-> { <- c-indent-one-line-block
<--> c-basic-offset m+=n; n=0;
}
The block may use any kind of parenthesis character. nil is returned if the line doesn't start with a one line block, which makes the function usable in list expressions.
Work with: Almost all syntactic symbols, but most useful on *-open.
Probably introduced at or before Emacs version 20.3.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cc-align.el.gz
(defun c-indent-one-line-block (_langelem)
"Indent a one line block `c-basic-offset' extra.
E.g.:
if (n > 0) if (n > 0)
{m+=n; n=0;} <-> { <- c-indent-one-line-block
<--> c-basic-offset m+=n; n=0;
}
The block may use any kind of parenthesis character. nil is returned
if the line doesn't start with a one line block, which makes the
function usable in list expressions.
Work with: Almost all syntactic symbols, but most useful on *-open."
(save-excursion
(let ((eol (c-point 'eol)))
(back-to-indentation)
(if (and (eq (char-syntax (char-after)) ?\()
(c-safe (progn (c-forward-sexp) t))
(<= (point) eol))
c-basic-offset
nil))))