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 Subject: Re: Supporting tabs for indentation, spaces for alignment Date: Sat, 13 Apr 2019 17:56:09 +0200 Message-ID: <87d0lp9a4k.fsf@Ergus.i-did-not-set--mail-host-address--so-tickle-me> References: <20190411090223.GA5183@ACM> <20190411102405.vcwdygrz36cjt3ld@Ergus> <20190412155442.GD4588@ACM> <20190413135446.GD13636@ACM> 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="158389"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: NeoMutt/20180716 Cc: emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 13 17:57:16 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 1hFL1o-000f35-2E for ged-emacs-devel@m.gmane.org; Sat, 13 Apr 2019 17:57:16 +0200 Original-Received: from localhost ([127.0.0.1]:52997 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFL1m-0000nB-Ey for ged-emacs-devel@m.gmane.org; Sat, 13 Apr 2019 11:57:14 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:48418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFL0s-0000mk-Hh for emacs-devel@gnu.org; Sat, 13 Apr 2019 11:56:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hFL0r-000289-A9 for emacs-devel@gnu.org; Sat, 13 Apr 2019 11:56:18 -0400 Original-Received: from sonic305-20.consmr.mail.ir2.yahoo.com ([77.238.177.82]:45269) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hFL0q-00026e-PJ for emacs-devel@gnu.org; Sat, 13 Apr 2019 11:56:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1555170974; bh=BVh5K7y/iO0flp2bCfZ5KW4EXBPMaDIavuV1KlYb4Io=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject; b=mwNZqF2ZChp4h/WnCZzw/MMmuF2APhkTijlRE/SZb0A/YfXTmI7RTDz++X3vaBaZwPlGuWIx/6OCeHjkA7e1pcOEwS/gjGNMV7ywYbWO0qQNj8XlUtNcVifaEi4FjvKFbqsNHavDxdHxl7Rs82/pYTW96W1xx+cLpLKfreo2Ogwo6ZjQmDGN5rx7VaZpVvGjPekXkNgkGptNOtf+47C4reIZ8jhnHkM07l4i/wcbL9tJdFSu1bLp99WRWnzl/H2JNgitfq9QZH1HD6/nZ7ErQ5ynp1doFWOUO3bAA7HEGEC2X4Emx47C/TTbhAOHXGtXkysV2hs3Di671/STdQZOSw== X-YMail-OSG: gEmDbJ8VM1ljZ7fnImtyXeDkMCijgRLuTNcgydX2s.k._WGnR9gkCDmUSWmG9av O5r2Y9VLSbCUWhu_BMrQ7OUN8IGfDGWJAdgmFgNjJbb8kX3T7SzYEwgs85cKPgpYCVOFScpLDYF2 QiO2EPzUe2D0K5som90DIQkoUolcULoCIcNz4HJb1e9jqdZ2l0W04sU4Iy2szfNMZPIH0C06wqdM WmZdO0aixzuUH8PLc9WT2ox4C2G2a8vumGsTaRpUP_N9Vs.Yk6lpC9gqk2DP97awQ8fGTjTW8ZFR yjxj1_ZURlxsxwc4etKLRmsCgPBjFB_UckkHXI8Dk31e6VHSewSnvOFLVRQvsdV.qexgtJ71GaMW 5YImx4tErMp2B8jR6yzwluz14N_AhHNvQ5sYypIcD8DE_sfUd1P0NgmHDIuCPXDk_kQKpLP_1wNa N8w4pOohFyfkRqsicvBnm98o3DNvDPXvogxp8dGk1.lLm_vTE7LmjxL6PqrQmaLCyQrYFCMZS.25 eppWs80TCmahHcYpdAW9m.EVxJNfKOdK7hdNPBtespBbIyWHDiMxc5UVauIFEqH0dd2PtSLGtgqu 9HjfT2RZJdQA1QVXoZWOLdHru2aZ5qeAqmikEa1GckE6udjBugXn6aNxjl7abTO29bbqWpFiaW0z PJpN4U59GEAr2258B675uK9wLFf1xD0LncLMRtZWho9ScBfRDeW1X.NYyRxJWtSHB3Vatb1tXHEs 9m2PNjsJWUbkOtRWpyvNKW1awyBYA9qdPoYlrt9jaNIWT6JUhVuzWY.sycYcj3yHlKsia19tdH.c jPFL_8kYnUC5qemo0BQwi1eXJlK7ybbxGZVSAkBRiM Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.ir2.yahoo.com with HTTP; Sat, 13 Apr 2019 15:56:14 +0000 Original-Received: from 2.152.205.184.dyn.user.ono.com (EHLO Ergus) ([2.152.205.184]) by smtp429.mail.ir2.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 7aedbbefb8928ca006ce4d01d60e6762; Sat, 13 Apr 2019 15:56:11 +0000 (UTC) Content-Disposition: inline In-Reply-To: <20190413135446.GD13636@ACM> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 77.238.177.82 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:235398 Archived-At: On Sat, Apr 13, 2019 at 01:54:46PM +0000, Alan Mackenzie wrote: >Hello, Davis. > >On Fri, Apr 12, 2019 at 16:39:16 +0000, Herring, Davis wrote: >> [Sent off-list because I don't know whether my DMARC issues have been >> addressed. Feel free to share it there if you'd like to make a public >> reply.] > >I'm doing this. I believe these mail issues, as they interact with >mailing lists, are a Hard Problem. I'm not sure how much progress has >been made on this by the admins, but they certainly haven't been >disregarding the problem. > >> > Getting concrete again, my understanding (please correct me if I am >> > wrong) of what you are suggesting is: "continuation" CC Mode source >> > lines should be indented with tabs up to the indent position of the >> > "main" line, and spaces after that. For some value of >> > "continuation" and "main" (see below). > >> I'm not saying your description in terms of CC Mode internals was >> incorrect, but I'd like to provide an implementation-independent >> description that can be easily verified. (Also, in case it hasn't >> been posted recently, the Emacs Wiki discusses this idea in some depth >> .) > >Thanks, I've read that. I've also downloaded the pertinent Elisp file. >I'm not quite sure how smart-tabs-mode works, yet, so I'm also not sure >what a secific CC Mode implementation could add. > >> The definition of "continuation" is simply that tabs are used whenever >> the user chooses the width of indentation and spaces are used whenever >> the editor chooses it (by comparing column positions in the text). > >So, roughly speaking, if a CC Mode "offset" is + or ++, then tabs would >be appropriate, otherwise spaces. > >> There is a tacit assumption here that the amounts of indentation >> chosen by the user are expressed in units of tabs. Conveniently, CC >> Mode already defines indentation in terms of levels, so this just >> means that a level equals a tab--i.e., that c-basic-offset and >> tab-width are not independent. It probably makes sense to, when this >> style is engaged, (setq tab-width c-basic-offset) after computing the >> latter from whatever other style information since it is more specific >> than any global setting of tab-width. > >Yes. I'll work out the precise details. > >But I'm now wondering why I should want to write a CC Mode specific >implementation. > >> Hope this helps, > >Very much so, thanks! > >> Davis > >-- >Alan Mackenzie (Nuremberg, Germany). > I agree that a general implementation could be a better approach, because other modes could take advantage of it. At least the basic infrastructure. But also because different modes will need to support different customizable variants of this in the future and every mode shouldn't reinvent the well ever time. Nevertheless CC-mode will require a specific implementation any way because there is more complexity with syntax analysis, but also because most of the programming languages that exposes this issue needs cc-mode in emacs. Maybe we should first agree about what is the basic functionality that needs to be added in the emacs core and then we could consider specializations for cc-mode if they are needed (pretty sure they'll do). I don't know if the other modes in emacs are implemented like cc-mode, but the approach you mentioned yesterday is something that maybe fits for most of them. So a basic infraestructure for the "continuation array" may be language/mode independent. Languages like python or julia where mixing tabs with spaced is dangerous; probably need to assert to use only spaces or tabs (pep 8 recommends spaces only and it is kind of standard now... similar happens in Fortran, most compilers support to use tabs, but not all). Pascal on the other hand uses tabs, but the tab-width is usually 3 or 4. So, at the end, every prog-mode will need a sort of specialization.