From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.devel,gmane.emacs.help Subject: Re: C style alist question? Date: Thu, 11 Apr 2019 03:16:59 +0200 Message-ID: <20190411011659.zplon3n3lrtqmb2i@Ergus> References: <20190406032636.7ftf2ua54uhy2k7e@Ergus> <837ec7bpe4.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="134464"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: NeoMutt/20180716 Cc: help-gnu-emacs@gnu.org To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Apr 11 03:17:38 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 1hEOLO-000Ynq-Kp for ged-emacs-devel@m.gmane.org; Thu, 11 Apr 2019 03:17:35 +0200 Original-Received: from localhost ([127.0.0.1]:39923 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hEOLN-0000Ds-EV for ged-emacs-devel@m.gmane.org; Wed, 10 Apr 2019 21:17:33 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:34482) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hEOLC-0000Db-8X for emacs-devel@gnu.org; Wed, 10 Apr 2019 21:17:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hEOLB-0000UB-64 for emacs-devel@gnu.org; Wed, 10 Apr 2019 21:17:22 -0400 Original-Received: from sonic311-32.consmr.mail.ir2.yahoo.com ([77.238.176.164]:35280) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hEOLA-0000ST-Fh for emacs-devel@gnu.org; Wed, 10 Apr 2019 21:17:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1554945438; bh=23ebIY7g9mxCrSFbHsRcZoK0H2BWcSUHzVZ7ZTEcjYw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject; b=h5fvvM8XWf4OjXNMmB3oxMQKEK1rr4W88pnID/Kp648SQynlovs4vVL55mamS5Jl7aQrTZkhxy0E9OwjDJWSL2KiAHIrFtiIh8S10cw6+YVGkcvOUtK5XG+xXsxO3Q3mvKoeI2jhtdwzyMt5a+7aeZgUiFU4nbGHf7roK2zJyLi4o4bFMhBacsUe3UZPBO96dFm2QiVxj1hohlNcpE97u+TBO/goM3NedMwhyzXugfie571Tl63vdLMCT4ID8T9AljyhOfw1Be94rxzHIZE0Ijofumjnze62Bb36/9/1aTtktsIBuKT0UJNBWdVjD4PTD5YwxJX+ZtIMSTd52nRXBg== X-YMail-OSG: 4p6A3ocVM1lnX9lqntqYoj0P.7gkRpRWQLT2JKpOUacg7w8vFwjGWkt3g.uFJGu qWZer08Kh0MF1IQ_xpHpkTTcfQtI5KTP4aSTNKSN_7XM.PTwr0gTdoEUcPDco.gcqS5EvEl45luv sB0Cf7FUbqT_5hLTEtixurtoxN4FUaemc5amE.dEKqKOtN29IDzsrMkr.gmYa3Gz3fbmA8_zS0iY 59PzxcOHRUrlCHaIj08faERsN3op7OB.qFCS9j7lA9fKpqg97GqnwyyG1CYDLdMkAuxvcfpH.pFY ALAwGA7Rif2I4Tppvnx2EUB9E1uxub8hlhNs_O0XmW0XQ6NN7K5ZAR9afa7nIpFhxN2SAx0XHrLH DH5P9UVKskxdNPwyzwz7M43y8IUfUTXbi075632H.GxPS1P5OyYCNfRC2bgiDNnV5piSCy0r3SSb 9A.Q1tCW5dOuicUxfzi9Gtl4pS75mZfr6o0zt0YluVqXb5XpL4cyqTJEv2i4gcP_js51yJq5gOXE ojombL.ex0YpiYJrrPH9CBoPUR05t_nQRdsyo.0A7DMJM_3U8h4zYxnA6UGqBL2iv6uvzVXWtWqv 8xBo._q2ws3kd.PBxQ2kxeioDeOC1og8v3KgNOgnH7Gde9uUGP76XuC9u5q_6QPcpU78APvHzdyC BF_LOAvx6jT69RtX2VU2hBOAki3A4fh6uZD0vG.xEbycE.JGRU011Fa685yQm4J97Qcb8vWNQzKW .B5KFGvaSl67.YOgWTQCT8mvDKkmSKNem6pnOcp6IrOyfefOFvdPCtD57GGfBXskvbJf0ZYL5KeV SAfMlYpqVuCdYJCF4aWvw6So66lp.44csvQJfCkVr5 Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.ir2.yahoo.com with HTTP; Thu, 11 Apr 2019 01:17:18 +0000 Original-Received: from 2.152.205.184.dyn.user.ono.com (EHLO Ergus) ([2.152.205.184]) by smtp430.mail.ir2.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 38df7b5da97400799cc7f53f0e531bdf; Thu, 11 Apr 2019 01:17:14 +0000 (UTC) Content-Disposition: inline In-Reply-To: <837ec7bpe4.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 77.238.176.164 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:235264 gmane.emacs.help:119916 Archived-At: (I send to both mailing lists because it is related with a previous thread, but the right destination for this mail is the devels mailing list) Hi guys: The issue I was facing with indentations was related actually with the fact that once an offset is set (for example in the init file) it is ignored in some cases by c-set-style because it is not "from style" anymore. Does it makes sense (or is not too difficult) to provide an option (or a parameter in c-set-style) that allows the user to overwrite all the previous offsets with the values from the new style, in spite of if it is not "from style"? Maybe it already exist? Another question: Actually emacs C indentation with tabs follows the following policy: It add as many tabs as possible and then align with spaces until the desired column is reached. ==================== -------> is a tab . is a space ==================== ``` int function(int var1, ------->.....double b, ------->.....double c) { ------->for (int i = 0; i < 10; ++i) ------->------->myprintf ("%d\n", ------->------->------->..i); } ``` But other common policies around are: 1) add only tabs (and ignore the small mismatch in some cases) int function(int var1, ------->double b, ------->double c) { ------->for (int i = 0; i < 10; ++i) ------->------->myprintf ("%d\n", ------->------->------->i); } 2) Use tabs (but only for indentation) and spaces to align int function(int var1, .............double b) { ------->for (int i = 0; i < 10; ++i) ------->------->myprintf ("%d\n", ------->------->..........i); } The last one is specially useful in C++ where templates and long type names usually forces to break functions and expressions (and templated types inside functions declarations) on multiple lines; because they keep the alignment in different editors (or different emacs with different tab-width). Is it some variable/policy or method to produce 1 or 2 with what is already there?? Thanks in advance, Ergus. On Sat, Apr 06, 2019 at 09:48:19AM +0300, Eli Zaretskii wrote: >> Date: Sat, 6 Apr 2019 05:26:38 +0200 >> From: Ergus >> >> I usually edit code in two styles; the linux kernel style and now the >> emacs style. But I have seen that there are some mismatches between the >> style alists and the "official" styles. > >Sorry, I don't understand what are "style alists" and the "official >styles". Please elaborate on that. > >> For example: >> >> When I open an emacs' C source code I see details like the fill-column >> is 70 instead of 78. >> >> In the kernel style the indent-tabs-mode is not set to t. > >Our style is defined by the .dir-locals.el file you see in the >repository. indent-tabs-mode is t only in Emacs Lisp mode. > >> So, is it possible to fix this in order to bring a better and easier >> user initial experience with the right default values? > >Fix how? Change our style? I think that'd be a hard change to sell, >because the current defaults were discussed several times and are a >kind of compromise between different preferences, but you need to >raise this on emacs-devel, not here. >