emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Indentation of ?: in C-mode (was: scratch/fontify-open-string. [Was:


From: Eli Zaretskii
Subject: Re: Indentation of ?: in C-mode (was: scratch/fontify-open-string. [Was: CC Mode and electric-pair "problem".])
Date: Mon, 16 Jul 2018 17:18:02 +0300

> From: Stefan Monnier <address@hidden>
> Date: Sun, 15 Jul 2018 22:23:49 -0400
> 
> >> > +        find_start_value
> >> > +          = CONSP (state.levelstarts) ? XINT (XCAR (state.levelstarts))
> >> > +          : state.thislevelstart >= 0 ? state.thislevelstart
> >> > +          : find_start_value;
> >> Please use parentheses here for better readability (to clearly show
> >> which parts belong to which condition).
> > Yes, it didn't indent well by itself.  Maybe I should raise this with
> > the CC Mode maintainer.  But yes, I'll put parens in.
> 
> This is one of those rare cases where sm-c-mode handles it better:
> 
>     find_start_value
>       = CONSP (state.levelstarts) ? XINT (XCAR (state.levelstarts))
>         : state.thislevelstart >= 0 ? state.thislevelstart
>         : find_start_value;
> 
> This said, I don't see either indentation as problematic and I'm not
> sure what would be "better for readability".

This:

    find_start_value = CONSP (state.levelstarts)
                       ? XINT (XCAR (state.levelstarts))
                       : (state.thislevelstart >= 0
                          ? state.thislevelstart
                          : find_start_value);

Or maybe even this:

    find_start_value
      = CONSP (state.levelstarts)
        ? XINT (XCAR (state.levelstarts))
        : (state.thislevelstart >= 0 ? state.thislevelstart : find_start_value);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]