From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: "Basil L. Contovounesios" Newsgroups: gmane.emacs.devel Subject: Re: [handa@m17n.org: C indentation problem] Date: Tue, 21 May 2019 11:57:42 +0100 Message-ID: <877eak2hy1.fsf@tcd.ie> References: <87muk7hc46.fsf@tcd.ie> <20190521103254.GA4706@ACM> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="229374"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org, rms@gnu.org, Kenichi Handa To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 21 13:08:43 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hT2dP-000xVi-EO for ged-emacs-devel@m.gmane.org; Tue, 21 May 2019 13:08:43 +0200 Original-Received: from localhost ([127.0.0.1]:51488 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hT2dO-0002fn-3o for ged-emacs-devel@m.gmane.org; Tue, 21 May 2019 07:08:42 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:57676) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hT2Ss-0003R7-9P for emacs-devel@gnu.org; Tue, 21 May 2019 06:57:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hT2Sq-0007X6-AH for emacs-devel@gnu.org; Tue, 21 May 2019 06:57:50 -0400 Original-Received: from mail-ed1-x541.google.com ([2a00:1450:4864:20::541]:38026) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hT2So-0007U9-Dx for emacs-devel@gnu.org; Tue, 21 May 2019 06:57:46 -0400 Original-Received: by mail-ed1-x541.google.com with SMTP id w11so28704939edl.5 for ; Tue, 21 May 2019 03:57:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=yocRtwjrnOQeuOfW3w4wD/bfahS4LiXvEeS+qNj/zs4=; b=BUZ5twanVPa/j3U67wJq5h2STxE5GrhHmpI5yR8n/VZ8fu2OF6XzUy6lO5iwjaSZK1 +TWua8Sa/P1gWwCkUADe/7DcdFf/AAcOUGXcAywt+z3XU7jxL8D8C9SFm6NrP+errfbU lYWTNZF7A0VdVMRyScKuqbeuUmurOQ4y4b6xtUmIMdBw+OVuB3GPMVPhsmq6FEoaC8dk YV4XQbtjxwai7tQHTQg+voFtUWYPLDp3m5vh275W+vCNZcoXQxrcpG4bUv3WqXGqfNeX YMTETSXphoRNnVBEgWwmOP2M+ZkjNYzNCGtz5DZ+BdzbYOprB+lczM0gLkHfqQjZz4Cd EF1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=yocRtwjrnOQeuOfW3w4wD/bfahS4LiXvEeS+qNj/zs4=; b=AEL+LbNk4D8kbFYEZR7rkxXammlXkeDiNp4AOqlDtyWSEkBV7IEbV3RcX4EK354P6J wcw5YI78fKk1LhEZbkDDeUweuzKOAxGKcaJ13dO3JnZQD7I8tQ8Ubws4ZDHlrahaKWyS vncYLtWyR6gxCLJZ7njodrBFMZ5T6loybYLmr2eh222mRTXaubobJVRKzBxWjXW0FLKJ 9CXPJyhIVkwIBoLfJ0L/iaZZkYufdxNGCELFWJkSSeLV3DFL6hqGX4XPcBAAmevFzA5+ +DX6/Fm8+zxjrM282+flZXxhw8xxH2UMWiyVZfGtRalh+p9mOuqjXFnO87Iho0GrodAD VVuw== X-Gm-Message-State: APjAAAWtInjxkMbhqtZ/Nz0SUQE8dgN8IIDSyWLXNyG/jtvfMHgkSG6k mmHXeC6vTmWGySUIykXYjlxD0Q== X-Google-Smtp-Source: APXvYqwiD9tVj8WtpT2kLkOZZzjA2WAoHOYEfEXHxyFOdQGRne96IOPWKUcQb6rxCtNlAMpjmyYU8A== X-Received: by 2002:a50:e048:: with SMTP id g8mr82391755edl.26.1558436264753; Tue, 21 May 2019 03:57:44 -0700 (PDT) Original-Received: from localhost ([2a02:8084:20e2:c380:8cad:ae29:555d:852d]) by smtp.gmail.com with ESMTPSA id g47sm6178826edc.33.2019.05.21.03.57.43 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 21 May 2019 03:57:43 -0700 (PDT) In-Reply-To: <20190521103254.GA4706@ACM> (Alan Mackenzie's message of "Tue, 21 May 2019 10:32:54 +0000") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::541 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:236853 Archived-At: Alan Mackenzie writes: > Sorry I missed this post when you posted it at the end of April. No worries. :) > The issue goes back to 2006. ;-) > > On Tue, Apr 30, 2019 at 14:11:05 +0100, Basil L. Contovounesios wrote: >> Kenichi Handa writes: > > [ .... ] > >> > Ah! Yes. I personally prefer Emacs 21 style (perhaps just >> > because I used to it for long time). > >> >> However, CC Mode 5.28 seems to me to indent like the Emacs 22 sources are >> >> indented, i.e. column 5, and 5. > >> CC Mode 5.33.2 also indents "Emacs 22-style", i.e. to 5 columns, but the >> current sources, AFAICS, are indented to 2 columns, "Emacs 21-style". > > More to the point, we no longer have knr declarations. > >> >> I suggest the following: a new lineup function, >> >> c-lineup-gnu-DEFUN-intro-cont which would be active only in GNU style, >> >> and would give the offset knr-argdecl-intro (i.e. 5) for the lines >> >> between DEFUN's closing paren and the function's opening brace. This new >> >> function would be tried only if the existing c-lineup-topmost-intro-cont >> >> returns nil. > >> Shouldn't the now-existing c-lineup-gnu-DEFUN-intro-cont be changed >> accordingly, to indent to 2 columns instead of 5? > > Seeing as how we don't have knr declarations any more, it seems senseless > now to indent with the CC Mode syntactic symbol knr-argdecl-intro, i.e. > 5. Instead c-basic-offset (2) seems right. > > How about the following patch? > > diff -r f9e4e46ed54d cc-align.el > --- a/cc-align.el Mon May 20 12:34:51 2019 +0000 > +++ b/cc-align.el Tue May 21 10:24:11 2019 +0000 > @@ -112,7 +112,7 @@ > (let (case-fold-search) > (goto-char (c-langelem-pos langelem)) > (if (looking-at "\\") > - (c-calc-offset '(knr-argdecl-intro)))))) > + c-basic-offset)))) > > (defun c-block-in-arglist-dwim (arglist-start) > ;; This function implements the DWIM to avoid far indentation of LGTM, thanks. -- Basil