Function: c-lineup-cascaded-calls
c-lineup-cascaded-calls is a byte-compiled function defined in
cc-align.el.gz.
Signature
(c-lineup-cascaded-calls LANGELEM)
Documentation
Line up "cascaded calls" under each other.
If the line begins with "->" or "." and the preceding line ends with one or more function calls preceded by the same token, then the arrow is lined up with the first of those tokens. E.g.:
result = proc->add(17)->add(18)
->add(19) + <- c-lineup-cascaded-calls
offset; <- c-lineup-cascaded-calls (inactive)
In any other situation nil is returned to allow use in list expressions.
Works with: topmost-intro-cont, statement-cont, arglist-cont, arglist-cont-nonempty.
Probably introduced at or before Emacs version 22.1.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cc-align.el.gz
((setq depth (1+ depth)))))))))) ; Otherwise increase depth.
(defun c-lineup-cascaded-calls (langelem)
"Line up \"cascaded calls\" under each other.
If the line begins with \"->\" or \".\" and the preceding line ends
with one or more function calls preceded by the same token, then the
arrow is lined up with the first of those tokens. E.g.:
result = proc->add(17)->add(18)
->add(19) + <- c-lineup-cascaded-calls
offset; <- c-lineup-cascaded-calls (inactive)
In any other situation nil is returned to allow use in list
expressions.
Works with: topmost-intro-cont, statement-cont, arglist-cont,
arglist-cont-nonempty."
(if (and (eq (c-langelem-sym langelem) 'arglist-cont-nonempty)
(not (eq (c-langelem-2nd-pos c-syntactic-element)
(c-most-enclosing-brace (c-parse-state)))))
;; The innermost open paren is not our one, so don't do
;; anything. This can occur for arglist-cont-nonempty with
;; nested arglist starts on the same line.
nil
(save-excursion
(back-to-indentation)
(let ((operator (and (looking-at "->\\|\\.")
(regexp-quote (match-string 0))))
(stmt-start (c-langelem-pos langelem)) col)
(when (and operator
(looking-at operator)
(zerop (c-backward-token-2 1 t stmt-start))
(eq (char-after) ?\()
(zerop (c-backward-token-2 2 t stmt-start))
(looking-at operator))
(setq col (current-column))
(while (and (zerop (c-backward-token-2 1 t stmt-start))
(eq (char-after) ?\()
(zerop (c-backward-token-2 2 t stmt-start))
(looking-at operator))
(setq col (current-column)))
(vector col))))))