Function: c-lineup-2nd-brace-entry-in-arglist

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

Signature

(c-lineup-2nd-brace-entry-in-arglist LANGELEM)

Documentation

Lineup the second entry of a brace block under the first, when the first line is also contained in an arglist or an enclosing brace ON THAT LINE.

I.e. handle something like the following:

    set_line (line_t {point_t{0.4, 0.2},
                      point_t{0.2, 0.5}, <---- brace-list-intro
                      .....});
             ^ enclosing parenthesis.

The middle line of that example will have a syntactic context with three syntactic symbols, arglist-cont-nonempty, brace-list-intro, and brace-list-entry.

This function is intended for use in a list. If the construct being analyzed isn't like the preceding, the function returns nil. Otherwise it returns the function c-lineup-arglist-intro-after-paren, which the caller then uses to perform indentation.

Works with brace-list-intro.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-align.el.gz
(defun c-lineup-2nd-brace-entry-in-arglist (_langelem)
  "Lineup the second entry of a brace block under the first, when the first
line is also contained in an arglist or an enclosing brace ON THAT LINE.

I.e. handle something like the following:

    set_line (line_t {point_t{0.4, 0.2},
                      point_t{0.2, 0.5},       <---- brace-list-intro
                      .....});
             ^ enclosing parenthesis.

The middle line of that example will have a syntactic context
with three syntactic symbols, arglist-cont-nonempty, brace-list-intro, and
brace-list-entry.

This function is intended for use in a list.  If the construct
being analyzed isn't like the preceding, the function returns nil.
Otherwise it returns the function `c-lineup-arglist-intro-after-paren', which
the caller then uses to perform indentation.

Works with brace-list-intro."
  ;; brace-list-intro and brace-list-entry are both present for the second
  ;; entry of the list when the first entry is on the same line as the opening
  ;; brace.
  (and (assq 'brace-list-intro c-syntactic-context)
       (assq 'brace-list-entry c-syntactic-context)
       (or (assq 'arglist-cont-nonempty c-syntactic-context) ; "(" earlier on
							     ; the line.
	   (save-excursion		; "{" earlier on the line
	     (goto-char (c-langelem-pos
			 (assq 'brace-list-entry
			       c-syntactic-context)))
	     (and
	      (eq (c-backward-token-2
		   1 nil
		   (c-point 'bol (c-langelem-pos
				  (assq 'brace-list-entry
					c-syntactic-context))))
		  0)
	      (eq (char-after) ?{))))
       'c-lineup-arglist-intro-after-paren))