From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel 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 Message-ID: <83601f9sdh.fsf@gnu.org> References: <20180627182717.GA4625@ACM> <20180630190327.GC6816@ACM> <83tvpkkr93.fsf@gnu.org> <20180630201447.GE6816@ACM> <83o9frkmk7.fsf@gnu.org> <20180701163825.GC4697@ACM> <86bmbiceq7.fsf@stephe-leake.org> <86lgacswk8.fsf@stephe-leake.org> <83bmb8a5x0.fsf@gnu.org> <20180715184538.GC4897@ACM> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1531750564 12134 195.159.176.226 (16 Jul 2018 14:16:04 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 16 Jul 2018 14:16:04 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 16 16:16:00 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ff4IB-00032i-T1 for ged-emacs-devel@m.gmane.org; Mon, 16 Jul 2018 16:16:00 +0200 Original-Received: from localhost ([::1]:52020 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ff4KI-0001fd-Qf for ged-emacs-devel@m.gmane.org; Mon, 16 Jul 2018 10:18:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ff4K7-0001fN-9u for emacs-devel@gnu.org; Mon, 16 Jul 2018 10:18:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ff4K2-0004Tn-BJ for emacs-devel@gnu.org; Mon, 16 Jul 2018 10:17:59 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:46496) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ff4K2-0004Tg-6r; Mon, 16 Jul 2018 10:17:54 -0400 Original-Received: from [176.228.60.248] (port=3281 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ff4K1-0008Fz-LZ; Mon, 16 Jul 2018 10:17:54 -0400 In-reply-to: (message from Stefan Monnier on Sun, 15 Jul 2018 22:23:49 -0400) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:227451 Archived-At: > From: Stefan Monnier > 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);