Function: c-lineup-arglist

c-lineup-arglist is a byte-compiled function defined in cc-align.el.gz.

Signature

(c-lineup-arglist LANGELEM)

Documentation

Line up the current argument line under the first argument.

As a special case, if the indented line is inside a brace block construct, the indentation is c-basic-offset only. This is intended as a "DWIM" measure in cases like macros that contains statement blocks, e.g.:

A_VERY_LONG_MACRO_NAME ({
        some (code, with + long, lines * in[it]);
    });
<--> c-basic-offset

This is motivated partly because it's more in line with how code blocks are handled, and partly since it approximates the behavior of earlier CC Mode versions, which due to inaccurate analysis tended to indent such cases this way.

Works with: arglist-cont-nonempty, arglist-close.

Probably introduced at or before Emacs version 28.1.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-align.el.gz
(defun c-lineup-arglist (_langelem)
  "Line up the current argument line under the first argument.

As a special case, if the indented line is inside a brace block
construct, the indentation is `c-basic-offset' only.  This is intended
as a \"DWIM\" measure in cases like macros that contains statement
blocks, e.g.:

A_VERY_LONG_MACRO_NAME ({
        some (code, with + long, lines * in[it]);
    });
<--> c-basic-offset

This is motivated partly because it's more in line with how code
blocks are handled, and partly since it approximates the behavior of
earlier CC Mode versions, which due to inaccurate analysis tended to
indent such cases this way.

Works with: arglist-cont-nonempty, arglist-close."
  (save-excursion
    (let ((indent-pos (point)))

      (if (c-block-in-arglist-dwim (c-langelem-2nd-pos c-syntactic-element))
	  c-basic-offset		; DWIM case.

	;; Normal case.  Indent to the token after the arglist open paren.
	(goto-char (c-langelem-2nd-pos c-syntactic-element))
	(if (and c-special-brace-lists
		 (c-looking-at-special-brace-list))
	    ;; Skip a special brace list opener like "({".
	    (progn (c-forward-token-2)
		   (forward-char))
	  (forward-char))
	(let ((arglist-content-start (point)))
	  (c-forward-syntactic-ws)
	  (when (< (point) indent-pos)
	    (goto-char arglist-content-start)
	    (skip-chars-forward " \t"))
	  (vector (current-column)))))))