]> git.eshelyaron.com Git - emacs.git/commit
cc-mode: add ‘c-lineup-ternary-bodies’ (bug#41061)
authorMichal Nazarewicz <mina86@mina86.com>
Sun, 3 May 2020 15:32:47 +0000 (16:32 +0100)
committerMichal Nazarewicz <mina86@mina86.com>
Sat, 9 May 2020 10:30:32 +0000 (11:30 +0100)
commitfab23328512e47a50caced8d074e86e583cc8a9f
treecff2b8a73606da98e98cd74e0ccabc70b281a847
parent0bd6ae773a1ade1bdec2c233df4f260d028fd6c5
cc-mode: add ‘c-lineup-ternary-bodies’  (bug#41061)

Introduce ‘c-lineup-ternary-bodies’ function which, when used as
a c lineup function, aligns question mark and colon of a ternary
operator.  For example:

    return arg % 2 == 0 ? arg / 2
                        : (3 * arg + 1);

* lisp/progmodes/cc-align.el (c-lineup-ternary-bodies): New function.
* doc/misc/cc-mode.texi (Operator Line-Up Functions): Document the
new function.
* test/lisp/progmodes/cc-mode-tests.el (c-lineup-ternary-bodies): New
test case.
doc/misc/cc-mode.texi
etc/NEWS
lisp/progmodes/cc-align.el
test/lisp/progmodes/cc-mode-tests.el