[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);
- Re: CC Mode and electric-pair "problem"., (continued)
- Re: CC Mode and electric-pair "problem"., Alan Mackenzie, 2018/07/01
- Re: CC Mode and electric-pair "problem"., João Távora, 2018/07/01
- Re: CC Mode and electric-pair "problem"., Eli Zaretskii, 2018/07/01
- scratch/fontify-open-string. [Was: CC Mode and electric-pair "problem".], Alan Mackenzie, 2018/07/01
- Re: scratch/fontify-open-string. [Was: CC Mode and electric-pair "problem".], Stephen Leake, 2018/07/08
- Re: scratch/fontify-open-string. [Was: CC Mode and electric-pair "problem".], Stephen Leake, 2018/07/15
- Re: scratch/fontify-open-string. [Was: CC Mode and electric-pair "problem".], Eli Zaretskii, 2018/07/15
- Re: scratch/fontify-open-string. [Was: CC Mode and electric-pair "problem".], Alan Mackenzie, 2018/07/15
- Indentation of ?: in C-mode (was: scratch/fontify-open-string. [Was: CC Mode and electric-pair "problem".]), Stefan Monnier, 2018/07/15
- Re: Indentation of ?: in C-mode (was: scratch/fontify-open-string. [Was: CC Mode and electric-pair "problem".]),
Eli Zaretskii <=
- Re: Indentation of ?: in C-mode, Stefan Monnier, 2018/07/16
- Re: scratch/fontify-open-string. [Was: CC Mode and electric-pair "problem".], Alan Mackenzie, 2018/07/15
- Re: scratch/fontify-open-string. [Was: CC Mode and electric-pair "problem".], Stephen Leake, 2018/07/16
Re: CC Mode and electric-pair "problem"., Eli Zaretskii, 2018/07/01
Re: CC Mode and electric-pair "problem"., Paul Eggert, 2018/07/01
Re: CC Mode and electric-pair "problem"., Stephen Leake, 2018/07/06