From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Augustin_Ch=C3=A9neau_=28BTuin=29?= Newsgroups: gmane.emacs.devel Subject: Re: In go-ts-mode, tab-width 4 inserts two tabs instead of one Date: Tue, 26 Sep 2023 15:02:29 +0200 Message-ID: References: <87ttrhchts.fsf@codeisgreat.org> <471adbcf-42a5-408e-a814-ff9f192a8590@mailo.com> <87pm25cdzf.fsf@codeisgreat.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11923"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: Emacs Development To: pankaj@codeisgreat.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Sep 26 15:03:13 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ql7ia-0002k2-Ix for ged-emacs-devel@m.gmane-mx.org; Tue, 26 Sep 2023 15:03:12 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ql7i5-0008Vz-Mf; Tue, 26 Sep 2023 09:02:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ql7i0-0008NG-Oy for emacs-devel@gnu.org; Tue, 26 Sep 2023 09:02:37 -0400 Original-Received: from msg-1.mailo.com ([213.182.54.11]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ql7hy-00056S-JE for emacs-devel@gnu.org; Tue, 26 Sep 2023 09:02:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1695733350; bh=aryfFpyVdt+07HFIDk7w2Su02BPuu077wefiLFEYFm0=; h=X-EA-Auth:Message-ID:Date:MIME-Version:Subject:To:References:Cc: From:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=G1GdDWJGwT/Qx5IVUmesbQxAiKwAAj/s5/VyvVg1OSek+fKzlH5H0EKIN809ftvQn ytqew8o4Urx1DxcRz/iqx2Fw5YYfAd4wtiHJ6grnVFkDyAJ6MGMEfzOcVay4qejrbS aXFzqSJWD/0phVOa//VDDQ+eWCXBnexZbl+4PdpI= Original-Received: by b221-5.in.mailobj.net [192.168.90.25] with ESMTP via ip-20.mailobj.net [213.182.54.20] Tue, 26 Sep 2023 15:02:30 +0200 (CEST) X-EA-Auth: 8MWg4gD6GyNUAeFBOxdHgvXm+xKLqPJWsm26alhy0AEuQKskOT5Mjbs4E332ZNHyN7w4zKFSHRw/zeFGImQba3tv/JyiLRUM Content-Language: fr, en-US In-Reply-To: <87pm25cdzf.fsf@codeisgreat.org> Received-SPF: pass client-ip=213.182.54.11; envelope-from=btuin@mailo.com; helo=msg-1.mailo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:311069 Archived-At: Le 26/09/2023 à 14:31, Pankaj Jangid a écrit : > "Augustin Chéneau (BTuin)" writes: > >> That's because tab-width only controls the appearance of a >> tabulation. > > I actually want this only. That is, I want to control the appearance of > tabulation only. > >> In go-ts-mode, the indentation offset is set by the variable >> go-ts-mode-indent-offset. Since it is 8 by default and that you have >> set tab-width to 4, it inserts two tabs to keep the offset of 8. >> >> So you simply need to set go-ts-mode-indent-offset to 4 or directly to >> tab-width (with (setq go-ts-mode-indent-offset tab-width)). > > Setting both, tab-width and go-ts-mode-indent-offset, to 4 results in > the desired behaviour. But I did not understand this. > > The doc string of go-ts-mode-indent-offset says, "Number of spaces for > each indentation step". But when I set both to 4, it uses TAB (which I > want), and not SPACEes. > > Is this variable explained in detail elsewhere? > So I don't know this very well, but from my understanding it replaces spaces with the equivalent tabs. For instance, if you set tab-width to 4 and go-ts-mode-indent-offset to 4, it will insert 4 spaces or equivalent, which are here equivalent to 1 tab, so it will insert one tab instead. If go-ts-mode-indent-offset is set to 6, it will insert 6 spaces or equivalent, which are here equivalent to one tab plus 2 spaces. It you want to use spaces only instead, you might want to look at indent-tabs-mode. There is also more information in the Emacs manual at "Indentation" () and in EmacsWiki ().