GNU bug report logs -
#41061
[PATCH] cc-mode: add ‘c-lineup-ternary-bodies’
Previous Next
Reported by: Michal Nazarewicz <mina86 <at> mina86.com>
Date: Sun, 3 May 2020 20:32:01 UTC
Severity: wishlist
Tags: patch
Done: Michał Nazarewicz <mina86 <at> mina86.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Hello, Michal.
In article <mailman.1983.1588537924.3066.bug-gnu-emacs <at> gnu.org> you wrote:
> 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.
> ---
> It’s not perfectly clear to me whether there is a better
> implementation of this. Some sort of function that cc-mode provides
> which parses an expression into a syntax tree of some kind perhaps.
> The approach I’ve taken does seem to work well enough though.
> If there isn’t any opposition to this, I’m gonna push it in a week or
> so.
Which you did.
This afternoon I tidied up one or two typos, and made a trivial
amendment to the code.
Just one thing: please keep curly quotes right out of the CC Mode
sources. They make working with the code more difficult (these
characters don't exist on many keyboard layouts) and add nothing of
value. The same applies to other awkward non-keyboard characters
unless, of course, there's a good reason for using them, such as their
being part of somebody's name.
Thanks!
--
Alan Mackenzie (Nuremberg, Germany).
This bug report was last modified 4 years and 358 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.